FenchelNielsenZomorrodian.Discrete.CompactFuchsian.SecondReduction.QuotientAndBasis

54 Theorem | 22 Definition | 2 Abbreviation

This module develops the maps induced by continuous homomorphisms. It organizes the relevant quotient pullbacks and finite-stage maps, then proves the compatibility statements needed for the completed construction.

import
Imported by

Declarations

noncomputable def secondReductionCanonicalSourceFreeQuotientHom
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    let σ :=
      secondReductionCanonicalSourceSignature m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    FreeGroup (FuchsianGenerator σ) →* Multiplicative (ZMod q) := by
  classical
  dsimp
  let σ :=
    secondReductionCanonicalSourceSignature m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  exact
    FreeGroup.lift
      (ellipticQuotientGeneratorImage σ
        (secondReductionCanonicalSourceQuotientImage
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail))

The source free quotient homomorphism used in the canonical second reduction.

@[simp 900] theorem secondReductionCanonicalSourceFreeQuotientHom_firstDistinguished
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    secondReductionCanonicalSourceFreeQuotientHom
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
        (FreeGroup.of
          (FuchsianGenerator.elliptic
            (secondReductionCanonicalSourceMiddleIndex
              m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail ⟨0, by omega⟩))) =
      Multiplicative.ofAdd (1 : ZMod q)

The source free quotient homomorphism sends the first distinguished generator to its prescribed target.

Show proof
theorem secondReductionCanonicalSourceFreeQuotientHom_respects_relators
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    let σ

The source free quotient homomorphism respects the canonical second-reduction relators.

Show proof
noncomputable abbrev secondReductionCanonicalDistinguishedGenerator
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    FuchsianGenerator
      (secondReductionCanonicalSourceSignature
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail) :=
  FuchsianGenerator.elliptic
    (secondReductionCanonicalSourceMiddleIndex
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail ⟨0, by omega⟩)

The distinguished generator used in the canonical second-reduction quotient.

noncomputable def secondReductionCanonicalSchreierTransversal
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
    let σ :=
      secondReductionCanonicalSourceSignature m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    Set (FreeGroup (FuchsianGenerator σ)) := by
  classical
  dsimp
  letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
  let σ :=
    secondReductionCanonicalSourceSignature m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let φ :=
    secondReductionCanonicalSourceFreeQuotientHom
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let x : FuchsianGenerator σ :=
    secondReductionCanonicalDistinguishedGenerator
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  exact Set.range (cyclicQuotientRightRep φ (FreeGroup.of x))

The chosen Schreier transversal used in the canonical second reduction.

theorem secondReductionCanonicalSchreierTransversal_isRightSchreierTransversal
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q

The chosen second-reduction Schreier transversal is a right Schreier transversal.

Show proof
noncomputable def secondReductionCanonicalSchreierBasisEquiv
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
    let σ :=
      secondReductionCanonicalSourceSignature m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    letI : DecidableEq (FuchsianGenerator σ) := Classical.decEq _
    let φ :=
      secondReductionCanonicalSourceFreeQuotientHom
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    let hT :=
      secondReductionCanonicalSchreierTransversal_isRightSchreierTransversal
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    FreeGroup ↥(schreierGeneratorSet hT) ≃* φ.ker := by
  classical
  dsimp
  letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
  let σ :=
    secondReductionCanonicalSourceSignature m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  letI : DecidableEq (FuchsianGenerator σ) := Classical.decEq _
  let φ :=
    secondReductionCanonicalSourceFreeQuotientHom
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let x : FuchsianGenerator σ :=
    secondReductionCanonicalDistinguishedGenerator
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  have hx : φ (FreeGroup.of x) = Multiplicative.ofAdd (1 : ZMod q) := by
    simp only [Lean.Elab.WF.paramLet, secondReductionCanonicalDistinguishedGenerator,
  secondReductionCanonicalSourceFreeQuotientHom_firstDistinguished m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail, φ, x]
  simpa [secondReductionCanonicalSchreierTransversal, σ, φ, x] using
    freeGroupKernelSchreierBasisEquivOfCyclicQuotientGenerator φ x hx

The Schreier basis equivalence used in the canonical second reduction.

@[simp 900] theorem secondReductionCanonicalSchreierBasisEquiv_symm_apply
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q

The inverse Fenchel--Nielsen--Zomorrodian comparison is evaluated by the coordinate expression determined by the chosen Schreier basis.

