AFTD Auto-Formalizing Theoretical Domains

quaternion_odd_has_no_complete_mapping

theoremverifiedformalization

For every natural number n, the generalized quaternion group QuaternionGroup (2 * n + 1) has no complete mapping.

Statement

theorem quaternion_odd_has_no_complete_mapping (n : ℕ) :
    ¬ ∃ θ : QuaternionGroup (2 * n + 1) → QuaternionGroup (2 * n + 1),
      group_is_complete_mapping θ
Formalizes
arXiv:2611.13274 Cor. 3.21
Verified
13 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • group_is_complete_mappingA complete mapping of a group G is a permutation θ of G such that x ↦ xθ(x) is also a permutation of G.
  • g$g(S,M) = \dim_{\mathbb{F}_p}(S^{\perp}_M) - \dim_{\mathbb{F}_p}(S_M)$.
  • VThe ambient space $V = \mathbb{F}_p^n \times \mathbb{F}_p^n$ of pairs of coordinate vectors.
Used by 1

Read back from the Lean

For every natural number $n$, there does not exist a function $\theta$ from the quaternion group $\text{QuaternionGroup}(2n + 1)$ to itself such that $\theta$ is a complete mapping (as defined by group_is_complete_mapping).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

If a finite group G has a complete mapping θ, then for any homomorphism φ into an abelian group, the product of φ(g) over all elements g ∈ G must be 1, because reindexing by the bijections θ and g ↦ g * θ(g) forces the product to equal its own square. For the generalized quaternion group QuaternionGroup (2 * n + 1), one constructs an explicit homomorphism φ into the multiplicative group of ZMod 4 sending a^i to 2*i and x * a^i to 1 + 2*i. Summing the additive values over all 4 * (2 * n + 1) elements yields 2 in ZMod 4, which implies the product is non-trivial, contradicting the existence of any complete mapping.

  1. If a finite group G admits a complete mapping θ, then for any homomorphism φ from G to a commutative group A, the product of φ(g) over all g ∈ G equals 1.

    Because θ is bijective and g ↦ g * θ(g) is bijective, reindexing the product gives ∏ φ(θ(g)) = ∏ φ(g) and ∏ φ(g * θ(g)) = ∏ φ(g). Since φ is a homomorphism and A is commutative, ∏ φ(g * θ(g)) = (∏ φ(g)) * (∏ φ(θ(g))) = (∏ φ(g))^2. Multiplying both sides by the inverse of ∏ φ(g) shows that ∏ φ(g) = 1.

    lines 1–16

    uses Fintype.prod_bijective, map_mul, Finset.prod_mul_distrib, congr_arg, mul_assoc

    private lemma quaternion_odd_has_no_complete_mapping_prod_eq_one
        {G A : Type*} [Group G] [Fintype G] [CommGroup A]
        (θ : G → G) (hθ : group_is_complete_mapping θ) (φ : G →* A) :
        ∏ g, φ g = 1 := by
      obtain ⟨h1, h2⟩ := hθ
      have e1 : ∏ g, φ (θ g) = ∏ g, φ g :=
        Fintype.prod_bijective θ h1 (fun x => φ (θ x)) φ (fun x => rfl)
      have e2 : ∏ g, φ (g * θ g) = ∏ g, φ g :=
        Fintype.prod_bijective (fun g => g * θ g) h2 (fun x => φ (x * θ x)) φ (fun x => rfl)
      have e3 : ∏ g, φ (g * θ g) = (∏ g, φ g) * (∏ g, φ (θ g)) := by
        simp only [map_mul]
        exact Finset.prod_mul_distrib
      rw [e2, e1] at e3
      have := congr_arg (· * (∏ g, φ g)⁻¹) e3
      simpa [mul_assoc] using this.symm
    
  2. For any finite set s and any function f into Multiplicative (ZMod 4), the additive translation of the product of f over s equals the sum of the additive translations of f over s.

    By induction on the finite set s. The empty set gives 0 = 0. For the inductive step, inserting an element splits both the product and the sum into the new element's contribution and the rest, which are equal by the induction hypothesis.

    lines 17–26

    uses Finset.induction_on, Finset.prod_insert, Finset.sum_insert

    private lemma quaternion_odd_has_no_complete_mapping_toAdd_prod {ι : Type*} [DecidableEq ι]
        (s : Finset ι) (f : ι → Multiplicative (ZMod 4)) :
        (s.prod f).toAdd = s.sum (fun i => (f i).toAdd) := by
      induction s using Finset.induction_on with
      | empty => rfl
      | insert a s ha ih =>
        rw [Finset.prod_insert ha, Finset.sum_insert ha]
        show (f a).toAdd + (s.prod f).toAdd = (f a).toAdd + ∑ i ∈ s, (f i).toAdd
        rw [ih]
    
  3. The generalized quaternion group QuaternionGroup m is in bijection with the disjoint union ZMod (2*m) ⊕ ZMod (2*m).

    Elements of QuaternionGroup m are uniquely represented as either a^i or x * a^i for i ∈ ZMod (2*m), which correspond bijectively to the left and right summands of ZMod (2*m) ⊕ ZMod (2*m).

    lines 27–37

    private def quaternion_odd_has_no_complete_mapping_equiv (m : ℕ) :
        QuaternionGroup m ≃ ZMod (2*m) ⊕ ZMod (2*m) where
      toFun
        | .a i => Sum.inl i
        | .xa i => Sum.inr i
      invFun
        | Sum.inl i => .a i
        | Sum.inr i => .xa i
      left_inv := by rintro (i | i) <;> rfl
      right_inv := by rintro (i | i) <;> rfl
    
  4. Multiplication by 2 induces a well-defined additive homomorphism from ZMod (2*(2*n+1)) to ZMod 4.

    Lifting the integer homomorphism x ↦ 2*x modulo 4 to ZMod (2*(2*n+1)) requires checking that the modulus 2*(2*n+1) maps to 0. Its image is 2 * 2*(2*n+1) = 4*(2*n+1), which is a multiple of 4 and therefore zero in ZMod 4.

    lines 38–50

    uses AddMonoidHom.smul_apply, Int.cast_natCast, nsmul_eq_mul, ZMod.natCast_self

    noncomputable def quaternion_odd_has_no_complete_mapping_mulTwo (n : ℕ) :
        ZMod (2*(2*n+1)) →+ ZMod 4 :=
      ZMod.lift (2*(2*n+1)) ⟨(2:ℕ) • Int.castAddHom (ZMod 4), by
        rw [AddMonoidHom.smul_apply]
        change (2:ℕ) • ((((2*(2*n+1) : ℕ)) : ℤ) : ZMod 4) = 0
        rw [Int.cast_natCast]
        push_cast
        rw [nsmul_eq_mul]
        rw [show ((2:ℕ):ZMod 4) = (2:ZMod 4) from by norm_num]
        rw [show (2:ZMod 4) * (2 * (2 * (↑n : ZMod 4) + 1)) = 4 * (2*(↑n : ZMod 4)+1) from by ring]
        rw [show (4:ZMod 4) = 0 from ZMod.natCast_self 4]
        ring⟩
    
  5. The doubling homomorphism evaluates to 2 * i.val on each element i, satisfies mulTwo(i) + mulTwo(i) = 0, and maps the middle index 2*n + 1 to 2 in ZMod 4.

    Writing i as the cast of i.val, the lifted homomorphism evaluates to 2 * i.val. Doubling this gives 4 * i.val = 0 in ZMod 4. Evaluating at 2*n + 1 yields 2*(2*n+1) = 4*n + 2 = 2 in ZMod 4.

    lines 51–86

    uses ZMod.natCast_zmod_val, quaternion_odd_has_no_complete_mapping_mulTwo, ZMod.lift_coe, quaternion_odd_has_no_complete_mapping_mulTwo_apply, ZMod.natCast_self

    private lemma quaternion_odd_has_no_complete_mapping_mulTwo_apply (n : ℕ)
        (i : ZMod (2*(2*n+1))) :
        quaternion_odd_has_no_complete_mapping_mulTwo n i = 2 * ((i.val : ℕ) : ZMod 4) := by
      conv_lhs => rw [← ZMod.natCast_zmod_val i]
      unfold quaternion_odd_has_no_complete_mapping_mulTwo
      rw [← Int.cast_natCast (R := ZMod (2*(2*n+1)))]
      rw [ZMod.lift_coe]
      change (2 : ℕ) • (((i.val : ℤ)) : ZMod 4) = 2 * ((i.val : ℕ) : ZMod 4)
      rw [nsmul_eq_mul]
      push_cast
      ring
    
    private lemma quaternion_odd_has_no_complete_mapping_mulTwo_add_self (n : ℕ)
        (i : ZMod (2*(2*n+1))) :
        quaternion_odd_has_no_complete_mapping_mulTwo n i +
          quaternion_odd_has_no_complete_mapping_mulTwo n i = 0 := by
      rw [show quaternion_odd_has_no_complete_mapping_mulTwo n i = 2 * ((i.val : ℕ) : ZMod 4)
        from quaternion_odd_has_no_complete_mapping_mulTwo_apply n i]
      rw [show (2 * ((i.val : ℕ) : ZMod 4)) + (2 * ((i.val : ℕ) : ZMod 4))
          = 4 * ((i.val : ℕ) : ZMod 4) from by ring]
      rw [show (4:ZMod 4) = 0 from ZMod.natCast_self 4]
      ring
    
    private lemma quaternion_odd_has_no_complete_mapping_mulTwo_m (n : ℕ) :
        quaternion_odd_has_no_complete_mapping_mulTwo n ((2*n+1 : ℕ) : ZMod (2*(2*n+1))) = 2 := by
      rw [show (((2*n+1 : ℕ)) : ZMod (2*(2*n+1))) = (((2*n+1 : ℤ)) : ZMod (2*(2*n+1)))
        from by push_cast; ring]
      unfold quaternion_odd_has_no_complete_mapping_mulTwo
      rw [ZMod.lift_coe]
      change (2:ℕ) • (((2*n+1 : ℤ)) : ZMod 4) = 2
      rw [nsmul_eq_mul]
      push_cast
      rw [show (2:ZMod 4) * (2 * (↑n : ZMod 4) + 1) = 4 * (↑n : ZMod 4) + 2 from by ring]
      rw [show (4:ZMod 4) = 0 from ZMod.natCast_self 4]
      ring
    
  6. The mapping sending a^i to 2*i and x * a^i to 1 + 2*i is a group homomorphism from QuaternionGroup (2*n+1) to Multiplicative (ZMod 4).

    The identity a^0 maps to 2 * 0 = 0, which corresponds to 1 in Multiplicative (ZMod 4). For multiplicativity, we check the four product relations: a^i * a^j = a^(i+j), a^i * (x a^j) = x a^(j-i), (x a^i) * a^j = x a^(i+j), and (x a^i) * (x a^j) = a^((2*n+1) + j - i). In all cases, using -2*i = 2*i in ZMod 4 and mulTwo(2*n+1) = 2, the exponents in ZMod 4 match.

    lines 87–129

    uses map_zero, QuaternionGroup.a_mul_a, QuaternionGroup.a_mul_xa, QuaternionGroup.xa_mul_a, QuaternionGroup.xa_mul_xa, map_add, Multiplicative.ext, map_sub, neg_eq_of_add_eq_zero_right, quaternion_odd_has_no_complete_mapping_mulTwo_add_self, sub_eq_add_neg, quaternion_odd_has_no_complete_mapping_mulTwo_m

    noncomputable def quaternion_odd_has_no_complete_mapping_hom (n : ℕ) :
        QuaternionGroup (2*n+1) →* Multiplicative (ZMod 4) where
      toFun
        | .a i => Multiplicative.ofAdd (quaternion_odd_has_no_complete_mapping_mulTwo n i)
        | .xa i => Multiplicative.ofAdd (1 + quaternion_odd_has_no_complete_mapping_mulTwo n i)
      map_one' := by
        change Multiplicative.ofAdd (quaternion_odd_has_no_complete_mapping_mulTwo n 0) =
          (1 : Multiplicative (ZMod 4))
        rw [map_zero]
        rfl
      map_mul' := by
        rintro (i | i) (j | j) <;>
          simp only [QuaternionGroup.a_mul_a, QuaternionGroup.a_mul_xa,
            QuaternionGroup.xa_mul_a, QuaternionGroup.xa_mul_xa]
        · rw [map_add]
          rfl
        · apply Multiplicative.ext
          change 1 + quaternion_odd_has_no_complete_mapping_mulTwo n (j - i) =
            quaternion_odd_has_no_complete_mapping_mulTwo n i +
              (1 + quaternion_odd_has_no_complete_mapping_mulTwo n j)
          rw [map_sub]
          have hneg : - quaternion_odd_has_no_complete_mapping_mulTwo n i =
              quaternion_odd_has_no_complete_mapping_mulTwo n i :=
            neg_eq_of_add_eq_zero_right (quaternion_odd_has_no_complete_mapping_mulTwo_add_self n i)
          rw [sub_eq_add_neg, hneg]
          ring
        · apply Multiplicative.ext
          change 1 + quaternion_odd_has_no_complete_mapping_mulTwo n (i + j) =
            (1 + quaternion_odd_has_no_complete_mapping_mulTwo n i) +
              quaternion_odd_has_no_complete_mapping_mulTwo n j
          rw [map_add]
          ring
        · apply Multiplicative.ext
          change quaternion_odd_has_no_complete_mapping_mulTwo n ((2*n+1 : ℕ) + j - i) =
            (1 + quaternion_odd_has_no_complete_mapping_mulTwo n i) +
              (1 + quaternion_odd_has_no_complete_mapping_mulTwo n j)
          rw [map_sub, map_add, quaternion_odd_has_no_complete_mapping_mulTwo_m]
          have hneg : - quaternion_odd_has_no_complete_mapping_mulTwo n i =
              quaternion_odd_has_no_complete_mapping_mulTwo n i :=
            neg_eq_of_add_eq_zero_right (quaternion_odd_has_no_complete_mapping_mulTwo_add_self n i)
          rw [sub_eq_add_neg, hneg]
          ring
    
  7. The sum of the additive images of all elements of QuaternionGroup (2*n+1) under the homomorphism equals 2 in ZMod 4.

    Using the bijection with ZMod (2*(2*n+1)) ⊕ ZMod (2*(2*n+1)), the sum splits into elements of the form a^i and x * a^i. The first part sums 2*i to 2*V, where V is the sum of all i.val. The second part sums 1 + 2*i to card(ZMod (2*(2*n+1))) * 1 + 2*V = 2*(2*n+1) + 2*V = 2 + 2*V. The total sum is 2*V + (2 + 2*V) = 4*V + 2 = 2 in ZMod 4.

    lines 130–176

    uses quaternion_odd_has_no_complete_mapping_equiv, Fintype.sum_equiv, Fintype.sum_sum_type, Finset.mul_sum, Finset.sum_congr, Finset.sum_add_distrib, Finset.sum_const, Finset.card_univ, ZMod.card, ZMod.natCast_self, zero_mul

    private lemma quaternion_odd_has_no_complete_mapping_sum (n : ℕ) :
        ∑ g : QuaternionGroup (2*n+1),
          (quaternion_odd_has_no_complete_mapping_hom n g).toAdd = 2 := by
      have heq : (∑ x : ZMod (2*(2*n+1)) ⊕ ZMod (2*(2*n+1)),
          (quaternion_odd_has_no_complete_mapping_hom n
            ((quaternion_odd_has_no_complete_mapping_equiv (2*n+1)).symm x)).toAdd)
          = ∑ g : QuaternionGroup (2*n+1),
              (quaternion_odd_has_no_complete_mapping_hom n g).toAdd :=
        Fintype.sum_equiv (quaternion_odd_has_no_complete_mapping_equiv (2*n+1)).symm _ _
          (fun x => rfl)
      rw [← heq]
      rw [Fintype.sum_sum_type]
      have h1 : ∀ i : ZMod (2*(2*n+1)),
          (quaternion_odd_has_no_complete_mapping_hom n
            ((quaternion_odd_has_no_complete_mapping_equiv (2*n+1)).symm (Sum.inl i))).toAdd
          = quaternion_odd_has_no_complete_mapping_mulTwo n i := fun i => rfl
      have h2 : ∀ i : ZMod (2*(2*n+1)),
          (quaternion_odd_has_no_complete_mapping_hom n
            ((quaternion_odd_has_no_complete_mapping_equiv (2*n+1)).symm (Sum.inr i))).toAdd
          = 1 + quaternion_odd_has_no_complete_mapping_mulTwo n i := fun i => rfl
      simp only [h1, h2]
      have hV : ∑ i : ZMod (2*(2*n+1)), quaternion_odd_has_no_complete_mapping_mulTwo n i
          = 2 * ∑ i : ZMod (2*(2*n+1)), ((i.val : ℕ) : ZMod 4) := by
        rw [Finset.mul_sum]
        exact Finset.sum_congr rfl (fun i _ =>
          quaternion_odd_has_no_complete_mapping_mulTwo_apply n i)
      have hC : ∑ i : ZMod (2*(2*n+1)),
            (1 + quaternion_odd_has_no_complete_mapping_mulTwo n i)
          = ((2*(2*n+1) : ℕ) : ZMod 4) +
            ∑ i : ZMod (2*(2*n+1)), quaternion_odd_has_no_complete_mapping_mulTwo n i := by
        rw [Finset.sum_add_distrib]
        congr 1
        rw [Finset.sum_const, Finset.card_univ, ZMod.card, nsmul_eq_mul, mul_one]
      rw [hC, hV]
      generalize (∑ i : ZMod (2*(2*n+1)), ((i.val : ℕ) : ZMod 4)) = V
      have hc : ((2*(2*n+1) : ℕ) : ZMod 4) = 2 := by
        have h4 : (4 : ZMod 4) = 0 := ZMod.natCast_self 4
        push_cast
        rw [show (2:ZMod 4) * (2 * (↑n : ZMod 4) + 1) = 4 * (↑n : ZMod 4) + 2 from by ring, h4]
        ring
      rw [hc]
      rw [show 2 * V + (2 + 2 * V) = 2 from by
        have h4 : (4 : ZMod 4) = 0 := ZMod.natCast_self 4
        rw [show 2 * V + (2 + 2 * V) = 4 * V + 2 from by ring]
        rw [show (4:ZMod 4) * V = 0 from by rw [h4, zero_mul]]
        ring]
    
  8. QuaternionGroup (2*n + 1) does not admit any complete mapping. automation

    Assume for contradiction that θ is a complete mapping. Then the product of the homomorphism's images over the entire group must equal 1, meaning the sum in ZMod 4 of their additive values must be 0. But this sum was proven to be 2, yielding 2 = 0 in ZMod 4, which is false by computational decision.

    lines 177–189

    uses quaternion_odd_has_no_complete_mapping_prod_eq_one, quaternion_odd_has_no_complete_mapping_hom, quaternion_odd_has_no_complete_mapping_toAdd_prod, quaternion_odd_has_no_complete_mapping_sum

    /-- The generalized quaternion group QuaternionGroup (2 * n + 1) does not admit a complete mapping. -/
    theorem quaternion_odd_has_no_complete_mapping (n : ℕ) :
        ¬ ∃ θ : QuaternionGroup (2 * n + 1) → QuaternionGroup (2 * n + 1),
          group_is_complete_mapping θ := by
      rintro ⟨θ, hθ⟩
      have hprod := quaternion_odd_has_no_complete_mapping_prod_eq_one θ hθ
        (quaternion_odd_has_no_complete_mapping_hom n)
      have hsum : (∏ g, quaternion_odd_has_no_complete_mapping_hom n g).toAdd = 0 := by
        rw [hprod]
        rfl
      rw [quaternion_odd_has_no_complete_mapping_toAdd_prod,
        quaternion_odd_has_no_complete_mapping_sum] at hsum
      exact absurd hsum (by decide)
