File: Mathlib/GroupTheory/SpecificGroups/Quaternion.lean

full_name: QuaternionGroup
code: /-- The (generalised) quaternion group `QuaternionGroup n` of order `4n`. It can be defined by the
presentation $\langle a, x | a^{2n} = 1, x^2 = a^n, x^{-1}ax=a^{-1}\rangle$. We write `a i` for
$a^i$ and `xa i` for $x * a^i$.
-/
inductive QuaternionGroup (n : ℕ) : Type
  | a : ZMod (2 * n) → QuaternionGroup n
  | xa : ZMod (2 * n) → QuaternionGroup n
  deriving DecidableEq
goal: Type

full_name: QuaternionGroup.xa
code: /-- The (generalised) quaternion group `QuaternionGroup n` of order `4n`. It can be defined by the
presentation $\langle a, x | a^{2n} = 1, x^2 = a^n, x^{-1}ax=a^{-1}\rangle$. We write `a i` for
$a^i$ and `xa i` for $x * a^i$.
-/
inductive QuaternionGroup (n : ℕ) : Type
  | a : ZMod (2 * n) → QuaternionGroup n
  | xa : ZMod (2 * n) → QuaternionGroup n
  deriving DecidableEq
goal: ZMod (2 * n) → QuaternionGroup n

full_name: QuaternionGroup.a
code: /-- The (generalised) quaternion group `QuaternionGroup n` of order `4n`. It can be defined by the
presentation $\langle a, x | a^{2n} = 1, x^2 = a^n, x^{-1}ax=a^{-1}\rangle$. We write `a i` for
$a^i$ and `xa i` for $x * a^i$.
-/
inductive QuaternionGroup (n : ℕ) : Type
  | a : ZMod (2 * n) → QuaternionGroup n
  | xa : ZMod (2 * n) → QuaternionGroup n
  deriving DecidableEq
goal: ZMod (2 * n) → QuaternionGroup n

full_name: _private.Mathlib.GroupTheory.SpecificGroups.Quaternion.0.QuaternionGroup.mul
code: /-- Multiplication of the dihedral group.
-/
private def mul : QuaternionGroup n → QuaternionGroup n → QuaternionGroup n
  
goal: QuaternionGroup n → QuaternionGroup n → QuaternionGroup n

full_name: _private.Mathlib.GroupTheory.SpecificGroups.Quaternion.0.QuaternionGroup.one
code: /-- The identity `1` is given by `aⁱ`.
-/
private def one : QuaternionGroup n 
goal: QuaternionGroup n

full_name: QuaternionGroup.instInhabited
code: instance : Inhabited (QuaternionGroup n) 
goal: Inhabited (QuaternionGroup n)

full_name: _private.Mathlib.GroupTheory.SpecificGroups.Quaternion.0.QuaternionGroup.inv
code: /-- The inverse of an element of the quaternion group.
-/
private def inv : QuaternionGroup n → QuaternionGroup n
  
goal: QuaternionGroup n → QuaternionGroup n

full_name: QuaternionGroup.instGroup
code: /-- The group structure on `QuaternionGroup n`.
-/
instance : Group (QuaternionGroup n) 
goal: Group (QuaternionGroup n)

full_name: QuaternionGroup.a_mul_a
code: @[simp]
theorem a_mul_a (i j : ZMod (2 * n)) : a i * a j = a (i + j) 
goal: QuaternionGroup.a i * QuaternionGroup.a j = QuaternionGroup.a (i + j)

full_name: QuaternionGroup.a_mul_xa
code: @[simp]
theorem a_mul_xa (i j : ZMod (2 * n)) : a i * xa j = xa (j - i) 
goal: QuaternionGroup.a i * QuaternionGroup.xa j = QuaternionGroup.xa (j - i)

full_name: QuaternionGroup.xa_mul_a
code: @[simp]
theorem xa_mul_a (i j : ZMod (2 * n)) : xa i * a j = xa (i + j) 
goal: QuaternionGroup.xa i * QuaternionGroup.a j = QuaternionGroup.xa (i + j)

full_name: QuaternionGroup.xa_mul_xa
code: @[simp]
theorem xa_mul_xa (i j : ZMod (2 * n)) : xa i * xa j = a ((n : ZMod (2 * n)) + j - i) 
goal: QuaternionGroup.xa i * QuaternionGroup.xa j = QuaternionGroup.a (↑n + j - i)