Show proof
theorem secondReductionCanonicalSchreierToTarget_mapsRelators_of_source_cases
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (τ : FuchsianSignature)
      (η :
        letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
        let σ :=
          secondReductionCanonicalSourceSignature
            m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
        letI : DecidableEq (FuchsianGenerator σ) := Classical.decEq _
        let hT :=
          secondReductionCanonicalSchreierTransversal_isRightSchreierTransversal
            m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
        FreeGroup ↥(schreierGeneratorSet hT) →* FreeGroup (FuchsianGenerator τ))
      (targetRelators : Set (FreeGroup (FuchsianGenerator τ)))
      (hZero :
      letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
      let σ :=
        secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let φ :=
        secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      letI : DecidableEq (FuchsianGenerator σ) := Classical.decEq _
      let e :=
        secondReductionCanonicalSchreierBasisEquiv
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let x : FuchsianGenerator σ :=
        secondReductionCanonicalDistinguishedGenerator
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let i₀ :=
        secondReductionCanonicalSourceZeroIndex
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      ∀ k : Fin q,
        η
            (e.symm
              (⟨(FreeGroup.of x) ^ k.val * ((xWord σ i₀) ^ σ.periods i₀) *
                  ((FreeGroup.of x) ^ k.val)⁻¹, by
                change φ
                    ((FreeGroup.of x) ^ k.val * ((xWord σ i₀) ^ σ.periods i₀) *
                      ((FreeGroup.of x) ^ k.val)⁻¹) = 1
                have hrφ :
                    φ ((xWord σ i₀) ^ σ.periods i₀) = 1 :=
                  secondReductionCanonicalSourceFreeQuotientHom_respects_relators
                    m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
                    ((xWord σ i₀) ^ σ.periods i₀) (Or.inl ⟨i₀, rfl⟩)
                simp only [Lean.Elab.WF.paramLet, map_mul, map_pow, hrφ, mul_one, map_inv, mul_inv_cancel]⟩ : φ.ker)) ∈
            Subgroup.normalClosure targetRelators)
    (hOne :
      letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
      let σ :=
        secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let φ :=
        secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      letI : DecidableEq (FuchsianGenerator σ) := Classical.decEq _
      let e :=
        secondReductionCanonicalSchreierBasisEquiv
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let x : FuchsianGenerator σ :=
        secondReductionCanonicalDistinguishedGenerator
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let i₁ :=
        secondReductionCanonicalSourceOneIndex
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      ∀ k : Fin q,
        η
            (e.symm
              (⟨(FreeGroup.of x) ^ k.val * ((xWord σ i₁) ^ σ.periods i₁) *
                  ((FreeGroup.of x) ^ k.val)⁻¹, by
                change φ
                    ((FreeGroup.of x) ^ k.val * ((xWord σ i₁) ^ σ.periods i₁) *
                      ((FreeGroup.of x) ^ k.val)⁻¹) = 1
                have hrφ :
                    φ ((xWord σ i₁) ^ σ.periods i₁) = 1 :=
                  secondReductionCanonicalSourceFreeQuotientHom_respects_relators
                    m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
                    ((xWord σ i₁) ^ σ.periods i₁) (Or.inl ⟨i₁, rfl⟩)
                simp only [Lean.Elab.WF.paramLet, map_mul, map_pow, hrφ, mul_one, map_inv, mul_inv_cancel]⟩ : φ.ker)) ∈
            Subgroup.normalClosure targetRelators)
    (hMiddle :
      letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
      let σ :=
        secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let φ :=
        secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      letI : DecidableEq (FuchsianGenerator σ) := Classical.decEq _
      let e :=
        secondReductionCanonicalSchreierBasisEquiv
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let x : FuchsianGenerator σ :=
        secondReductionCanonicalDistinguishedGenerator
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      ∀ r : Fin p, ∀ k : Fin q,
        let iMiddle :=
          secondReductionCanonicalSourceMiddleIndex
            m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail r
        η
            (e.symm
              (⟨(FreeGroup.of x) ^ k.val * ((xWord σ iMiddle) ^ σ.periods iMiddle) *
                  ((FreeGroup.of x) ^ k.val)⁻¹, by
                change φ
                    ((FreeGroup.of x) ^ k.val * ((xWord σ iMiddle) ^ σ.periods iMiddle) *
                      ((FreeGroup.of x) ^ k.val)⁻¹) = 1
                have hrφ :
                    φ ((xWord σ iMiddle) ^ σ.periods iMiddle) = 1 :=
                  secondReductionCanonicalSourceFreeQuotientHom_respects_relators
                    m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
                    ((xWord σ iMiddle) ^ σ.periods iMiddle) (Or.inl ⟨iMiddle, rfl⟩)
                simp only [Lean.Elab.WF.paramLet, map_mul, map_pow, hrφ, mul_one, map_inv, mul_inv_cancel]⟩ : φ.ker)) ∈
            Subgroup.normalClosure targetRelators)
    (hTail :
      letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
      let σ :=
        secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let φ :=
        secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      letI : DecidableEq (FuchsianGenerator σ) := Classical.decEq _
      let e :=
        secondReductionCanonicalSchreierBasisEquiv
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let x : FuchsianGenerator σ :=
        secondReductionCanonicalDistinguishedGenerator
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      ∀ b : Fin p, ∀ j : Fin tailLen, ∀ k : Fin q,
        let iTail :=
          secondReductionCanonicalSourceTailIndex
            m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail b j
        η
            (e.symm
              (⟨(FreeGroup.of x) ^ k.val * ((xWord σ iTail) ^ σ.periods iTail) *
                  ((FreeGroup.of x) ^ k.val)⁻¹, by
                change φ
                    ((FreeGroup.of x) ^ k.val * ((xWord σ iTail) ^ σ.periods iTail) *
                      ((FreeGroup.of x) ^ k.val)⁻¹) = 1
                have hrφ :
                    φ ((xWord σ iTail) ^ σ.periods iTail) = 1 :=
                  secondReductionCanonicalSourceFreeQuotientHom_respects_relators
                    m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
                    ((xWord σ iTail) ^ σ.periods iTail) (Or.inl ⟨iTail, rfl⟩)
                simp only [Lean.Elab.WF.paramLet, map_mul, map_pow, hrφ, mul_one, map_inv, mul_inv_cancel]⟩ : φ.ker)) ∈
            Subgroup.normalClosure targetRelators)
    (hTotal :
      letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
      let σ :=
        secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let φ :=
        secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      letI : DecidableEq (FuchsianGenerator σ) := Classical.decEq _
      let e :=
        secondReductionCanonicalSchreierBasisEquiv
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      let x : FuchsianGenerator σ :=
        secondReductionCanonicalDistinguishedGenerator
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
      ∀ k : Fin q,
        η
            (e.symm
              (⟨(FreeGroup.of x) ^ k.val * totalRelation σ *
                  ((FreeGroup.of x) ^ k.val)⁻¹, by
                change φ
                    ((FreeGroup.of x) ^ k.val * totalRelation σ *
                      ((FreeGroup.of x) ^ k.val)⁻¹) = 1
                have hrφ : φ (totalRelation σ) = 1 :=
                  secondReductionCanonicalSourceFreeQuotientHom_respects_relators
                    m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
                    (totalRelation σ) (Or.inr rfl)
                simp only [Lean.Elab.WF.paramLet, map_mul, map_pow, hrφ, mul_one, map_inv, mul_inv_cancel]⟩ : φ.ker)) ∈
            Subgroup.normalClosure targetRelators) :
    letI : NeZero q

The canonical Schreier-to-target map sends each source relator case to a target relator.

Show proof
abbrev SecondReductionCanonicalOrderedTargetIndex (tailLen p q : ℕ) :=
  Fin 2 ⊕
    (Fin q × (Fin (p - 2) ⊕ ((Fin p × Fin tailLen) ⊕ Fin 2)))

The finite index type for the second-reduction canonical ordered target.

def secondReductionTransportIndexEquivCanonicalOrderedTargetIndex
    (tailLen p q : ℕ) :
    SecondReductionTransportIndex tailLen p q ≃
      SecondReductionCanonicalOrderedTargetIndex tailLen p q where
  toFun
    | ⟨.inl h, k⟩ => .inr (k, .inr (.inr h))
    | ⟨.inr (.inl d), _⟩ => .inl d
    | ⟨.inr (.inr (.inl r)), k⟩ => .inr (k, .inl r)
    | ⟨.inr (.inr (.inr jk)), k⟩ => .inr (k, .inr (.inl (jk.2, jk.1)))
  invFun
    | .inl d => ⟨.inr (.inl d), (0 : Fin 1)⟩
    | .inr (k, .inl r) => ⟨.inr (.inr (.inl r)), k⟩
    | .inr (k, .inr (.inl bj)) => ⟨.inr (.inr (.inr (bj.2, bj.1))), k⟩
    | .inr (k, .inr (.inr h)) => ⟨.inl h, k⟩
  left_inv x := by
    rcases x with ⟨src, k⟩
    cases src with
    | inl _ => rfl
    | inr rest =>
        cases rest with
        | inl _ =>
            fin_cases k
            rfl
        | inr rest =>
            cases rest with
            | inl _ => rfl
            | inr _ => rfl
  right_inv x := by
    cases x with
    | inl _ => rfl
    | inr rest =>
        rcases rest with ⟨_, block⟩
        cases block with
        | inl _ => rfl
        | inr rest =>
            cases rest with
            | inl bj =>
                rcases bj with ⟨_, _⟩
                rfl
            | inr _ => rfl