AddMonoidHom.smul_apply
Scaling an additive monoid homomorphism and applying it to an element is equal to scaling the image of the element.
congr_arg
If two elements are equal, applying any function to both yields equal results.
Finset.card_univ
The cardinality of the universal set of a finite type is the cardinality of the type.
Finset.induction_on
Induction principle for finite sets: a property holds for all finite sets if it holds for the empty set and is preserved when inserting a new element.
Finset.mul_sum
Multiplication distributes over finite sums: a constant times a sum equals the sum of the constant times each term.
Fintype.prod_bijective
Reindexing a product over a finite type using a bijection preserves the value of the product.
Finset.prod_insert
The product of a term over an inserted element and a disjoint set is the value at that element times the product over the set.
Finset.prod_mul_distrib
The product of pointwise products over a finite set equals the product of the first terms times the product of the second terms.
Finset.sum_add_distrib
The sum of pointwise sums over a finite set equals the sum of the first terms plus the sum of the second terms.
Finset.sum_const
The sum of a constant over a finite set is the cardinality of the set scaled by that constant.
Finset.sum_congr
If two functions agree on every element of a finite set, their sums over that set are equal.
Fintype.sum_equiv
Reindexing a sum over a finite type using an equivalence of types preserves the sum.
Finset.sum_insert
The sum of a term over an inserted element and a disjoint set is the value at that element plus the sum over the set.
Fintype.sum_sum_type
The sum over a disjoint union (sum type) equals the sum over the left summand plus the sum over the right summand.
Int.cast_natCast
The cast of a natural number from the integers into an additive group with one equals the direct natural number cast.
map_add
An additive homomorphism preserves addition: f(x + y) = f(x) + f(y).
map_mul
A multiplicative homomorphism preserves multiplication: f(x * y) = f(x) * f(y).
map_sub
An additive group homomorphism preserves subtraction: f(x - y) = f(x) - f(y).
map_zero
An additive monoid homomorphism maps 0 to 0.
mul_assoc
Multiplication in a semigroup is associative: (a * b) * c = a * (b * c).
Multiplicative.ext
Two elements of the multiplicative wrapper of an additive type are equal if their additive counterparts are equal.
neg_eq_of_add_eq_zero_right
If a + b = 0 in a subtraction monoid, then -a = b.
nsmul_eq_mul
Natural number scalar multiplication in a semiring equals multiplication by the natural number cast.
QuaternionGroup.a_mul_a
In the quaternion group, the product of a^i and a^j is a^(i + j).
QuaternionGroup.a_mul_xa
In the quaternion group, the product of a^i and x a^j is x a^(j - i).
QuaternionGroup.xa_mul_a
In the quaternion group, the product of x a^i and a^j is x a^(i + j).
QuaternionGroup.xa_mul_xa
In the quaternion group, the product of x a^i and x a^j is a^(n + j - i).
quaternion_odd_has_no_complete_mapping_equiv
The canonical bijection between QuaternionGroup m and the disjoint union ZMod (2*m) ⊕ ZMod (2*m).
quaternion_odd_has_no_complete_mapping_hom
The homomorphism from QuaternionGroup (2*n + 1) to Multiplicative (ZMod 4) sending a^i to 2*i and x a^i to 1 + 2*i.
quaternion_odd_has_no_complete_mapping_mulTwo
The additive homomorphism from ZMod (2*(2*n+1)) to ZMod 4 given by multiplication by 2.
quaternion_odd_has_no_complete_mapping_mulTwo_apply
Evaluating the doubling homomorphism mulTwo at i gives 2 * i.val in ZMod 4.
quaternion_odd_has_no_complete_mapping_mulTwo_add_self
Doubling the image of any element under mulTwo gives zero in ZMod 4.
quaternion_odd_has_no_complete_mapping_mulTwo_m
Evaluating the doubling homomorphism mulTwo at 2*n + 1 yields 2 in ZMod 4.
quaternion_odd_has_no_complete_mapping_prod_eq_one
If a finite group admits a complete mapping, the product of the images of all group elements under any homomorphism into an abelian group is 1.
quaternion_odd_has_no_complete_mapping_sum
The sum over all elements of QuaternionGroup (2*n + 1) of the additive counterpart of hom(g) equals 2 in ZMod 4.
quaternion_odd_has_no_complete_mapping_toAdd_prod
The additive translation of a finite product in Multiplicative (ZMod 4) equals the sum of the additive translations.
sub_eq_add_neg
Subtraction is equivalent to adding the additive inverse: a - b = a + (-b).
zero_mul
Zero multiplied by any element in a commutative semiring equals zero.
ZMod.card
The cardinality of ZMod n is n.
ZMod.lift_coe
The evaluation of a lifted homomorphism from ZMod n on an integer cast equals the underlying homomorphism evaluated on that integer.
ZMod.natCast_self
In ZMod n, the canonical image of n is 0.
ZMod.natCast_zmod_val
Every element a in ZMod n equals the cast of its representative integer a.val.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