full_name: QuaternionGroup.one_def
code: theorem one_def : (1 : QuaternionGroup n) = a 0 
goal: 1 = QuaternionGroup.a 0

full_name: _private.Mathlib.GroupTheory.SpecificGroups.Quaternion.0.QuaternionGroup.fintypeHelper
code: private def fintypeHelper : ZMod (2 * n) ⊕ ZMod (2 * n) ≃ QuaternionGroup n 
goal: ZMod (2 * n) ⊕ ZMod (2 * n) ≃ QuaternionGroup n

full_name: QuaternionGroup.quaternionGroupZeroEquivDihedralGroupZero
code: /-- The special case that more or less by definition `QuaternionGroup 0` is isomorphic to the
infinite dihedral group. -/
def quaternionGroupZeroEquivDihedralGroupZero : QuaternionGroup 0 ≃* DihedralGroup 0 
goal: QuaternionGroup 0 ≃* DihedralGroup 0

full_name: QuaternionGroup.instFintypeOfNeZeroNat
code: /-- If `0 < n`, then `QuaternionGroup n` is a finite group.
-/
instance [NeZero n] : Fintype (QuaternionGroup n) 
goal: Fintype (QuaternionGroup n)

full_name: QuaternionGroup.instNontrivial
code: instance : Nontrivial (QuaternionGroup n) 
goal: Nontrivial (QuaternionGroup n)

full_name: QuaternionGroup.card
code: /-- If `0 < n`, then `QuaternionGroup n` has `4n` elements.
-/
theorem card [NeZero n] : Fintype.card (QuaternionGroup n) = 4 * n 
goal: Fintype.card (QuaternionGroup n) = 4 * n

full_name: QuaternionGroup.a_one_pow
code: @[simp]
theorem a_one_pow (k : ℕ) : (a 1 : QuaternionGroup n) ^ k = a k 
goal: QuaternionGroup.a 1 ^ k = QuaternionGroup.a ↑k

full_name: QuaternionGroup.a_one_pow_n
code: theorem a_one_pow_n : (a 1 : QuaternionGroup n) ^ (2 * n) = 1 
goal: QuaternionGroup.a 1 ^ (2 * n) = 1

full_name: QuaternionGroup.xa_sq
code: @[simp]
theorem xa_sq (i : ZMod (2 * n)) : xa i ^ 2 = a n 
goal: QuaternionGroup.xa i ^ 2 = QuaternionGroup.a ↑n

full_name: QuaternionGroup.xa_pow_four
code: @[simp]
theorem xa_pow_four (i : ZMod (2 * n)) : xa i ^ 4 = 1 
goal: QuaternionGroup.xa i ^ 4 = 1

full_name: QuaternionGroup.orderOf_xa
code: /-- If `0 < n`, then `xa i` has order 4.
-/
@[simp]
theorem orderOf_xa [NeZero n] (i : ZMod (2 * n)) : orderOf (xa i) = 4 
goal: orderOf (QuaternionGroup.xa i) = 4

full_name: QuaternionGroup.quaternionGroup_one_isCyclic
code: /-- In the special case `n = 1`, `Quaternion 1` is a cyclic group (of order `4`). -/
theorem quaternionGroup_one_isCyclic : IsCyclic (QuaternionGroup 1) 
goal: IsCyclic (QuaternionGroup 1)

full_name: QuaternionGroup.orderOf_a_one
code: /-- If `0 < n`, then `a 1` has order `2 * n`.
-/
@[simp]
theorem orderOf_a_one : orderOf (a 1 : QuaternionGroup n) = 2 * n 
goal: orderOf (QuaternionGroup.a 1) = 2 * n

full_name: QuaternionGroup.orderOf_a
code: /-- If `0 < n`, then `a i` has order `(2 * n) / gcd (2 * n) i`.
-/
theorem orderOf_a [NeZero n] (i : ZMod (2 * n)) :
    orderOf (a i) = 2 * n / Nat.gcd (2 * n) i.val 
goal: orderOf (QuaternionGroup.a i) = 2 * n / (2 * n).gcd i.val

full_name: QuaternionGroup.exponent
code: theorem exponent : Monoid.exponent (QuaternionGroup n) = 2 * lcm n 2 
goal: Monoid.exponent (QuaternionGroup n) = 2 * lcm n 2