The finite-index equivalence reindexes transported second-reduction indices as canonical ordered target indices.

def secondReductionCanonicalOrderedTargetBlockIndexEquivFin
    (tailLen p : ℕ) :
    (Fin (p - 2) ⊕ ((Fin p × Fin tailLen) ⊕ Fin 2)) ≃
      Fin (secondReductionCanonicalOrderedTargetBlockLen tailLen p) :=
  ((Equiv.sumCongr (Equiv.refl (Fin (p - 2)))
      ((Equiv.sumCongr finProdFinEquiv (Equiv.refl (Fin 2))).trans
        finSumFinEquiv)).trans finSumFinEquiv).trans
    (finCongr (by
      dsimp [secondReductionCanonicalOrderedTargetBlockLen]
      omega))

The finite-index equivalence reindexes a second-reduction canonical ordered target block.

def secondReductionCanonicalOrderedTargetIndexEquivFin
    (tailLen p q : ℕ) :
    SecondReductionCanonicalOrderedTargetIndex tailLen p q ≃
      Fin (secondReductionCanonicalOrderedTargetNumPeriods tailLen p q) :=
  (Equiv.sumCongr (Equiv.refl (Fin 2))
      ((Equiv.prodCongr (Equiv.refl (Fin q))
          (secondReductionCanonicalOrderedTargetBlockIndexEquivFin tailLen p)).trans
        finProdFinEquiv)).trans
    finSumFinEquiv

The finite-index equivalence reindexes the second-reduction canonical ordered target periods.

def secondReductionTransportIndexEquivCanonicalOrderedTargetFin
    (tailLen p q : ℕ) :
    SecondReductionTransportIndex tailLen p q ≃
      Fin (secondReductionCanonicalOrderedTargetNumPeriods tailLen p q) :=
  (secondReductionTransportIndexEquivCanonicalOrderedTargetIndex tailLen p q).trans
    (secondReductionCanonicalOrderedTargetIndexEquivFin tailLen p q)

The finite-index equivalence reindexes the transported second-reduction periods as canonical ordered target periods.

private theorem secondReduction_negOneCycleSegmentProduct_eq {G : Type*} [Group G]
    (x y : G) : ∀ (n l : ℕ), l ≤ n →
    (List.ofFn (fun i : Fin l =>
      x ^ (n - i.val) * y * (x ^ (n - 1 - i.val))⁻¹)).prod =
        x ^ n * y ^ l * (x ^ (n - l))⁻¹
  | n, 0, _ => by
      simp only [List.ofFn_zero, List.prod_nil, pow_zero, mul_one, tsub_zero, mul_inv_cancel]
  | n, l + 1, h => by
      have hl : l ≤ n - 1

The second-reduction negative-one cycle segment product has the stated closed form.

Show proof
theorem secondReduction_list_ofFn_desc_split {α : Type*} {p k : ℕ} (hk : k < p)
    (f : Fin p → α) :
    List.ofFn (fun i : Fin (p - 1) => f ⟨p - 1 - i.val, by omega⟩) =
      List.ofFn (fun i : Fin (p - 1 - k) => f ⟨p - 1 - i.val, by omega⟩) ++
        List.ofFn (fun i : Fin k => f ⟨k - i.val, by omega⟩)

The descending finite list used in the second reduction splits at the specified index.

Show proof
theorem secondReduction_rotatedBlockProduct_mem_normalClosure
    {G : Type*} [Group G] {R : Set G}
    (x y h₀ h₁ : G) {middleLen tailLen p q : ℕ}
    (middle : Fin middleLen → G) (tail : Fin p → Fin tailLen → G)
    (h :
      x * y *
          ((List.ofFn middle).prod *
            (List.ofFn (fun b : Fin p =>
              (List.ofFn (fun j : Fin tailLen => tail b j)).prod)).prod *
            h₀ * h₁) ∈
        Subgroup.normalClosure R) :
    x ^ q * y ^ q *
        (List.ofFn (fun k : Fin q =>
          (List.ofFn (fun r : Fin middleLen =>
            x ^ k.val * middle r * (x ^ k.val)⁻¹)).prod *
          (List.ofFn (fun b : Fin p =>
            (List.ofFn (fun j : Fin tailLen =>
              x ^ k.val * tail b j * (x ^ k.val)⁻¹)).prod)).prod *
          (x ^ k.val * h₀ * (x ^ k.val)⁻¹) *
          (x ^ k.val * h₁ * (x ^ k.val)⁻¹))).prod ∈
      Subgroup.normalClosure R

The named second-reduction relator follows from the source presentation relators and therefore lies in their normal closure.

Show proof
def secondReductionCanonicalTransportDistinguishedIndex
    (tailLen p q : ℕ) (d : Fin 2) :
    SecondReductionTransportIndex tailLen p q :=
  ⟨Sum.inr (Sum.inl d), ⟨0, by simp only [secondReductionSourceCycleCount, zero_lt_one]⟩⟩

The distinguished index in the second-reduction canonical ordered target data.

def secondReductionCanonicalTransportHeadIndex
    (tailLen p q : ℕ) (h : Fin 2) (k : Fin q) :
    SecondReductionTransportIndex tailLen p q :=
  ⟨Sum.inl h, by simpa [secondReductionSourceCycleCount] using k⟩

The head index in the second-reduction canonical ordered target data.

def secondReductionCanonicalTransportMiddleRestIndex
    (tailLen p q : ℕ) (r : Fin (p - 2)) (k : Fin q) :
    SecondReductionTransportIndex tailLen p q :=
  ⟨Sum.inr (Sum.inr (Sum.inl r)), by simpa [secondReductionSourceCycleCount] using k⟩

The middle-rest index in the second-reduction canonical ordered target data.

def secondReductionCanonicalTransportTailIndex
    (tailLen p q : ℕ) (b : Fin p) (j : Fin tailLen) (k : Fin q) :
    SecondReductionTransportIndex tailLen p q :=
  ⟨Sum.inr (Sum.inr (Sum.inr (j, b))), by simpa [secondReductionSourceCycleCount] using k⟩