private lemma quaternion_odd_has_no_complete_mapping_prod_eq_one    {G A : Type*} [Group G] [Fintype G] [CommGroup A]    (θ : G → G) (hθ : group_is_complete_mapping θ) (φ : G →* A) :    ∏ g, φ g = 1 := by  obtain ⟨h1, h2⟩ := hθ  have e1 : ∏ g, φ (θ g) = ∏ g, φ g :=    Fintype.prod_bijective θ h1 (fun x => φ (θ x)) φ (fun x => rfl)  have e2 : ∏ g, φ (g * θ g) = ∏ g, φ g :=    Fintype.prod_bijective (fun g => g * θ g) h2 (fun x => φ (x * θ x)) φ (fun x => rfl)  have e3 : ∏ g, φ (g * θ g) = (∏ g, φ g) * (∏ g, φ (θ g)) := by    simp only [map_mul]    exact Finset.prod_mul_distrib  rw [e2, e1] at e3  have := congr_arg (· * (∏ g, φ g)⁻¹) e3  simpa [mul_assoc] using this.symmprivate lemma quaternion_odd_has_no_complete_mapping_toAdd_prod {ι : Type*} [DecidableEq ι]    (s : Finset ι) (f : ι → Multiplicative (ZMod 4)) :    (s.prod f).toAdd = s.sum (fun i => (f i).toAdd) := by  induction s using Finset.induction_on with  | empty => rfl  | insert a s ha ih =>    rw [Finset.prod_insert ha, Finset.sum_insert ha]    show (f a).toAdd + (s.prod f).toAdd = (f a).toAdd + ∑ i ∈ s, (f i).toAdd    rw [ih]private def quaternion_odd_has_no_complete_mapping_equiv (m : ℕ) :    QuaternionGroup m ≃ ZMod (2*m) ⊕ ZMod (2*m) where  toFun    | .a i => Sum.inl i    | .xa i => Sum.inr i  invFun    | Sum.inl i => .a i    | Sum.inr i => .xa i  left_inv := by rintro (i | i) <;> rfl  right_inv := by rintro (i | i) <;> rflnoncomputable def quaternion_odd_has_no_complete_mapping_mulTwo (n : ℕ) :    ZMod (2*(2*n+1)) →+ ZMod 4 :=  ZMod.lift (2*(2*n+1)) ⟨(2:ℕ) • Int.castAddHom (ZMod 4), by    rw [AddMonoidHom.smul_apply]    change (2:ℕ) • ((((2*(2*n+1) : ℕ)) : ℤ) : ZMod 4) = 0    rw [Int.cast_natCast]    push_cast    rw [nsmul_eq_mul]    rw [show ((2:ℕ):ZMod 4) = (2:ZMod 4) from by norm_num]    rw [show (2:ZMod 4) * (2 * (2 * (↑n : ZMod 4) + 1)) = 4 * (2*(↑n : ZMod 4)+1) from by ring]    rw [show (4:ZMod 4) = 0 from ZMod.natCast_self 4]    ring⟩private lemma quaternion_odd_has_no_complete_mapping_mulTwo_apply (n : ℕ)    (i : ZMod (2*(2*n+1))) :    quaternion_odd_has_no_complete_mapping_mulTwo n i = 2 * ((i.val : ℕ) : ZMod 4) := by  conv_lhs => rw [← ZMod.natCast_zmod_val i]  unfold quaternion_odd_has_no_complete_mapping_mulTwo  rw [← Int.cast_natCast (R := ZMod (2*(2*n+1)))]  rw [ZMod.lift_coe]  change (2 : ℕ) • (((i.val : ℤ)) : ZMod 4) = 2 * ((i.val : ℕ) : ZMod 4)  rw [nsmul_eq_mul]  push_cast  ringprivate lemma quaternion_odd_has_no_complete_mapping_mulTwo_add_self (n : ℕ)    (i : ZMod (2*(2*n+1))) :    quaternion_odd_has_no_complete_mapping_mulTwo n i +      quaternion_odd_has_no_complete_mapping_mulTwo n i = 0 := by  rw [show quaternion_odd_has_no_complete_mapping_mulTwo n i = 2 * ((i.val : ℕ) : ZMod 4)    from quaternion_odd_has_no_complete_mapping_mulTwo_apply n i]  rw [show (2 * ((i.val : ℕ) : ZMod 4)) + (2 * ((i.val : ℕ) : ZMod 4))      = 4 * ((i.val : ℕ) : ZMod 4) from by ring]  rw [show (4:ZMod 4) = 0 from ZMod.natCast_self 4]  ringprivate lemma quaternion_odd_has_no_complete_mapping_mulTwo_m (n : ℕ) :    quaternion_odd_has_no_complete_mapping_mulTwo n ((2*n+1 : ℕ) : ZMod (2*(2*n+1))) = 2 := by  rw [show (((2*n+1 : ℕ)) : ZMod (2*(2*n+1))) = (((2*n+1 : ℤ)) : ZMod (2*(2*n+1)))    from by push_cast; ring]  unfold quaternion_odd_has_no_complete_mapping_mulTwo  rw [ZMod.lift_coe]  change (2:ℕ) • (((2*n+1 : ℤ)) : ZMod 4) = 2  rw [nsmul_eq_mul]  push_cast  rw [show (2:ZMod 4) * (2 * (↑n : ZMod 4) + 1) = 4 * (↑n : ZMod 4) + 2 from by ring]  rw [show (4:ZMod 4) = 0 from ZMod.natCast_self 4]  ringnoncomputable def quaternion_odd_has_no_complete_mapping_hom (n : ℕ) :    QuaternionGroup (2*n+1) →* Multiplicative (ZMod 4) where  toFun    | .a i => Multiplicative.ofAdd (quaternion_odd_has_no_complete_mapping_mulTwo n i)    | .xa i => Multiplicative.ofAdd (1 + quaternion_odd_has_no_complete_mapping_mulTwo n i)  map_one' := by    change Multiplicative.ofAdd (quaternion_odd_has_no_complete_mapping_mulTwo n 0) =      (1 : Multiplicative (ZMod 4))    rw [map_zero]    rfl  map_mul' := by    rintro (i | i) (j | j) <;>      simp only [QuaternionGroup.a_mul_a, QuaternionGroup.a_mul_xa,        QuaternionGroup.xa_mul_a, QuaternionGroup.xa_mul_xa]    · rw [map_add]      rfl    · apply Multiplicative.ext      change 1 + quaternion_odd_has_no_complete_mapping_mulTwo n (j - i) =        quaternion_odd_has_no_complete_mapping_mulTwo n i +          (1 + quaternion_odd_has_no_complete_mapping_mulTwo n j)      rw [map_sub]      have hneg : - quaternion_odd_has_no_complete_mapping_mulTwo n i =          quaternion_odd_has_no_complete_mapping_mulTwo n i :=        neg_eq_of_add_eq_zero_right (quaternion_odd_has_no_complete_mapping_mulTwo_add_self n i)      rw [sub_eq_add_neg, hneg]      ring    · apply Multiplicative.ext      change 1 + quaternion_odd_has_no_complete_mapping_mulTwo n (i + j) =        (1 + quaternion_odd_has_no_complete_mapping_mulTwo n i) +          quaternion_odd_has_no_complete_mapping_mulTwo n j      rw [map_add]      ring    · apply Multiplicative.ext      change quaternion_odd_has_no_complete_mapping_mulTwo n ((2*n+1 : ℕ) + j - i) =        (1 + quaternion_odd_has_no_complete_mapping_mulTwo n i) +          (1 + quaternion_odd_has_no_complete_mapping_mulTwo n j)      rw [map_sub, map_add, quaternion_odd_has_no_complete_mapping_mulTwo_m]      have hneg : - quaternion_odd_has_no_complete_mapping_mulTwo n i =          quaternion_odd_has_no_complete_mapping_mulTwo n i :=        neg_eq_of_add_eq_zero_right (quaternion_odd_has_no_complete_mapping_mulTwo_add_self n i)      rw [sub_eq_add_neg, hneg]      ringprivate lemma quaternion_odd_has_no_complete_mapping_sum (n : ℕ) :    ∑ g : QuaternionGroup (2*n+1),      (quaternion_odd_has_no_complete_mapping_hom n g).toAdd = 2 := by  have heq : (∑ x : ZMod (2*(2*n+1)) ⊕ ZMod (2*(2*n+1)),      (quaternion_odd_has_no_complete_mapping_hom n        ((quaternion_odd_has_no_complete_mapping_equiv (2*n+1)).symm x)).toAdd)      = ∑ g : QuaternionGroup (2*n+1),          (quaternion_odd_has_no_complete_mapping_hom n g).toAdd :=    Fintype.sum_equiv (quaternion_odd_has_no_complete_mapping_equiv (2*n+1)).symm _ _      (fun x => rfl)  rw [← heq]  rw [Fintype.sum_sum_type]  have h1 : ∀ i : ZMod (2*(2*n+1)),      (quaternion_odd_has_no_complete_mapping_hom n        ((quaternion_odd_has_no_complete_mapping_equiv (2*n+1)).symm (Sum.inl i))).toAdd      = quaternion_odd_has_no_complete_mapping_mulTwo n i := fun i => rfl  have h2 : ∀ i : ZMod (2*(2*n+1)),      (quaternion_odd_has_no_complete_mapping_hom n        ((quaternion_odd_has_no_complete_mapping_equiv (2*n+1)).symm (Sum.inr i))).toAdd      = 1 + quaternion_odd_has_no_complete_mapping_mulTwo n i := fun i => rfl  simp only [h1, h2]  have hV : ∑ i : ZMod (2*(2*n+1)), quaternion_odd_has_no_complete_mapping_mulTwo n i      = 2 * ∑ i : ZMod (2*(2*n+1)), ((i.val : ℕ) : ZMod 4) := by    rw [Finset.mul_sum]    exact Finset.sum_congr rfl (fun i _ =>      quaternion_odd_has_no_complete_mapping_mulTwo_apply n i)  have hC : ∑ i : ZMod (2*(2*n+1)),        (1 + quaternion_odd_has_no_complete_mapping_mulTwo n i)      = ((2*(2*n+1) : ℕ) : ZMod 4) +        ∑ i : ZMod (2*(2*n+1)), quaternion_odd_has_no_complete_mapping_mulTwo n i := by    rw [Finset.sum_add_distrib]    congr 1    rw [Finset.sum_const, Finset.card_univ, ZMod.card, nsmul_eq_mul, mul_one]  rw [hC, hV]  generalize (∑ i : ZMod (2*(2*n+1)), ((i.val : ℕ) : ZMod 4)) = V  have hc : ((2*(2*n+1) : ℕ) : ZMod 4) = 2 := by    have h4 : (4 : ZMod 4) = 0 := ZMod.natCast_self 4    push_cast    rw [show (2:ZMod 4) * (2 * (↑n : ZMod 4) + 1) = 4 * (↑n : ZMod 4) + 2 from by ring, h4]    ring  rw [hc]  rw [show 2 * V + (2 + 2 * V) = 2 from by    have h4 : (4 : ZMod 4) = 0 := ZMod.natCast_self 4    rw [show 2 * V + (2 + 2 * V) = 4 * V + 2 from by ring]    rw [show (4:ZMod 4) * V = 0 from by rw [h4, zero_mul]]    ring]/-- The generalized quaternion group QuaternionGroup (2 * n + 1) does not admit a complete mapping. -/theorem quaternion_odd_has_no_complete_mapping (n : ℕ) :    ¬ ∃ θ : QuaternionGroup (2 * n + 1) → QuaternionGroup (2 * n + 1),      group_is_complete_mapping θ := by  rintro ⟨θ, hθ⟩  have hprod := quaternion_odd_has_no_complete_mapping_prod_eq_one θ hθ    (quaternion_odd_has_no_complete_mapping_hom n)  have hsum : (∏ g, quaternion_odd_has_no_complete_mapping_hom n g).toAdd = 0 := by    rw [hprod]    rfl  rw [quaternion_odd_has_no_complete_mapping_toAdd_prod,    quaternion_odd_has_no_complete_mapping_sum] at hsum  exact absurd hsum (by decide)
See it in the graphDiscuss this resultChallenge it