The second-reduction canonical ordered target data use this constructor as the tail index.

noncomputable def secondReductionCanonicalTransportTargetWord
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    let τ :=
      secondReductionTransportSignature (p := p) hq
        m₁' m₂' m₃' tail hm₁' hm₂' hm₃' htail
    SecondReductionTransportIndex tailLen p q →
      FreeGroup (FuchsianGenerator τ) := by
  classical
  dsimp
  let τ :=
    secondReductionTransportSignature (p := p) hq
      m₁' m₂' m₃' tail hm₁' hm₂' hm₃' htail
  intro idx
  exact xWord τ ((Fintype.equivFin (SecondReductionTransportIndex tailLen p q)) idx)
@[local simp]

Canonical transport in the second reduction produces the displayed target word.

theorem secondReduction_forward_finProdFinEquiv_val
    {m n : ℕ} (i : Fin m) (j : Fin n) :
    (finProdFinEquiv (i, j) : Fin (m * n)).val = i.val * n + j.val

The second-reduction comparison is evaluated by the displayed coordinate transformation on the ordered finite index set.

Show proof
theorem secondReductionTransportIndexEquivCanonicalOrderedTargetFin_distinguished
    (tailLen p q : ℕ) (d : Fin 2) :
    secondReductionTransportIndexEquivCanonicalOrderedTargetFin tailLen p q
        (secondReductionCanonicalTransportDistinguishedIndex tailLen p q d) =
      secondReductionCanonicalOrderedTargetDistinguishedIndex tailLen p q d

The reindexing equivalence sends the distinguished component to the distinguished canonical index.

Show proof
theorem
    secondReductionCanonicalOrderedTargetBlockIndexEquivFin_middleRest_val
    (tailLen p : ℕ) (r : Fin (p - 2)) :
    ((secondReductionCanonicalOrderedTargetBlockIndexEquivFin tailLen p) (Sum.inl r)).val =
      r.val

The auxiliary Fenchel--Nielsen--Zomorrodian presentation relation is verified after imposing the period, Schreier, and product relators.

Show proof
theorem
    secondReductionCanonicalOrderedTargetBlockIndexEquivFin_tail_val
    (tailLen p : ℕ) (b : Fin p) (j : Fin tailLen) :
    ((secondReductionCanonicalOrderedTargetBlockIndexEquivFin tailLen p)
        (Sum.inr (Sum.inl (b, j)))).val =
      (p - 2) + b.val * tailLen + j.val

The auxiliary Fenchel--Nielsen--Zomorrodian presentation relation is verified after imposing the period, Schreier, and product relators.

Show proof
theorem
    secondReductionCanonicalOrderedTargetBlockIndexEquivFin_head_val
    (tailLen p : ℕ) (h : Fin 2) :
    ((secondReductionCanonicalOrderedTargetBlockIndexEquivFin tailLen p)
        (Sum.inr (Sum.inr h))).val =
      (p - 2) + p * tailLen + h.val

The auxiliary Fenchel--Nielsen--Zomorrodian presentation relation is verified after imposing the period, Schreier, and product relators.

Show proof
theorem secondReductionTransportIndexEquivCanonicalOrderedTargetFin_head
    (tailLen p q : ℕ) (h : Fin 2) (k : Fin q) :
    secondReductionTransportIndexEquivCanonicalOrderedTargetFin tailLen p q
        (secondReductionCanonicalTransportHeadIndex tailLen p q h k) =
      secondReductionCanonicalOrderedTargetHeadIndex tailLen p q h k

The reindexing equivalence sends the head component to the corresponding canonical index.

Show proof
theorem secondReductionTransportIndexEquivCanonicalOrderedTargetFin_middleRest
    (tailLen p q : ℕ) (r : Fin (p - 2)) (k : Fin q) :
    secondReductionTransportIndexEquivCanonicalOrderedTargetFin tailLen p q
        (secondReductionCanonicalTransportMiddleRestIndex tailLen p q r k) =
      secondReductionCanonicalOrderedTargetMiddleRestIndex tailLen p q r k

The reindexing equivalence sends a middle component to the corresponding canonical index.

Show proof
theorem secondReductionTransportIndexEquivCanonicalOrderedTargetFin_tail
    (tailLen p q : ℕ) (b : Fin p) (j : Fin tailLen) (k : Fin q) :
    secondReductionTransportIndexEquivCanonicalOrderedTargetFin tailLen p q
        (secondReductionCanonicalTransportTailIndex tailLen p q b j k) =
      secondReductionCanonicalOrderedTargetTailIndex tailLen p q b j k

The reindexing equivalence sends a tail component to the corresponding canonical index.

Show proof
private theorem secondReductionCanonicalOrderedTarget_period_transportIndex
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (idx : SecondReductionTransportIndex tailLen p q) :
    (secondReductionCanonicalOrderedTargetSignature
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail).periods
        (secondReductionTransportIndexEquivCanonicalOrderedTargetFin tailLen p q idx) =
      secondReductionTransportPeriods (p := p) (q := q) m₁' m₂' m₃' tail idx

The ordered target period at a transported index agrees with the corresponding canonical target period.

Show proof
theorem secondReductionCanonicalOrderedTarget_mulEquiv_transportSignature_exists
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    Nonempty
      (FuchsianPresentedGroup
          (secondReductionCanonicalOrderedTargetSignature
            m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail)
        ≃*
        FuchsianPresentedGroup
          (secondReductionTransportSignature (p := p) hq
            m₁' m₂' m₃' tail hm₁' hm₂' hm₃' htail))

There is a multiplicative equivalence between the second-reduction canonical ordered target signature and the transported signature.

Show proof
noncomputable def secondReductionCanonicalTransportFinEquivOrderedTargetFin
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    Fin
        (secondReductionTransportSignature (p := p) hq
          m₁' m₂' m₃' tail hm₁' hm₂' hm₃' htail).numPeriods ≃
      Fin
        (secondReductionCanonicalOrderedTargetSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail).numPeriods := by
  let τ :=
    secondReductionTransportSignature (p := p) hq
      m₁' m₂' m₃' tail hm₁' hm₂' hm₃' htail
  let υ :=
    secondReductionCanonicalOrderedTargetSignature
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  have hτ :
      τ.numPeriods = Fintype.card (SecondReductionTransportIndex tailLen p q) := by
    simp only [secondReductionTransportSignature, familyFuchsianSignature, Fintype.card_sigma, Fintype.card_fin,
  Fintype.sum_sum_type, Fin.sum_univ_two, Fin.isValue, τ]
  have hυ :
      υ.numPeriods = secondReductionCanonicalOrderedTargetNumPeriods tailLen p q := by
    simp only [secondReductionCanonicalOrderedTargetSignature, υ]
  exact
    (finCongr hτ).trans
      ((Fintype.equivFin (SecondReductionTransportIndex tailLen p q)).symm.trans
        ((secondReductionTransportIndexEquivCanonicalOrderedTargetFin tailLen p q).trans
          (finCongr hυ.symm)))

The finite-index equivalence compares the canonical transport indexing with the ordered target indexing.

theorem secondReductionCanonicalTransportFinEquivOrderedTargetFin_apply
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (idx : SecondReductionTransportIndex tailLen p q) :
    secondReductionCanonicalTransportFinEquivOrderedTargetFin
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
        ((Fintype.equivFin (SecondReductionTransportIndex tailLen p q)) idx) =
      secondReductionTransportIndexEquivCanonicalOrderedTargetFin tailLen p q idx

The second-reduction comparison is evaluated by the displayed coordinate transformation on the ordered finite index set.

Show proof
noncomputable def secondReductionCanonicalTransportGeneratorEquivOrderedTarget
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    FuchsianGenerator
        (secondReductionTransportSignature (p := p) hq
          m₁' m₂' m₃' tail hm₁' hm₂' hm₃' htail) ≃
      FuchsianGenerator
        (secondReductionCanonicalOrderedTargetSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail) where
  toFun
    | .elliptic i =>
        .elliptic
          (secondReductionCanonicalTransportFinEquivOrderedTargetFin
            m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail i)
    | .surfaceA j =>
        Fin.elim0 (by
          simpa [secondReductionTransportSignature, familyFuchsianSignature] using j)
    | .surfaceB j =>
        Fin.elim0 (by
          simpa [secondReductionTransportSignature, familyFuchsianSignature] using j)
  invFun
    | .elliptic i =>
        .elliptic
          ((secondReductionCanonicalTransportFinEquivOrderedTargetFin
            m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail).symm i)
    | .surfaceA j =>
        Fin.elim0 (by
          simpa [secondReductionCanonicalOrderedTargetSignature] using j)
    | .surfaceB j =>
        Fin.elim0 (by
          simpa [secondReductionCanonicalOrderedTargetSignature] using j)
  left_inv := by
    intro x
    cases x with
    | elliptic i =>
        simp only
        congr
        exact Equiv.symm_apply_apply
          (secondReductionCanonicalTransportFinEquivOrderedTargetFin
            m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail) i
    | surfaceA j =>
        exact Fin.elim0 (by
          simpa [secondReductionTransportSignature, familyFuchsianSignature] using j)
    | surfaceB j =>
        exact Fin.elim0 (by
          simpa [secondReductionTransportSignature, familyFuchsianSignature] using j)
  right_inv := by
    intro x
    cases x with
    | elliptic i =>
        simp only
        congr
        exact Equiv.apply_symm_apply
          (secondReductionCanonicalTransportFinEquivOrderedTargetFin
            m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail) i
    | surfaceA j =>
        exact Fin.elim0 (by
          simpa [secondReductionCanonicalOrderedTargetSignature] using j)
    | surfaceB j =>
        exact Fin.elim0 (by
          simpa [secondReductionCanonicalOrderedTargetSignature] using j)

The Fenchel--Nielsen--Zomorrodian generator equivalence has the displayed inverse and component values.

theorem secondReductionCanonicalTransportOrdered_period
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (i : Fin
      (secondReductionTransportSignature (p := p) hq
        m₁' m₂' m₃' tail hm₁' hm₂' hm₃' htail).numPeriods) :
    let τ

Canonical transport preserves the ordered target period function.

Show proof
theorem secondReductionCanonicalTransportOrdered_xWord
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (i : Fin
      (secondReductionTransportSignature (p := p) hq
        m₁' m₂' m₃' tail hm₁' hm₂' hm₃' htail).numPeriods) :
    let τ

Canonical transport sends the ordered target generator word to the corresponding target word.

Show proof
theorem secondReductionCanonicalTransportOrdered_xWord_symm
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (i : Fin
      (secondReductionCanonicalOrderedTargetSignature
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail).numPeriods) :
    let τ

The inverse canonical transport sends the target word back to the ordered target generator word.

Show proof
noncomputable def secondReductionCanonicalFirstPowerKernel
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
    let φ :=
      secondReductionCanonicalSourceFreeQuotientHom
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    φ.ker := by
  classical
  dsimp
  letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
  let σ :=
    secondReductionCanonicalSourceSignature
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let φ :=
    secondReductionCanonicalSourceFreeQuotientHom
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let x : FuchsianGenerator σ :=
    secondReductionCanonicalDistinguishedGenerator
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  refine ⟨(FreeGroup.of x) ^ q, ?_⟩
  rw [MonoidHom.mem_ker, map_pow]
  have hx : φ (FreeGroup.of x) = Multiplicative.ofAdd (1 : ZMod q) := by
    simp only [Lean.Elab.WF.paramLet, secondReductionCanonicalDistinguishedGenerator,
  secondReductionCanonicalSourceFreeQuotientHom_firstDistinguished m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail, φ, x]
  rw [hx]
  apply (Multiplicative.toAdd : Multiplicative (ZMod q) ≃ ZMod q).injective
  simp only [toAdd_pow, toAdd_ofAdd, nsmul_eq_mul, CharP.cast_eq_zero, mul_one, toAdd_one]

The canonical first-power kernel element in the second-reduction Schreier presentation.

theorem secondReductionCanonicalFirstPowerKernel_coe
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q

The first-power kernel element has the displayed representative in the canonical second-reduction quotient.

Show proof
private theorem secondReductionCanonical_distinguished_schreierGenerator_eq_one_of_succ_lt
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    {k : ℕ} (hk : k + 1 < q) :
    letI : NeZero q

The second-reduction Schreier word or generator is evaluated by the chosen transversal and equals the prescribed target word.

Show proof
private theorem secondReductionCanonical_distinguished_schreierGenerator_wrap_eq
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q

The second-reduction Schreier word or generator is evaluated by the chosen transversal and equals the prescribed target word.

Show proof
theorem secondReductionCanonicalFirstPowerKernel_mem_schreierGeneratorSet
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q

The first-power kernel element belongs to the canonical second-reduction Schreier generator set.

Show proof
noncomputable def secondReductionCanonicalZeroImageKernelElement
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (y :
      FuchsianGenerator
        (secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail))
    (hy :
      secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
          (FreeGroup.of y) = 1)
    (k : Fin q) :
    letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
    let φ :=
      secondReductionCanonicalSourceFreeQuotientHom
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    φ.ker := by
  classical
  dsimp
  letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
  let σ :=
    secondReductionCanonicalSourceSignature
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let φ :=
    secondReductionCanonicalSourceFreeQuotientHom
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let x : FuchsianGenerator σ :=
    secondReductionCanonicalDistinguishedGenerator
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  refine
    ⟨(FreeGroup.of x) ^ k.val * FreeGroup.of y *
        ((FreeGroup.of x) ^ k.val)⁻¹, ?_⟩
  have hx : φ (FreeGroup.of x) = Multiplicative.ofAdd (1 : ZMod q) := by
    simp only [Lean.Elab.WF.paramLet, secondReductionCanonicalDistinguishedGenerator,
  secondReductionCanonicalSourceFreeQuotientHom_firstDistinguished m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail, φ, x]
  rw [MonoidHom.mem_ker]
  simp only [map_mul, map_pow, hy, mul_one, map_inv, mul_inv_cancel]

The canonical zero-image kernel element in the second-reduction Schreier presentation.

private theorem secondReductionCanonicalZeroImageKernelElement_coe
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (y :
      FuchsianGenerator
        (secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail))
    (hy :
      secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
          (FreeGroup.of y) = 1)
    (k : Fin q) :
    letI : NeZero q

The zero-image kernel element has the displayed representative in the canonical second-reduction quotient.

Show proof
noncomputable def secondReductionCanonicalHeadZeroKernelElement
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (k : Fin q) :
    letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
    let φ :=
      secondReductionCanonicalSourceFreeQuotientHom
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    φ.ker := by
  classical
  dsimp
  letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
  let σ :=
    secondReductionCanonicalSourceSignature
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let φ :=
    secondReductionCanonicalSourceFreeQuotientHom
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let y : FuchsianGenerator σ :=
    FuchsianGenerator.elliptic
      (secondReductionCanonicalSourceZeroIndex
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail)
  have hy : φ (FreeGroup.of y) = 1 := by
    simp only [Lean.Elab.WF.paramLet, secondReductionCanonicalSourceFreeQuotientHom, id_eq,
  secondReductionCanonicalSourceZeroIndex, FreeGroup.lift_apply_of, ellipticQuotientGeneratorImage,
  secondReductionCanonicalSourceQuotientImage, OfNat.zero_ne_ofNat, ↓reduceIte, φ, y]
  exact
    secondReductionCanonicalZeroImageKernelElement
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail y hy k

The canonical head-zero kernel element in the second-reduction Schreier presentation.

noncomputable def secondReductionCanonicalHeadOneKernelElement
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (k : Fin q) :
    letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
    let φ :=
      secondReductionCanonicalSourceFreeQuotientHom
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    φ.ker := by
  classical
  dsimp
  letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
  let σ :=
    secondReductionCanonicalSourceSignature
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let φ :=
    secondReductionCanonicalSourceFreeQuotientHom
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let y : FuchsianGenerator σ :=
    FuchsianGenerator.elliptic
      (secondReductionCanonicalSourceOneIndex
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail)
  have hy : φ (FreeGroup.of y) = 1 := by
    simp only [Lean.Elab.WF.paramLet, secondReductionCanonicalSourceFreeQuotientHom, id_eq,
  secondReductionCanonicalSourceOneIndex, FreeGroup.lift_apply_of, ellipticQuotientGeneratorImage,
  secondReductionCanonicalSourceQuotientImage, OfNat.one_ne_ofNat, ↓reduceIte, φ, y]
  exact
    secondReductionCanonicalZeroImageKernelElement
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail y hy k

The canonical head-one kernel element in the second-reduction Schreier presentation.

noncomputable def secondReductionCanonicalMiddleRestZeroKernelElement
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (r : Fin (p - 2)) (k : Fin q) :
    letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
    let φ :=
      secondReductionCanonicalSourceFreeQuotientHom
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    φ.ker := by
  classical
  dsimp
  letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
  let σ :=
    secondReductionCanonicalSourceSignature
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let φ :=
    secondReductionCanonicalSourceFreeQuotientHom
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let y : FuchsianGenerator σ :=
    FuchsianGenerator.elliptic
      (secondReductionCanonicalSourceMiddleIndex
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail ⟨2 + r.val, by omega⟩)
  have hy : φ (FreeGroup.of y) = 1 := by
    have hnot3 : ¬ 2 + (2 + r.val) = 3 := by omega
    simp only [Lean.Elab.WF.paramLet, secondReductionCanonicalSourceFreeQuotientHom, id_eq,
  secondReductionCanonicalSourceMiddleIndex, FreeGroup.lift_apply_of, ellipticQuotientGeneratorImage,
  secondReductionCanonicalSourceQuotientImage, Nat.add_eq_left, Nat.add_eq_zero_iff, OfNat.ofNat_ne_zero, false_and,
  ↓reduceIte, hnot3, φ, y]
  exact
    secondReductionCanonicalZeroImageKernelElement
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail y hy k

The canonical middle-rest-zero kernel element in the second-reduction Schreier presentation.

noncomputable def secondReductionCanonicalTailZeroKernelElement
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (b : Fin p) (j : Fin tailLen) (k : Fin q) :
    letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
    let φ :=
      secondReductionCanonicalSourceFreeQuotientHom
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    φ.ker := by
  classical
  dsimp
  letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
  let σ :=
    secondReductionCanonicalSourceSignature
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let φ :=
    secondReductionCanonicalSourceFreeQuotientHom
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let y : FuchsianGenerator σ :=
    FuchsianGenerator.elliptic
      (secondReductionCanonicalSourceTailIndex
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail b j)
  have hy : φ (FreeGroup.of y) = 1 := by
    have hnot2 : ¬ 2 + p + b.val * tailLen + j.val = 2 := by omega
    have hnot3 : ¬ 2 + p + b.val * tailLen + j.val = 3 := by omega
    simp only [Lean.Elab.WF.paramLet, secondReductionCanonicalSourceFreeQuotientHom, id_eq,
  secondReductionCanonicalSourceTailIndex, FreeGroup.lift_apply_of, ellipticQuotientGeneratorImage,
  secondReductionCanonicalSourceQuotientImage, hnot2, ↓reduceIte, hnot3, φ, y]
  exact
      secondReductionCanonicalZeroImageKernelElement
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail y hy k

The canonical tail-zero kernel element in the second-reduction Schreier presentation.

theorem secondReductionCanonicalHeadZeroKernelElement_coe
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (k : Fin q) :
    letI : NeZero q

The head-zero kernel element has the displayed representative in the canonical second-reduction quotient.

Show proof
theorem secondReductionCanonicalHeadOneKernelElement_coe
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (k : Fin q) :
    letI : NeZero q

The head-one kernel element has the displayed representative in the canonical second-reduction quotient.

Show proof
theorem secondReductionCanonicalMiddleRestZeroKernelElement_coe
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (r : Fin (p - 2)) (k : Fin q) :
    letI : NeZero q

The middle-rest-zero kernel element has the displayed representative in the canonical second-reduction quotient.

Show proof
theorem secondReductionCanonicalTailZeroKernelElement_coe
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (b : Fin p) (j : Fin tailLen) (k : Fin q) :
    letI : NeZero q

The tail-zero kernel element has the displayed representative in the canonical second-reduction quotient.

Show proof
theorem secondReductionCanonicalZeroImageKernelElement_inj
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (y :
      FuchsianGenerator
        (secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail))
    (hy :
      secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
          (FreeGroup.of y) = 1)
    {k₁ k₂ : Fin q}
    (hxy :
      secondReductionCanonicalDistinguishedGenerator
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail ≠ y)
    (hEq :
      secondReductionCanonicalZeroImageKernelElement
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail y hy k₁ =
        secondReductionCanonicalZeroImageKernelElement
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail y hy k₂) :
    k₁ = k₂

The injective comparison identifies the zero-image kernel element with its canonical representative.

Show proof
theorem secondReductionCanonicalZeroImageKernelElement_ne_firstPower
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (y :
      FuchsianGenerator
        (secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail))
    (hy :
      secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
          (FreeGroup.of y) = 1)
    (k : Fin q)
    (hxy :
      secondReductionCanonicalDistinguishedGenerator
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail ≠ y) :
    secondReductionCanonicalZeroImageKernelElement
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail y hy k ≠
      secondReductionCanonicalFirstPowerKernel
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail

The zero-image kernel element is distinct from the indicated canonical generator or kernel element.

Show proof
private theorem secondReductionCanonical_zeroImage_schreierGenerator_eq
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (y :
      FuchsianGenerator
        (secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail))
    (hy :
      secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
          (FreeGroup.of y) = 1)
    (k : Fin q) :
    letI : NeZero q

The second-reduction Schreier word or generator is evaluated by the chosen transversal and equals the prescribed target word.

Show proof
theorem secondReductionCanonicalZeroImageKernelElement_mem_schreierGeneratorSet
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (y :
      FuchsianGenerator
        (secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail))
    (hy :
      secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
          (FreeGroup.of y) = 1)
    (k : Fin q)
    (hxy :
      secondReductionCanonicalDistinguishedGenerator
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail ≠ y) :
    letI : NeZero q

The zero-image kernel element belongs to the canonical second-reduction Schreier generator set.

Show proof
theorem secondReductionCanonicalHeadZeroKernelElement_mem_schreierGeneratorSet
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (k : Fin q) :
    letI : NeZero q

The head-zero kernel element belongs to the canonical second-reduction Schreier generator set.

Show proof
theorem secondReductionCanonicalHeadOneKernelElement_mem_schreierGeneratorSet
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (k : Fin q) :
    letI : NeZero q

The head-one kernel element belongs to the canonical second-reduction Schreier generator set.

Show proof
theorem secondReductionCanonicalMiddleZeroKernelElement_mem_schreierGeneratorSet
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (r : Fin (p - 2)) (k : Fin q) :
    letI : NeZero q

The middle-zero kernel element belongs to the canonical second-reduction Schreier generator set.

Show proof
theorem secondReductionCanonicalTailZeroKernelElement_mem_schreierGeneratorSet
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) (b : Fin p) (j : Fin tailLen) (k : Fin q) :
    letI : NeZero q

The tail-zero kernel element belongs to the canonical second-reduction Schreier generator set.

Show proof
noncomputable def secondReductionCanonicalSecondPowerKernel
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
    let φ :=
      secondReductionCanonicalSourceFreeQuotientHom
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    φ.ker := by
  classical
  dsimp
  letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
  let σ :=
    secondReductionCanonicalSourceSignature
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let φ :=
    secondReductionCanonicalSourceFreeQuotientHom
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let y : FuchsianGenerator σ :=
    FuchsianGenerator.elliptic
      (secondReductionCanonicalSourceMiddleIndex
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail ⟨1, by omega⟩)
  refine ⟨(FreeGroup.of y) ^ q, ?_⟩
  rw [MonoidHom.mem_ker, map_pow]
  have hy : φ (FreeGroup.of y) = Multiplicative.ofAdd (-1 : ZMod q) := by
    simp only [Lean.Elab.WF.paramLet, secondReductionCanonicalSourceFreeQuotientHom, id_eq,
  secondReductionCanonicalSourceMiddleIndex, Nat.reduceAdd, FreeGroup.lift_apply_of, ellipticQuotientGeneratorImage,
  secondReductionCanonicalSourceQuotientImage, Nat.succ_ne_self, ↓reduceIte, ofAdd_neg, φ, y]
  rw [hy]
  apply (Multiplicative.toAdd : Multiplicative (ZMod q) ≃ ZMod q).injective
  simp only [ofAdd_neg, inv_pow, toAdd_inv, toAdd_pow, toAdd_ofAdd, nsmul_eq_mul, CharP.cast_eq_zero, mul_one,
  neg_zero, toAdd_one]

The canonical second-power kernel element in the second-reduction Schreier presentation.

theorem secondReductionCanonicalSecondPowerKernel_coe
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q

The second-power kernel element has the displayed representative in the canonical second-reduction quotient.

Show proof
noncomputable def secondReductionCanonicalSecondEdgeKernelElement
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (k : Fin q) :
    letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
    let φ :=
      secondReductionCanonicalSourceFreeQuotientHom
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
    φ.ker := by
  classical
  dsimp
  letI : NeZero q := ⟨Nat.ne_of_gt (lt_of_lt_of_le (by decide : 0 < 2) hq)⟩
  let σ :=
    secondReductionCanonicalSourceSignature
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let φ :=
    secondReductionCanonicalSourceFreeQuotientHom
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let x : FuchsianGenerator σ :=
    secondReductionCanonicalDistinguishedGenerator
      m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
  let y : FuchsianGenerator σ :=
    FuchsianGenerator.elliptic
      (secondReductionCanonicalSourceMiddleIndex
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail ⟨1, by omega⟩)
  let r : ℕ := ((k.val : ZMod q) - 1).val
  refine ⟨(FreeGroup.of x) ^ k.val * FreeGroup.of y * ((FreeGroup.of x) ^ r)⁻¹, ?_⟩
  have hx : φ (FreeGroup.of x) = Multiplicative.ofAdd (1 : ZMod q) := by
    simp only [Lean.Elab.WF.paramLet, secondReductionCanonicalDistinguishedGenerator,
  secondReductionCanonicalSourceFreeQuotientHom_firstDistinguished m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail, φ, x]
  have hy : φ (FreeGroup.of y) = Multiplicative.ofAdd (-1 : ZMod q) := by
    simp only [Lean.Elab.WF.paramLet, secondReductionCanonicalSourceFreeQuotientHom, id_eq,
  secondReductionCanonicalSourceMiddleIndex, Nat.reduceAdd, FreeGroup.lift_apply_of, ellipticQuotientGeneratorImage,
  secondReductionCanonicalSourceQuotientImage, Nat.succ_ne_self, ↓reduceIte, ofAdd_neg, φ, y]
  rw [MonoidHom.mem_ker]
  rw [map_mul, map_inv, map_mul, map_pow, map_pow, hx, hy]
  apply (Multiplicative.toAdd : Multiplicative (ZMod q) ≃ ZMod q).injective
  simp only [ofAdd_neg, toAdd_mul, toAdd_pow, toAdd_ofAdd, nsmul_eq_mul, mul_one, toAdd_inv, ZMod.natCast_val,
  dvd_refl, ZMod.cast_sub, ZMod.cast_natCast, ZMod.cast_one, neg_sub, toAdd_one, r]
  ring

The canonical second-edge kernel element in the second-reduction Schreier presentation.

theorem secondReductionCanonicalSecondEdgeKernelElement_zero_coe
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q

The second-edge kernel element has the displayed representative in the canonical second-reduction quotient.

Show proof
private theorem secondReductionCanonicalSecondEdgeKernelElement_descending_coe
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (i : Fin (q - 1)) :
    letI : NeZero q

The second-edge kernel element has the displayed representative in the canonical second-reduction quotient.

Show proof
theorem secondReductionCanonicalSecondEdgeKernelElement_succ_coe
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (i : Fin (q - 1)) :
    letI : NeZero q

The second-edge kernel element has the displayed representative in the canonical second-reduction quotient.

Show proof
private theorem secondReductionCanonical_second_schreierGenerator_eq
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (k : Fin q) :
    letI : NeZero q

The second-reduction Schreier word or generator is evaluated by the chosen transversal and equals the prescribed target word.

Show proof
theorem secondReductionCanonicalSecondEdgeKernelElement_mem_schreierGeneratorSet
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (k : Fin q) :
    letI : NeZero q

The second-edge kernel element belongs to the canonical second-reduction Schreier generator set.

Show proof
theorem secondReductionCanonicalSecondEdgeKernelElement_inj
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    {k₁ k₂ : Fin q}
    (hEq :
      secondReductionCanonicalSecondEdgeKernelElement
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail k₁ =
        secondReductionCanonicalSecondEdgeKernelElement
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail k₂) :
    k₁ = k₂

The injective comparison identifies the second-edge kernel element with its canonical representative.

Show proof
theorem secondReductionCanonicalZeroImageKernelElement_ne_secondEdge
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (y :
      FuchsianGenerator
        (secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail))
    (hy :
      secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
          (FreeGroup.of y) = 1)
    (k k' : Fin q)
    (hxy :
      secondReductionCanonicalDistinguishedGenerator
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail ≠ y)
    (hyne :
      y ≠ FuchsianGenerator.elliptic
        (secondReductionCanonicalSourceMiddleIndex
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail ⟨1, by omega⟩)) :
    secondReductionCanonicalZeroImageKernelElement
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail y hy k ≠
      secondReductionCanonicalSecondEdgeKernelElement
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail k'

The zero-image kernel element is distinct from the indicated canonical generator or kernel element.

Show proof
theorem secondReductionCanonicalZeroImageKernelElement_ne_of_generator_ne
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (y y' :
      FuchsianGenerator
        (secondReductionCanonicalSourceSignature
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail))
    (hy :
      secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
          (FreeGroup.of y) = 1)
    (hy' :
      secondReductionCanonicalSourceFreeQuotientHom
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail
          (FreeGroup.of y') = 1)
    (k k' : Fin q)
    (hxy :
      secondReductionCanonicalDistinguishedGenerator
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail ≠ y)
    (hyne : y' ≠ y) :
    secondReductionCanonicalZeroImageKernelElement
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail y hy k ≠
      secondReductionCanonicalZeroImageKernelElement
        m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail y' hy' k'

The zero-image kernel element is distinct from the indicated canonical generator or kernel element.

Show proof
theorem secondReductionCanonicalMiddleRestZeroKernelElement_inj
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    {r₁ r₂ : Fin (p - 2)} {k₁ k₂ : Fin q}
    (hEq :
      secondReductionCanonicalMiddleRestZeroKernelElement
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail r₁ k₁ =
        secondReductionCanonicalMiddleRestZeroKernelElement
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail r₂ k₂) :
    r₁ = r₂ ∧ k₁ = k₂

The injective comparison identifies the middle-rest-zero kernel element with its canonical representative.

Show proof
theorem secondReductionCanonicalTailZeroKernelElement_inj
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    {b₁ b₂ : Fin p} {j₁ j₂ : Fin tailLen} {k₁ k₂ : Fin q}
    (hEq :
      secondReductionCanonicalTailZeroKernelElement
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail b₁ j₁ k₁ =
        secondReductionCanonicalTailZeroKernelElement
          m₁' m₂' m₃' tail hp hq hm₁' hm₂' hm₃' htail b₂ j₂ k₂) :
    b₁ = b₂ ∧ j₁ = j₂ ∧ k₁ = k₂

The injective comparison identifies the tail-zero kernel element with its canonical representative.

Show proof
theorem secondReductionCanonicalSecondDescendingCycle_eq_secondPowerKernel
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q

The second descending cycle is the canonical second-power kernel element in the second-reduction Schreier presentation.

Show proof
theorem secondReductionCanonicalSecondDescendingCycle_schreierWord_eq_secondPower
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q

The second-reduction Schreier word or generator is evaluated by the chosen transversal and equals the prescribed target word.

Show proof
theorem secondReductionCanonicalSecondShiftedCycle_eq_conjugate_secondPower
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j)
    (k : Fin q) :
    letI : NeZero q

The second-reduction second shifted cycle equals the conjugate second-power expression.

Show proof
theorem secondReductionCanonical_schreierGeneratorSet_cases
    {tailLen p q : ℕ}
    (m₁' m₂' m₃' : ℕ) (tail : Fin tailLen → ℕ)
    (hp : 2 ≤ p) (hq : 2 ≤ q)
    (hm₁' : 2 ≤ m₁') (hm₂' : 2 ≤ m₂') (hm₃' : 2 ≤ m₃')
    (htail : ∀ j, 2 ≤ tail j) :
    letI : NeZero q

Case split for the second-reduction canonical Schreier generator set.

Show proof