/- Copyright 2025 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ import FormalConjecturesUtil

Erdős Problem 707: Embedding Sidon Sets in Perfect Difference Sets

References:

    erdosproblems.com/707

    arxiv/2510.19804 Boris Alexeev and Dustin G. Mixon, Forbidden Sidon subsets of perfect difference sets, featuring a human-assisted proof (2025)

    [Ha47] Marshall Hall, Jr., Cyclic projective planes, Duke Math. J. 14 (1947), 1079–1090.

Let A ⊆ ℕ be a finite Sidon set. Is there some set B with A ⊆ B which is a perfect difference set modulo p^2 + p + 1 for some prime power p?

This problem is related to Erdős Problem 329 about the maximum density of Sidon sets. If this conjecture is true, it would imply that the maximum density of Sidon sets is 1.

open Function Set namespace Erdos707

Erdős Problem 707: It is false that any finite Sidon set can be embedded in a perfect different set modulo some $n$.

As described in [arxiv/2510.19804], a counterexample is provided in [Ha47], see below. The proof of this has been formalized.

This was formalized in Lean by Alexeev using ChatGPT.

@[category research solved, AMS 5 11, formal_proof using lean4 at "https://github.com/plby/lean-proofs/blob/main/src/v4.24.0/ErdosProblems/Erdos707.lean"] theorem declaration uses 'sorry'erdos_707 : ( (A : Set ) (h : A.Finite), IsSidon A ∃ᵉ (B : Set ) (n > 0), A B IsPerfectDifferenceSet B n) False := (∀ (A : Set ), A.Finite IsSidon A B, n > 0, A B IsPerfectDifferenceSet B n) False All goals completed! 🐙

It is false that any finite Sidon set can be embedded in a perfect difference set modulo p^2 + p + 1 for some prime power p.

As described in [arxiv/2510.19804], a counterexample is provided in [Ha47], see below. The proof of this has been formalized.

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'erdos_707.variants.prime_power : ( (A : Set ) (h : A.Finite), IsSidon A (B : Set ) (p : ), IsPrimePow p A B IsPerfectDifferenceSet B (p^2 + p + 1)) False := (∀ (A : Set ), A.Finite IsSidon A B p, IsPrimePow p A B IsPerfectDifferenceSet B (p ^ 2 + p + 1)) False x, x.Finite IsSidon x (x_1 : Set ) (x_2 : ), IsPrimePow x_2 x x_1 ¬IsPerfectDifferenceSet x_1 (x_2 ^ 2 + x_2 + 1) All goals completed! 🐙

It is false that any finite Sidon set can be embedded in a perfect difference set modulo p^2 + p + 1 for some prime p.

As described in [arxiv/2510.19804], a counterexample is provided in [Ha47], see below. The proof of this has been formalized.

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'erdos_707.variants.prime : ( (A : Set ) (h : A.Finite), IsSidon A ∃ᵉ (B : Set ) (p : ), p.Prime A B IsPerfectDifferenceSet B (p^2 + p + 1)) False := (∀ (A : Set ), A.Finite IsSidon A B p, Nat.Prime p A B IsPerfectDifferenceSet B (p ^ 2 + p + 1)) False All goals completed! 🐙

Alexeev and Mixon [arxiv/2510.19804] have disproved this conjecture, proving that ${1,2,4,8}$ cannot be extended to a perfect difference set modulo $p^2+p+1$ for any prime $p$.

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'erdos_707.variants.counterexample_prime (A : Set ) (hA : A = {1, 2, 4, 8}) : Finite A IsSidon A (B : Set ) (p : ), Prime p A B ¬IsPerfectDifferenceSet B (p ^ 2 + p + 1) := A:Set hA:A = {1, 2, 4, 8}Finite A IsSidon A (B : Set ) (p : ), Prime p A B ¬IsPerfectDifferenceSet B (p ^ 2 + p + 1) All goals completed! 🐙

Alexeev and Mixon [arxiv/2510.19804] have disproved this conjecture, showing that ${1, 2, 4, 8, 13}$ cannot be extended to any perfect difference set.

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'erdos_707.variants.counterexample_mian_chowla (A : Set ) (hA : A = {1, 2, 4, 8, 13}) : Finite A IsSidon A (B : Set ) (n : ), A B ¬IsPerfectDifferenceSet B n := A:Set hA:A = {1, 2, 4, 8, 13}Finite A IsSidon A (B : Set ) (n : ), A B ¬IsPerfectDifferenceSet B n All goals completed! 🐙

This conjecture was actually first disproved by Hall in 1947 [Ha47], long before Erdős asked this question. A counterexample for any modulus from from [Ha47] in the paragraph following Theorem 4.3, where it was given as ${-8, -6, 0, 1, 4}$, but this can be shifted to natural numbers as pointed out in [arxiv/2510.19804].

@[category research solved, AMS 5 11] theorem declaration uses 'sorry'erdos_707.variants.counterexample_hall (A : Set ) (hA : A = {1, 3, 9, 10, 13}) : Finite A IsSidon A (B : Set ) (n : ), A B ¬IsPerfectDifferenceSet B n := A:Set hA:A = {1, 3, 9, 10, 13}Finite A IsSidon A (B : Set ) (n : ), A B ¬IsPerfectDifferenceSet B n All goals completed! 🐙

A perfect difference set modulo n must have size ≤ √n + 1.

@[category textbook, AMS 5 11] theorem erdos_707.variants.perfect_difference_set_size_bound (B : Set ) (n : ) (hB : IsPerfectDifferenceSet B n) : B.ncard n.sqrt + 1 := B:Set n:hB:IsPerfectDifferenceSet B nB.ncard n.sqrt + 1 B:Set n:hB:IsPerfectDifferenceSet B nhfin:B.FiniteB.ncard n.sqrt + 1B:Set n:hB:IsPerfectDifferenceSet B nhfin:¬B.FiniteB.ncard n.sqrt + 1 B:Set n:hB:IsPerfectDifferenceSet B nhfin:B.Finitehn:n = 0B.ncard n.sqrt + 1B:Set n:hB:IsPerfectDifferenceSet B nhfin:B.Finitehn:¬n = 0B.ncard n.sqrt + 1B:Set n:hB:IsPerfectDifferenceSet B nhfin:¬B.FiniteB.ncard n.sqrt + 1 B:Set hfin:B.FinitehB:IsPerfectDifferenceSet B 0B.ncard Nat.sqrt 0 + 1B:Set n:hB:IsPerfectDifferenceSet B nhfin:B.Finitehn:¬n = 0B.ncard n.sqrt + 1B:Set n:hB:IsPerfectDifferenceSet B nhfin:¬B.FiniteB.ncard n.sqrt + 1; B:Set hfin:B.FinitehB:IsPerfectDifferenceSet B 0B.ncard 1B:Set n:hB:IsPerfectDifferenceSet B nhfin:B.Finitehn:¬n = 0B.ncard n.sqrt + 1B:Set n:hB:IsPerfectDifferenceSet B nhfin:¬B.FiniteB.ncard n.sqrt + 1 B:Set hfin:B.FinitehB:IsPerfectDifferenceSet B 0h_abs:¬B.ncard 1FalseB:Set n:hB:IsPerfectDifferenceSet B nhfin:B.Finitehn:¬n = 0B.ncard n.sqrt + 1B:Set n:hB:IsPerfectDifferenceSet B nhfin:¬B.FiniteB.ncard n.sqrt + 1; B:Set hfin:B.FinitehB:IsPerfectDifferenceSet B 0h_abs:1 < B.ncardFalseB:Set n:hB:IsPerfectDifferenceSet B nhfin:B.Finitehn:¬n = 0B.ncard n.sqrt + 1B:Set n:hB:IsPerfectDifferenceSet B nhfin:¬B.FiniteB.ncard n.sqrt + 1 exact ((hfin.offDiag.image _).subset hB.surjOn).not_infinite (B:Set hfin:B.FinitehB:IsPerfectDifferenceSet B 0h_abs:1 < B.ncard{x | x 0}.Infinite B:Set hfin:B.FinitehB:IsPerfectDifferenceSet B 0h_abs:1 < B.ncard{x | x 0}.Infinite; All goals completed! 🐙) B:Set n:hB:IsPerfectDifferenceSet B nhfin:B.Finitehn:¬n = 0this:NeZero n := { out := hn }B.ncard n.sqrt + 1B:Set n:hB:IsPerfectDifferenceSet B nhfin:¬B.FiniteB.ncard n.sqrt + 1 suffices h : (B.ncard - 1) ^ 2 n B:Set n:hB:IsPerfectDifferenceSet B nhfin:B.Finitehn:¬n = 0this:NeZero n := { out := hn }h:(B.ncard - 1) ^ 2 n := ?m.112B.ncard n.sqrt + 1 B:Set n:hB:IsPerfectDifferenceSet B nhfin:B.Finitehn:¬n = 0this✝:NeZero n := { out := hn }h:(B.ncard - 1) ^ 2 n := ?m.112this:B.ncard - 1 n.sqrt := Nat.le_sqrt'.mpr hB.ncard n.sqrt + 1; All goals completed! 🐙 n:hn:¬n = 0this:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) n((↑B).ncard - 1) ^ 2 nB:Set n:hB:IsPerfectDifferenceSet B nhfin:¬B.FiniteB.ncard n.sqrt + 1; n:hn:¬n = 0this:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) n(B.card - 1) ^ 2 nB:Set n:hB:IsPerfectDifferenceSet B nhfin:¬B.FiniteB.ncard n.sqrt + 1 have h_target : {x : ZMod n | x 0}.ncard n := le_trans (Set.ncard_le_ncard (Set.subset_univ _) (Set.toFinite _)) (n:hn:¬n = 0this:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) nuniv.ncard n All goals completed! 🐙) have h_off_ncard_le : (B : Set ).offDiag.ncard n := B:Set n:hB:IsPerfectDifferenceSet B nB.ncard n.sqrt + 1 n:hn:¬n = 0this✝:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) nh_target:{x | x 0}.ncard n := le_trans (ncard_le_ncard (subset_univ {x | x 0}) (toFinite univ)) (of_eq_true (Eq.trans (congrArg (fun x => x n) (Eq.trans (ncard_univ (ZMod n)) (Eq.trans Nat.card_eq_fintype_card (ZMod.card n)))) (le_refl._simp_1 n)))this:((fun x => match x with | (a, b) => a - b) '' (↑B).offDiag).ncard = (↑B).offDiag.ncard := ncard_image_of_injOn (BijOn.injOn hB)(↑B).offDiag.ncard n n:hn:¬n = 0this✝:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) nh_target:{x | x 0}.ncard n := le_trans (ncard_le_ncard (subset_univ {x | x 0}) (toFinite univ)) (of_eq_true (Eq.trans (congrArg (fun x => x n) (Eq.trans (ncard_univ (ZMod n)) (Eq.trans Nat.card_eq_fintype_card (ZMod.card n)))) (le_refl._simp_1 n)))this:{x | x 0}.ncard = (↑B).offDiag.ncard(↑B).offDiag.ncard n All goals completed! 🐙 have h_off_le : B.offDiag.card n := B:Set n:hB:IsPerfectDifferenceSet B nB.ncard n.sqrt + 1 rwa [ Finset.coe_offDiag, ncard_coe_finsetn:hn:¬n = 0this:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) nh_target:{x | x 0}.ncard n := le_trans (ncard_le_ncard (subset_univ {x | x 0}) (toFinite univ)) (of_eq_true (Eq.trans (congrArg (fun x => x n) (Eq.trans (ncard_univ (ZMod n)) (Eq.trans Nat.card_eq_fintype_card (ZMod.card n)))) (le_refl._simp_1 n)))h_off_ncard_le:B.offDiag.card nB.offDiag.card n at h_off_ncard_le have h_mul_eq : B.card * (B.card - 1) = B.offDiag.card := B:Set n:hB:IsPerfectDifferenceSet B nB.ncard n.sqrt + 1 n:hn:¬n = 0this:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) nh_target:{x | x 0}.ncard n := le_trans (ncard_le_ncard (subset_univ {x | x 0}) (toFinite univ)) (of_eq_true (Eq.trans (congrArg (fun x => x n) (Eq.trans (ncard_univ (ZMod n)) (Eq.trans Nat.card_eq_fintype_card (ZMod.card n)))) (le_refl._simp_1 n)))h_off_ncard_le:(↑B).offDiag.ncard n := have this := ncard_image_of_injOn (BijOn.injOn hB); le_of_not_gt fun a => Mathlib.Tactic.Linarith.lt_irrefl (Eq.mp (congrArg (fun _a => _a < 0) (Mathlib.Tactic.Ring.of_eq (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1))))) Mathlib.Tactic.Ring.neg_zero)) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑n) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_zero_add ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsNat.to_raw_eq (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 1))))))) Mathlib.Tactic.Ring.neg_zero))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))))) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.add_pf_add_gt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_zero (n ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0)))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0)))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑n) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_zero_add 0))))) (Mathlib.Tactic.Ring.cast_zero (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 0))))) (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (Mathlib.Tactic.Linarith.lt_of_lt_of_eq (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (neg_neg_of_pos Mathlib.Tactic.Linarith.zero_lt_one) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (id (Eq.mp (Mathlib.Tactic.Zify.natCast_le._simp_1 {x | x 0}.ncard n) h_target)))) (neg_eq_zero.mpr (sub_eq_zero_of_eq (id (Eq.mp (Mathlib.Tactic.Zify.natCast_eq._simp_1 {x | x 0}.ncard (↑B).offDiag.ncard) (Eq.mp (congrArg (fun _a => _a.ncard = (↑B).offDiag.ncard) (BijOn.image_eq hB)) this)))))) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (Int.add_one_le_iff.mpr (id (Eq.mp (Mathlib.Tactic.Zify.natCast_lt._simp_1 n (↑B).offDiag.ncard) a))))))h_off_le:B.offDiag.card n := Eq.mp (congrArg (fun _a => _a n) (ncard_coe_finset B.offDiag)) (Eq.mp (congrArg (fun _a => _a.ncard n) (Eq.symm (Finset.coe_offDiag B))) h_off_ncard_le)B.card * (B.card - 1) = B.card * B.card - B.card; n:hn:¬n = 0this:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) nh_target:{x | x 0}.ncard n := le_trans (ncard_le_ncard (subset_univ {x | x 0}) (toFinite univ)) (of_eq_true (Eq.trans (congrArg (fun x => x n) (Eq.trans (ncard_univ (ZMod n)) (Eq.trans Nat.card_eq_fintype_card (ZMod.card n)))) (le_refl._simp_1 n)))h_off_ncard_le:(↑B).offDiag.ncard n := have this := ncard_image_of_injOn (BijOn.injOn hB); le_of_not_gt fun a => Mathlib.Tactic.Linarith.lt_irrefl (Eq.mp (congrArg (fun _a => _a < 0) (Mathlib.Tactic.Ring.of_eq (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1))))) Mathlib.Tactic.Ring.neg_zero)) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑n) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_zero_add ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsNat.to_raw_eq (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 1))))))) Mathlib.Tactic.Ring.neg_zero))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))))) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.add_pf_add_gt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_zero (n ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0)))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0)))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑n) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_zero_add 0))))) (Mathlib.Tactic.Ring.cast_zero (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 0))))) (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (Mathlib.Tactic.Linarith.lt_of_lt_of_eq (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (neg_neg_of_pos Mathlib.Tactic.Linarith.zero_lt_one) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (id (Eq.mp (Mathlib.Tactic.Zify.natCast_le._simp_1 {x | x 0}.ncard n) h_target)))) (neg_eq_zero.mpr (sub_eq_zero_of_eq (id (Eq.mp (Mathlib.Tactic.Zify.natCast_eq._simp_1 {x | x 0}.ncard (↑B).offDiag.ncard) (Eq.mp (congrArg (fun _a => _a.ncard = (↑B).offDiag.ncard) (BijOn.image_eq hB)) this)))))) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (Int.add_one_le_iff.mpr (id (Eq.mp (Mathlib.Tactic.Zify.natCast_lt._simp_1 n (↑B).offDiag.ncard) a))))))h_off_le:B.offDiag.card n := Eq.mp (congrArg (fun _a => _a n) (ncard_coe_finset B.offDiag)) (Eq.mp (congrArg (fun _a => _a.ncard n) (Eq.symm (Finset.coe_offDiag B))) h_off_ncard_le)0 * (0 - 1) = 0 * 0 - 0n:hn:¬n = 0this:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) nh_target:{x | x 0}.ncard n := le_trans (ncard_le_ncard (subset_univ {x | x 0}) (toFinite univ)) (of_eq_true (Eq.trans (congrArg (fun x => x n) (Eq.trans (ncard_univ (ZMod n)) (Eq.trans Nat.card_eq_fintype_card (ZMod.card n)))) (le_refl._simp_1 n)))h_off_ncard_le:(↑B).offDiag.ncard n := have this := ncard_image_of_injOn (BijOn.injOn hB); le_of_not_gt fun a => Mathlib.Tactic.Linarith.lt_irrefl (Eq.mp (congrArg (fun _a => _a < 0) (Mathlib.Tactic.Ring.of_eq (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1))))) Mathlib.Tactic.Ring.neg_zero)) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑n) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_zero_add ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsNat.to_raw_eq (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 1))))))) Mathlib.Tactic.Ring.neg_zero))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))))) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.add_pf_add_gt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_zero (n ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0)))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0)))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑n) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_zero_add 0))))) (Mathlib.Tactic.Ring.cast_zero (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 0))))) (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (Mathlib.Tactic.Linarith.lt_of_lt_of_eq (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (neg_neg_of_pos Mathlib.Tactic.Linarith.zero_lt_one) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (id (Eq.mp (Mathlib.Tactic.Zify.natCast_le._simp_1 {x | x 0}.ncard n) h_target)))) (neg_eq_zero.mpr (sub_eq_zero_of_eq (id (Eq.mp (Mathlib.Tactic.Zify.natCast_eq._simp_1 {x | x 0}.ncard (↑B).offDiag.ncard) (Eq.mp (congrArg (fun _a => _a.ncard = (↑B).offDiag.ncard) (BijOn.image_eq hB)) this)))))) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (Int.add_one_le_iff.mpr (id (Eq.mp (Mathlib.Tactic.Zify.natCast_lt._simp_1 n (↑B).offDiag.ncard) a))))))h_off_le:B.offDiag.card n := Eq.mp (congrArg (fun _a => _a n) (ncard_coe_finset B.offDiag)) (Eq.mp (congrArg (fun _a => _a.ncard n) (Eq.symm (Finset.coe_offDiag B))) h_off_ncard_le)k:(k + 1) * (k + 1 - 1) = (k + 1) * (k + 1) - (k + 1) n:hn:¬n = 0this:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) nh_target:{x | x 0}.ncard n := le_trans (ncard_le_ncard (subset_univ {x | x 0}) (toFinite univ)) (of_eq_true (Eq.trans (congrArg (fun x => x n) (Eq.trans (ncard_univ (ZMod n)) (Eq.trans Nat.card_eq_fintype_card (ZMod.card n)))) (le_refl._simp_1 n)))h_off_ncard_le:(↑B).offDiag.ncard n := have this := ncard_image_of_injOn (BijOn.injOn hB); le_of_not_gt fun a => Mathlib.Tactic.Linarith.lt_irrefl (Eq.mp (congrArg (fun _a => _a < 0) (Mathlib.Tactic.Ring.of_eq (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1))))) Mathlib.Tactic.Ring.neg_zero)) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑n) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_zero_add ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsNat.to_raw_eq (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 1))))))) Mathlib.Tactic.Ring.neg_zero))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))))) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.add_pf_add_gt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_zero (n ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0)))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0)))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑n) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_zero_add 0))))) (Mathlib.Tactic.Ring.cast_zero (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 0))))) (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (Mathlib.Tactic.Linarith.lt_of_lt_of_eq (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (neg_neg_of_pos Mathlib.Tactic.Linarith.zero_lt_one) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (id (Eq.mp (Mathlib.Tactic.Zify.natCast_le._simp_1 {x | x 0}.ncard n) h_target)))) (neg_eq_zero.mpr (sub_eq_zero_of_eq (id (Eq.mp (Mathlib.Tactic.Zify.natCast_eq._simp_1 {x | x 0}.ncard (↑B).offDiag.ncard) (Eq.mp (congrArg (fun _a => _a.ncard = (↑B).offDiag.ncard) (BijOn.image_eq hB)) this)))))) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (Int.add_one_le_iff.mpr (id (Eq.mp (Mathlib.Tactic.Zify.natCast_lt._simp_1 n (↑B).offDiag.ncard) a))))))h_off_le:B.offDiag.card n := Eq.mp (congrArg (fun _a => _a n) (ncard_coe_finset B.offDiag)) (Eq.mp (congrArg (fun _a => _a.ncard n) (Eq.symm (Finset.coe_offDiag B))) h_off_ncard_le)0 * (0 - 1) = 0 * 0 - 0n:hn:¬n = 0this:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) nh_target:{x | x 0}.ncard n := le_trans (ncard_le_ncard (subset_univ {x | x 0}) (toFinite univ)) (of_eq_true (Eq.trans (congrArg (fun x => x n) (Eq.trans (ncard_univ (ZMod n)) (Eq.trans Nat.card_eq_fintype_card (ZMod.card n)))) (le_refl._simp_1 n)))h_off_ncard_le:(↑B).offDiag.ncard n := have this := ncard_image_of_injOn (BijOn.injOn hB); le_of_not_gt fun a => Mathlib.Tactic.Linarith.lt_irrefl (Eq.mp (congrArg (fun _a => _a < 0) (Mathlib.Tactic.Ring.of_eq (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1))))) Mathlib.Tactic.Ring.neg_zero)) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑n) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_zero_add ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsNat.to_raw_eq (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 1))))))) Mathlib.Tactic.Ring.neg_zero))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))))) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.add_pf_add_gt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_zero (n ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0)))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0)))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑n) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_zero_add 0))))) (Mathlib.Tactic.Ring.cast_zero (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 0))))) (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (Mathlib.Tactic.Linarith.lt_of_lt_of_eq (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (neg_neg_of_pos Mathlib.Tactic.Linarith.zero_lt_one) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (id (Eq.mp (Mathlib.Tactic.Zify.natCast_le._simp_1 {x | x 0}.ncard n) h_target)))) (neg_eq_zero.mpr (sub_eq_zero_of_eq (id (Eq.mp (Mathlib.Tactic.Zify.natCast_eq._simp_1 {x | x 0}.ncard (↑B).offDiag.ncard) (Eq.mp (congrArg (fun _a => _a.ncard = (↑B).offDiag.ncard) (BijOn.image_eq hB)) this)))))) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (Int.add_one_le_iff.mpr (id (Eq.mp (Mathlib.Tactic.Zify.natCast_lt._simp_1 n (↑B).offDiag.ncard) a))))))h_off_le:B.offDiag.card n := Eq.mp (congrArg (fun _a => _a n) (ncard_coe_finset B.offDiag)) (Eq.mp (congrArg (fun _a => _a.ncard n) (Eq.symm (Finset.coe_offDiag B))) h_off_ncard_le)k:(k + 1) * (k + 1 - 1) = (k + 1) * (k + 1) - (k + 1) All goals completed! 🐙 have h_sq_le : (B.card - 1) ^ 2 B.card * (B.card - 1) := B:Set n:hB:IsPerfectDifferenceSet B nB.ncard n.sqrt + 1 n:hn:¬n = 0this:NeZero n := { out := hn }B:Finset hB:IsPerfectDifferenceSet (↑B) nh_target:{x | x 0}.ncard n := le_trans (ncard_le_ncard (subset_univ {x | x 0}) (toFinite univ)) (of_eq_true (Eq.trans (congrArg (fun x => x n) (Eq.trans (ncard_univ (ZMod n)) (Eq.trans Nat.card_eq_fintype_card (ZMod.card n)))) (le_refl._simp_1 n)))h_off_ncard_le:(↑B).offDiag.ncard n := have this := ncard_image_of_injOn (BijOn.injOn hB); le_of_not_gt fun a => Mathlib.Tactic.Linarith.lt_irrefl (Eq.mp (congrArg (fun _a => _a < 0) (Mathlib.Tactic.Ring.of_eq (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1))))) Mathlib.Tactic.Ring.neg_zero)) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑n) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_zero_add ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_congr (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.atom_pf {x | x 0}.ncard) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt ({x | x 0}.ncard ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsNat.to_raw_eq (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 1))))))) Mathlib.Tactic.Ring.neg_zero))) (Mathlib.Tactic.Ring.add_pf_add_lt (Int.negOfNat 1).rawCast (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑{x | x 0}.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))))) (Mathlib.Tactic.Ring.sub_congr (Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.atom_pf n) (Mathlib.Tactic.Ring.cast_pos (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1))) (Mathlib.Tactic.Ring.add_pf_add_gt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_zero (n ^ Nat.rawCast 1 * Nat.rawCast 1 + 0)))) (Mathlib.Tactic.Ring.atom_pf (↑B).offDiag.ncard) (Mathlib.Tactic.Ring.sub_pf (Mathlib.Tactic.Ring.neg_add (Mathlib.Tactic.Ring.neg_mul (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Tactic.Ring.neg_one_mul (Mathlib.Meta.NormNum.IsInt.to_raw_eq (Mathlib.Meta.NormNum.isInt_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.negOfNat 1)))))) Mathlib.Tactic.Ring.neg_zero) (Mathlib.Tactic.Ring.add_pf_add_lt (Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_add_lt (n ^ Nat.rawCast 1 * Nat.rawCast 1) (Mathlib.Tactic.Ring.add_pf_zero_add ((↑B).offDiag.ncard ^ Nat.rawCast 1 * (Int.negOfNat 1).rawCast + 0)))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0)))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑n) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_add_overlap_zero (Mathlib.Tactic.Ring.add_overlap_pf_zero (↑(↑B).offDiag.ncard) (Nat.rawCast 1) (Mathlib.Meta.NormNum.IsInt.to_isNat (Mathlib.Meta.NormNum.isInt_add (Eq.refl HAdd.hAdd) (Mathlib.Meta.NormNum.IsNat.to_isInt (Mathlib.Meta.NormNum.IsNat.of_raw 1)) (Mathlib.Meta.NormNum.IsInt.of_raw (Int.negOfNat 1)) (Eq.refl (Int.ofNat 0))))) (Mathlib.Tactic.Ring.add_pf_zero_add 0))))) (Mathlib.Tactic.Ring.cast_zero (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 0))))) (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (Mathlib.Tactic.Linarith.lt_of_lt_of_eq (Mathlib.Tactic.Linarith.add_lt_of_neg_of_le (neg_neg_of_pos Mathlib.Tactic.Linarith.zero_lt_one) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (id (Eq.mp (Mathlib.Tactic.Zify.natCast_le._simp_1 {x | x 0}.ncard n) h_target)))) (neg_eq_zero.mpr (sub_eq_zero_of_eq (id (Eq.mp (Mathlib.Tactic.Zify.natCast_eq._simp_1 {x | x 0}.ncard (↑B).offDiag.ncard) (Eq.mp (congrArg (fun _a => _a.ncard = (↑B).offDiag.ncard) (BijOn.image_eq hB)) this)))))) (Mathlib.Tactic.Linarith.sub_nonpos_of_le (Int.add_one_le_iff.mpr (id (Eq.mp (Mathlib.Tactic.Zify.natCast_lt._simp_1 n (↑B).offDiag.ncard) a))))))h_off_le:B.offDiag.card n := Eq.mp (congrArg (fun _a => _a n) (ncard_coe_finset B.offDiag)) (Eq.mp (congrArg (fun _a => _a.ncard n) (Eq.symm (Finset.coe_offDiag B))) h_off_ncard_le)h_mul_eq:B.card * (B.card - 1) = B.offDiag.card := Eq.mpr (id (congrArg (fun _a => B.card * (B.card - 1) = _a) (Finset.offDiag_card B))) (Nat.casesAuxOn B.card (of_eq_true (Eq.trans (congr (congrArg Eq (Eq.trans (congrArg (HMul.hMul 0) (zero_tsub 1)) (mul_zero 0))) (Eq.trans (congrArg (fun x => x - 0) (mul_zero 0)) (tsub_self 0))) (eq_self 0))) fun k => of_eq_true (Eq.trans (Eq.trans (congr (congrArg Eq (Eq.trans (congrArg (HMul.hMul (k + 1)) (add_tsub_cancel_right k 1)) (Nat.succ_mul k k))) (Eq.trans (congrArg (fun x => x - (k + 1)) (Nat.succ_mul k (k + 1))) (add_tsub_cancel_right (k * k + k) (k + 1)))) Nat.add_left_cancel_iff._simp_1) (eq_self k)))(B.card - 1) * (B.card - 1) B.card * (B.card - 1); All goals completed! 🐙 B:Set n:hB:IsPerfectDifferenceSet B nhfin:¬B.FiniteB.ncard n.sqrt + 1 B:Set n:hB:IsPerfectDifferenceSet B nhfin:¬B.Finitethis:B.ncard = 0 := Infinite.ncard hfinB.ncard n.sqrt + 1; All goals completed! 🐙

The Singer construction gives perfect difference sets for n = p^2 + p + 1 where p is a prime power.

@[category textbook, AMS 5 11] theorem declaration uses 'sorry'erdos_707.variants.singer_construction (p : ) (hp : IsPrimePow p) : (B : Set ), IsPerfectDifferenceSet B (p^2 + p + 1) B.ncard = p + 1 := p:hp:IsPrimePow p B, IsPerfectDifferenceSet B (p ^ 2 + p + 1) B.ncard = p + 1 All goals completed! 🐙

The set {1, 2, 4} is a Sidon set.

@[category textbook, AMS 5 11] theorem erdos_707.variants.example_sidon_set : IsSidon ({1, 2, 4} : Set ) := IsSidon {1, 2, 4} intro i₁ i₁:hi₁:i₁ {1, 2, 4} j₁ {1, 2, 4}, i₂ {1, 2, 4}, j₂ {1, 2, 4}, i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:j₁ {1, 2, 4} i₂ {1, 2, 4}, j₂ {1, 2, 4}, i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4} i₂ {1, 2, 4}, j₂ {1, 2, 4}, i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4}i₂:i₂ {1, 2, 4} j₂ {1, 2, 4}, i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4}i₂:hi₂:i₂ {1, 2, 4} j₂ {1, 2, 4}, i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4}i₂:hi₂:i₂ {1, 2, 4}j₂:j₂ {1, 2, 4} i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4}i₂:hi₂:i₂ {1, 2, 4}j₂:hj₂:j₂ {1, 2, 4}i₁ + i₂ = j₁ + j₂ i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:hi₁:i₁ {1, 2, 4}j₁:hj₁:j₁ {1, 2, 4}i₂:hi₂:i₂ {1, 2, 4}j₂:hj₂:j₂ {1, 2, 4}hsum:i₁ + i₂ = j₁ + j₂i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ i₁:j₁:i₂:j₂:hsum:i₁ + i₂ = j₁ + j₂hi₁:i₁ = 1 i₁ = 2 i₁ = 4hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4i₁ = j₁ i₂ = j₂ i₁ = j₂ i₂ = j₁ j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + i₂ = j₁ + j₂1 = j₁ i₂ = j₂ 1 = j₂ i₂ = j₁j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + i₂ = j₁ + j₂2 = j₁ i₂ = j₂ 2 = j₂ i₂ = j₁j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = j₁ + j₂4 = j₁ i₂ = j₂ 4 = j₂ i₂ = j₁ j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + i₂ = j₁ + j₂1 = j₁ i₂ = j₂ 1 = j₂ i₂ = j₁j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + i₂ = j₁ + j₂2 = j₁ i₂ = j₂ 2 = j₂ i₂ = j₁j₁:i₂:j₂:hj₁:j₁ = 1 j₁ = 2 j₁ = 4hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = j₁ + j₂4 = j₁ i₂ = j₂ 4 = j₂ i₂ = j₁ i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 1 + j₂4 = 1 i₂ = j₂ 4 = j₂ i₂ = 1i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 2 + j₂4 = 2 i₂ = j₂ 4 = j₂ i₂ = 2i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 4 + j₂4 = 4 i₂ = j₂ 4 = j₂ i₂ = 4 i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + i₂ = 1 + j₂1 = 1 i₂ = j₂ 1 = j₂ i₂ = 1i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + i₂ = 2 + j₂1 = 2 i₂ = j₂ 1 = j₂ i₂ = 2i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + i₂ = 4 + j₂1 = 4 i₂ = j₂ 1 = j₂ i₂ = 4i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + i₂ = 1 + j₂2 = 1 i₂ = j₂ 2 = j₂ i₂ = 1i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + i₂ = 2 + j₂2 = 2 i₂ = j₂ 2 = j₂ i₂ = 2i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + i₂ = 4 + j₂2 = 4 i₂ = j₂ 2 = j₂ i₂ = 4i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 1 + j₂4 = 1 i₂ = j₂ 4 = j₂ i₂ = 1i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 2 + j₂4 = 2 i₂ = j₂ 4 = j₂ i₂ = 2i₂:j₂:hi₂:i₂ = 1 i₂ = 2 i₂ = 4hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + i₂ = 4 + j₂4 = 4 i₂ = j₂ 4 = j₂ i₂ = 4 j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 1 = 4 + j₂4 = 4 1 = j₂ 4 = j₂ 1 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 2 = 4 + j₂4 = 4 2 = j₂ 4 = j₂ 2 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 4 = 4 + j₂4 = 4 4 = j₂ 4 = j₂ 4 = 4 j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 1 = 1 + j₂1 = 1 1 = j₂ 1 = j₂ 1 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 2 = 1 + j₂1 = 1 2 = j₂ 1 = j₂ 2 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 4 = 1 + j₂1 = 1 4 = j₂ 1 = j₂ 4 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 1 = 2 + j₂1 = 2 1 = j₂ 1 = j₂ 1 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 2 = 2 + j₂1 = 2 2 = j₂ 1 = j₂ 2 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 4 = 2 + j₂1 = 2 4 = j₂ 1 = j₂ 4 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 1 = 4 + j₂1 = 4 1 = j₂ 1 = j₂ 1 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 2 = 4 + j₂1 = 4 2 = j₂ 1 = j₂ 2 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:1 + 4 = 4 + j₂1 = 4 4 = j₂ 1 = j₂ 4 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 1 = 1 + j₂2 = 1 1 = j₂ 2 = j₂ 1 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 2 = 1 + j₂2 = 1 2 = j₂ 2 = j₂ 2 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 4 = 1 + j₂2 = 1 4 = j₂ 2 = j₂ 4 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 1 = 2 + j₂2 = 2 1 = j₂ 2 = j₂ 1 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 2 = 2 + j₂2 = 2 2 = j₂ 2 = j₂ 2 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 4 = 2 + j₂2 = 2 4 = j₂ 2 = j₂ 4 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 1 = 4 + j₂2 = 4 1 = j₂ 2 = j₂ 1 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 2 = 4 + j₂2 = 4 2 = j₂ 2 = j₂ 2 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:2 + 4 = 4 + j₂2 = 4 4 = j₂ 2 = j₂ 4 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 1 = 1 + j₂4 = 1 1 = j₂ 4 = j₂ 1 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 2 = 1 + j₂4 = 1 2 = j₂ 4 = j₂ 2 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 4 = 1 + j₂4 = 1 4 = j₂ 4 = j₂ 4 = 1j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 1 = 2 + j₂4 = 2 1 = j₂ 4 = j₂ 1 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 2 = 2 + j₂4 = 2 2 = j₂ 4 = j₂ 2 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 4 = 2 + j₂4 = 2 4 = j₂ 4 = j₂ 4 = 2j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 1 = 4 + j₂4 = 4 1 = j₂ 4 = j₂ 1 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 2 = 4 + j₂4 = 4 2 = j₂ 4 = j₂ 2 = 4j₂:hj₂:j₂ = 1 j₂ = 2 j₂ = 4hsum:4 + 4 = 4 + j₂4 = 4 4 = j₂ 4 = j₂ 4 = 4 hsum:4 + 4 = 4 + 14 = 4 4 = 1 4 = 1 4 = 4hsum:4 + 4 = 4 + 24 = 4 4 = 2 4 = 2 4 = 4hsum:4 + 4 = 4 + 44 = 4 4 = 4 4 = 4 4 = 4 hsum:1 + 1 = 1 + 11 = 1 1 = 1 1 = 1 1 = 1hsum:1 + 1 = 1 + 21 = 1 1 = 2 1 = 2 1 = 1hsum:1 + 1 = 1 + 41 = 1 1 = 4 1 = 4 1 = 1hsum:1 + 2 = 1 + 11 = 1 2 = 1 1 = 1 2 = 1hsum:1 + 2 = 1 + 21 = 1 2 = 2 1 = 2 2 = 1hsum:1 + 2 = 1 + 41 = 1 2 = 4 1 = 4 2 = 1hsum:1 + 4 = 1 + 11 = 1 4 = 1 1 = 1 4 = 1hsum:1 + 4 = 1 + 21 = 1 4 = 2 1 = 2 4 = 1hsum:1 + 4 = 1 + 41 = 1 4 = 4 1 = 4 4 = 1hsum:1 + 1 = 2 + 11 = 2 1 = 1 1 = 1 1 = 2hsum:1 + 1 = 2 + 21 = 2 1 = 2 1 = 2 1 = 2hsum:1 + 1 = 2 + 41 = 2 1 = 4 1 = 4 1 = 2hsum:1 + 2 = 2 + 11 = 2 2 = 1 1 = 1 2 = 2hsum:1 + 2 = 2 + 21 = 2 2 = 2 1 = 2 2 = 2hsum:1 + 2 = 2 + 41 = 2 2 = 4 1 = 4 2 = 2hsum:1 + 4 = 2 + 11 = 2 4 = 1 1 = 1 4 = 2hsum:1 + 4 = 2 + 21 = 2 4 = 2 1 = 2 4 = 2hsum:1 + 4 = 2 + 41 = 2 4 = 4 1 = 4 4 = 2hsum:1 + 1 = 4 + 11 = 4 1 = 1 1 = 1 1 = 4hsum:1 + 1 = 4 + 21 = 4 1 = 2 1 = 2 1 = 4hsum:1 + 1 = 4 + 41 = 4 1 = 4 1 = 4 1 = 4hsum:1 + 2 = 4 + 11 = 4 2 = 1 1 = 1 2 = 4hsum:1 + 2 = 4 + 21 = 4 2 = 2 1 = 2 2 = 4hsum:1 + 2 = 4 + 41 = 4 2 = 4 1 = 4 2 = 4hsum:1 + 4 = 4 + 11 = 4 4 = 1 1 = 1 4 = 4hsum:1 + 4 = 4 + 21 = 4 4 = 2 1 = 2 4 = 4hsum:1 + 4 = 4 + 41 = 4 4 = 4 1 = 4 4 = 4hsum:2 + 1 = 1 + 12 = 1 1 = 1 2 = 1 1 = 1hsum:2 + 1 = 1 + 22 = 1 1 = 2 2 = 2 1 = 1hsum:2 + 1 = 1 + 42 = 1 1 = 4 2 = 4 1 = 1hsum:2 + 2 = 1 + 12 = 1 2 = 1 2 = 1 2 = 1hsum:2 + 2 = 1 + 22 = 1 2 = 2 2 = 2 2 = 1hsum:2 + 2 = 1 + 42 = 1 2 = 4 2 = 4 2 = 1hsum:2 + 4 = 1 + 12 = 1 4 = 1 2 = 1 4 = 1hsum:2 + 4 = 1 + 22 = 1 4 = 2 2 = 2 4 = 1hsum:2 + 4 = 1 + 42 = 1 4 = 4 2 = 4 4 = 1hsum:2 + 1 = 2 + 12 = 2 1 = 1 2 = 1 1 = 2hsum:2 + 1 = 2 + 22 = 2 1 = 2 2 = 2 1 = 2hsum:2 + 1 = 2 + 42 = 2 1 = 4 2 = 4 1 = 2hsum:2 + 2 = 2 + 12 = 2 2 = 1 2 = 1 2 = 2hsum:2 + 2 = 2 + 22 = 2 2 = 2 2 = 2 2 = 2hsum:2 + 2 = 2 + 42 = 2 2 = 4 2 = 4 2 = 2hsum:2 + 4 = 2 + 12 = 2 4 = 1 2 = 1 4 = 2hsum:2 + 4 = 2 + 22 = 2 4 = 2 2 = 2 4 = 2hsum:2 + 4 = 2 + 42 = 2 4 = 4 2 = 4 4 = 2hsum:2 + 1 = 4 + 12 = 4 1 = 1 2 = 1 1 = 4hsum:2 + 1 = 4 + 22 = 4 1 = 2 2 = 2 1 = 4hsum:2 + 1 = 4 + 42 = 4 1 = 4 2 = 4 1 = 4hsum:2 + 2 = 4 + 12 = 4 2 = 1 2 = 1 2 = 4hsum:2 + 2 = 4 + 22 = 4 2 = 2 2 = 2 2 = 4hsum:2 + 2 = 4 + 42 = 4 2 = 4 2 = 4 2 = 4hsum:2 + 4 = 4 + 12 = 4 4 = 1 2 = 1 4 = 4hsum:2 + 4 = 4 + 22 = 4 4 = 2 2 = 2 4 = 4hsum:2 + 4 = 4 + 42 = 4 4 = 4 2 = 4 4 = 4hsum:4 + 1 = 1 + 14 = 1 1 = 1 4 = 1 1 = 1hsum:4 + 1 = 1 + 24 = 1 1 = 2 4 = 2 1 = 1hsum:4 + 1 = 1 + 44 = 1 1 = 4 4 = 4 1 = 1hsum:4 + 2 = 1 + 14 = 1 2 = 1 4 = 1 2 = 1hsum:4 + 2 = 1 + 24 = 1 2 = 2 4 = 2 2 = 1hsum:4 + 2 = 1 + 44 = 1 2 = 4 4 = 4 2 = 1hsum:4 + 4 = 1 + 14 = 1 4 = 1 4 = 1 4 = 1hsum:4 + 4 = 1 + 24 = 1 4 = 2 4 = 2 4 = 1hsum:4 + 4 = 1 + 44 = 1 4 = 4 4 = 4 4 = 1hsum:4 + 1 = 2 + 14 = 2 1 = 1 4 = 1 1 = 2hsum:4 + 1 = 2 + 24 = 2 1 = 2 4 = 2 1 = 2hsum:4 + 1 = 2 + 44 = 2 1 = 4 4 = 4 1 = 2hsum:4 + 2 = 2 + 14 = 2 2 = 1 4 = 1 2 = 2hsum:4 + 2 = 2 + 24 = 2 2 = 2 4 = 2 2 = 2hsum:4 + 2 = 2 + 44 = 2 2 = 4 4 = 4 2 = 2hsum:4 + 4 = 2 + 14 = 2 4 = 1 4 = 1 4 = 2hsum:4 + 4 = 2 + 24 = 2 4 = 2 4 = 2 4 = 2hsum:4 + 4 = 2 + 44 = 2 4 = 4 4 = 4 4 = 2hsum:4 + 1 = 4 + 14 = 4 1 = 1 4 = 1 1 = 4hsum:4 + 1 = 4 + 24 = 4 1 = 2 4 = 2 1 = 4hsum:4 + 1 = 4 + 44 = 4 1 = 4 4 = 4 1 = 4hsum:4 + 2 = 4 + 14 = 4 2 = 1 4 = 1 2 = 4hsum:4 + 2 = 4 + 24 = 4 2 = 2 4 = 2 2 = 4hsum:4 + 2 = 4 + 44 = 4 2 = 4 4 = 4 2 = 4hsum:4 + 4 = 4 + 14 = 4 4 = 1 4 = 1 4 = 4hsum:4 + 4 = 4 + 24 = 4 4 = 2 4 = 2 4 = 4hsum:4 + 4 = 4 + 44 = 4 4 = 4 4 = 4 4 = 4 All goals completed! 🐙

The set {1, 2, 4} can be embedded in a perfect difference set modulo 7.

@[category textbook, AMS 5 11] theorem erdos_707.variants.example_embedding : (B : Set ), {1, 2, 4} B IsPerfectDifferenceSet B 7 := B, {1, 2, 4} B IsPerfectDifferenceSet B 7 IsPerfectDifferenceSet {1, 2, 4} 7 BijOn (fun x => match x with | (a, b) => a - b) {1, 2, 4}.offDiag {x | x 0} MapsTo (fun x => match x with | (a, b) => a - b) {1, 2, 4}.offDiag {x | x 0}InjOn (fun x => match x with | (a, b) => a - b) {1, 2, 4}.offDiagSurjOn (fun x => match x with | (a, b) => a - b) {1, 2, 4}.offDiag {x | x 0} MapsTo (fun x => match x with | (a, b) => a - b) {1, 2, 4}.offDiag {x | x 0} intro a, b a:b:hab:(a, b) {1, 2, 4}.offDiag(fun x => match x with | (a, b) => a - b) (a, b) {x | x 0}; a:b:hab:(a = 1 a = 2 a = 4) (b = 1 b = 2 b = 4) a b(fun x => match x with | (a, b) => a - b) (a, b) {x | x 0} a:b:ha:a = 1 a = 2 a = 4hb:b = 1 b = 2 b = 4hne:a b(fun x => match x with | (a, b) => a - b) (a, b) {x | x 0} a:b:ha:a = 1 a = 2 a = 4hb:b = 1 b = 2 b = 4hne:a ba - b 0 b:hb:b = 1 b = 2 b = 4hne:1 b1 - b 0b:hb:b = 1 b = 2 b = 4hne:2 b2 - b 0b:hb:b = 1 b = 2 b = 4hne:4 b4 - b 0 b:hb:b = 1 b = 2 b = 4hne:1 b1 - b 0b:hb:b = 1 b = 2 b = 4hne:2 b2 - b 0b:hb:b = 1 b = 2 b = 4hne:4 b4 - b 0 hne:4 14 - 1 0hne:4 24 - 2 0hne:4 44 - 4 0 hne:1 11 - 1 0hne:1 21 - 2 0hne:1 41 - 4 0hne:2 12 - 1 0hne:2 22 - 2 0hne:2 42 - 4 0hne:4 14 - 1 0hne:4 24 - 2 0hne:4 44 - 4 0 All goals completed! 🐙 ¬1 - 2 = 0¬1 - 4 = 0¬2 - 1 = 0¬2 - 4 = 0¬4 - 1 = 0¬4 - 2 = 0 All goals completed! 🐙 InjOn (fun x => match x with | (a, b) => a - b) {1, 2, 4}.offDiag intro a₁, b₁ a₁:b₁:h1:(a₁, b₁) {1, 2, 4}.offDiag x₂ : × ⦄, x₂ {1, 2, 4}.offDiag (fun x => match x with | (a, b) => a - b) (a₁, b₁) = (fun x => match x with | (a, b) => a - b) x₂ (a₁, b₁) = x₂ a₁:b₁:h1:(a₁, b₁) {1, 2, 4}.offDiaga₂:b₂:(a₂, b₂) {1, 2, 4}.offDiag (fun x => match x with | (a, b) => a - b) (a₁, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂) (a₁, b₁) = (a₂, b₂) a₁:b₁:h1:(a₁, b₁) {1, 2, 4}.offDiaga₂:b₂:h2:(a₂, b₂) {1, 2, 4}.offDiag(fun x => match x with | (a, b) => a - b) (a₁, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂) (a₁, b₁) = (a₂, b₂) a₁:b₁:h1:(a₁, b₁) {1, 2, 4}.offDiaga₂:b₂:h2:(a₂, b₂) {1, 2, 4}.offDiagheq:(fun x => match x with | (a, b) => a - b) (a₁, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)(a₁, b₁) = (a₂, b₂) a₁:b₁:a₂:b₂:heq:(fun x => match x with | (a, b) => a - b) (a₁, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)h1:(a₁ = 1 a₁ = 2 a₁ = 4) (b₁ = 1 b₁ = 2 b₁ = 4) a₁ b₁h2:(a₂ = 1 a₂ = 2 a₂ = 4) (b₂ = 1 b₂ = 2 b₂ = 4) a₂ b₂(a₁, b₁) = (a₂, b₂) a₁:b₁:a₂:b₂:heq:(fun x => match x with | (a, b) => a - b) (a₁, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)h2:(a₂ = 1 a₂ = 2 a₂ = 4) (b₂ = 1 b₂ = 2 b₂ = 4) a₂ b₂ha1:a₁ = 1 a₁ = 2 a₁ = 4hb1:b₁ = 1 b₁ = 2 b₁ = 4hne1:a₁ b₁(a₁, b₁) = (a₂, b₂); a₁:b₁:a₂:b₂:heq:(fun x => match x with | (a, b) => a - b) (a₁, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)ha1:a₁ = 1 a₁ = 2 a₁ = 4hb1:b₁ = 1 b₁ = 2 b₁ = 4hne1:a₁ b₁ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂(a₁, b₁) = (a₂, b₂) b₁:a₂:b₂:hb1:b₁ = 1 b₁ = 2 b₁ = 4ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (1, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:1 b₁(1, b₁) = (a₂, b₂)b₁:a₂:b₂:hb1:b₁ = 1 b₁ = 2 b₁ = 4ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (2, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:2 b₁(2, b₁) = (a₂, b₂)b₁:a₂:b₂:hb1:b₁ = 1 b₁ = 2 b₁ = 4ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (4, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:4 b₁(4, b₁) = (a₂, b₂) b₁:a₂:b₂:hb1:b₁ = 1 b₁ = 2 b₁ = 4ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (1, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:1 b₁(1, b₁) = (a₂, b₂)b₁:a₂:b₂:hb1:b₁ = 1 b₁ = 2 b₁ = 4ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (2, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:2 b₁(2, b₁) = (a₂, b₂)b₁:a₂:b₂:hb1:b₁ = 1 b₁ = 2 b₁ = 4ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (4, b₁) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:4 b₁(4, b₁) = (a₂, b₂) a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:4 1(4, 1) = (a₂, b₂)a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:4 2(4, 2) = (a₂, b₂)a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:4 4(4, 4) = (a₂, b₂) a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:1 1(1, 1) = (a₂, b₂)a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:1 2(1, 2) = (a₂, b₂)a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:1 4(1, 4) = (a₂, b₂)a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:2 1(2, 1) = (a₂, b₂)a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:2 2(2, 2) = (a₂, b₂)a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:2 4(2, 4) = (a₂, b₂)a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:4 1(4, 1) = (a₂, b₂)a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:4 2(4, 2) = (a₂, b₂)a₂:b₂:ha2:a₂ = 1 a₂ = 2 a₂ = 4hb2:b₂ = 1 b₂ = 2 b₂ = 4hne2:a₂ b₂heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (a₂, b₂)hne1:4 4(4, 4) = (a₂, b₂) b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 4hne2:1 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (1, b₂)(4, 4) = (1, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 4hne2:2 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (2, b₂)(4, 4) = (2, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 4hne2:4 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (4, b₂)(4, 4) = (4, b₂) b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:1 1hne2:1 b₂heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (1, b₂)(1, 1) = (1, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:1 1hne2:2 b₂heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (2, b₂)(1, 1) = (2, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:1 1hne2:4 b₂heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (4, b₂)(1, 1) = (4, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:1 2hne2:1 b₂heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (1, b₂)(1, 2) = (1, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:1 2hne2:2 b₂heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (2, b₂)(1, 2) = (2, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:1 2hne2:4 b₂heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (4, b₂)(1, 2) = (4, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:1 4hne2:1 b₂heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (1, b₂)(1, 4) = (1, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:1 4hne2:2 b₂heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (2, b₂)(1, 4) = (2, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:1 4hne2:4 b₂heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (4, b₂)(1, 4) = (4, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:2 1hne2:1 b₂heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (1, b₂)(2, 1) = (1, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:2 1hne2:2 b₂heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (2, b₂)(2, 1) = (2, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:2 1hne2:4 b₂heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (4, b₂)(2, 1) = (4, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:2 2hne2:1 b₂heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (1, b₂)(2, 2) = (1, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:2 2hne2:2 b₂heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (2, b₂)(2, 2) = (2, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:2 2hne2:4 b₂heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (4, b₂)(2, 2) = (4, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:2 4hne2:1 b₂heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (1, b₂)(2, 4) = (1, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:2 4hne2:2 b₂heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (2, b₂)(2, 4) = (2, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:2 4hne2:4 b₂heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (4, b₂)(2, 4) = (4, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 1hne2:1 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (1, b₂)(4, 1) = (1, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 1hne2:2 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (2, b₂)(4, 1) = (2, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 1hne2:4 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (4, b₂)(4, 1) = (4, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 2hne2:1 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (1, b₂)(4, 2) = (1, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 2hne2:2 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (2, b₂)(4, 2) = (2, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 2hne2:4 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (4, b₂)(4, 2) = (4, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 4hne2:1 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (1, b₂)(4, 4) = (1, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 4hne2:2 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (2, b₂)(4, 4) = (2, b₂)b₂:hb2:b₂ = 1 b₂ = 2 b₂ = 4hne1:4 4hne2:4 b₂heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (4, b₂)(4, 4) = (4, b₂) hne1:4 4hne2:4 1heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (4, 1)(4, 4) = (4, 1)hne1:4 4hne2:4 2heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (4, 2)(4, 4) = (4, 2)hne1:4 4hne2:4 4heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (4, 4)(4, 4) = (4, 4) hne1:1 1hne2:1 1heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (1, 1)(1, 1) = (1, 1)hne1:1 1hne2:1 2heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (1, 2)(1, 1) = (1, 2)hne1:1 1hne2:1 4heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (1, 4)(1, 1) = (1, 4)hne1:1 1hne2:2 1heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (2, 1)(1, 1) = (2, 1)hne1:1 1hne2:2 2heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (2, 2)(1, 1) = (2, 2)hne1:1 1hne2:2 4heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (2, 4)(1, 1) = (2, 4)hne1:1 1hne2:4 1heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (4, 1)(1, 1) = (4, 1)hne1:1 1hne2:4 2heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (4, 2)(1, 1) = (4, 2)hne1:1 1hne2:4 4heq:(fun x => match x with | (a, b) => a - b) (1, 1) = (fun x => match x with | (a, b) => a - b) (4, 4)(1, 1) = (4, 4)hne1:1 2hne2:1 1heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (1, 1)(1, 2) = (1, 1)hne1:1 2hne2:1 2heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (1, 2)(1, 2) = (1, 2)hne1:1 2hne2:1 4heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (1, 4)(1, 2) = (1, 4)hne1:1 2hne2:2 1heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (2, 1)(1, 2) = (2, 1)hne1:1 2hne2:2 2heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (2, 2)(1, 2) = (2, 2)hne1:1 2hne2:2 4heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (2, 4)(1, 2) = (2, 4)hne1:1 2hne2:4 1heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (4, 1)(1, 2) = (4, 1)hne1:1 2hne2:4 2heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (4, 2)(1, 2) = (4, 2)hne1:1 2hne2:4 4heq:(fun x => match x with | (a, b) => a - b) (1, 2) = (fun x => match x with | (a, b) => a - b) (4, 4)(1, 2) = (4, 4)hne1:1 4hne2:1 1heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (1, 1)(1, 4) = (1, 1)hne1:1 4hne2:1 2heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (1, 2)(1, 4) = (1, 2)hne1:1 4hne2:1 4heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (1, 4)(1, 4) = (1, 4)hne1:1 4hne2:2 1heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (2, 1)(1, 4) = (2, 1)hne1:1 4hne2:2 2heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (2, 2)(1, 4) = (2, 2)hne1:1 4hne2:2 4heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (2, 4)(1, 4) = (2, 4)hne1:1 4hne2:4 1heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (4, 1)(1, 4) = (4, 1)hne1:1 4hne2:4 2heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (4, 2)(1, 4) = (4, 2)hne1:1 4hne2:4 4heq:(fun x => match x with | (a, b) => a - b) (1, 4) = (fun x => match x with | (a, b) => a - b) (4, 4)(1, 4) = (4, 4)hne1:2 1hne2:1 1heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (1, 1)(2, 1) = (1, 1)hne1:2 1hne2:1 2heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (1, 2)(2, 1) = (1, 2)hne1:2 1hne2:1 4heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (1, 4)(2, 1) = (1, 4)hne1:2 1hne2:2 1heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (2, 1)(2, 1) = (2, 1)hne1:2 1hne2:2 2heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (2, 2)(2, 1) = (2, 2)hne1:2 1hne2:2 4heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (2, 4)(2, 1) = (2, 4)hne1:2 1hne2:4 1heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (4, 1)(2, 1) = (4, 1)hne1:2 1hne2:4 2heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (4, 2)(2, 1) = (4, 2)hne1:2 1hne2:4 4heq:(fun x => match x with | (a, b) => a - b) (2, 1) = (fun x => match x with | (a, b) => a - b) (4, 4)(2, 1) = (4, 4)hne1:2 2hne2:1 1heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (1, 1)(2, 2) = (1, 1)hne1:2 2hne2:1 2heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (1, 2)(2, 2) = (1, 2)hne1:2 2hne2:1 4heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (1, 4)(2, 2) = (1, 4)hne1:2 2hne2:2 1heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (2, 1)(2, 2) = (2, 1)hne1:2 2hne2:2 2heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (2, 2)(2, 2) = (2, 2)hne1:2 2hne2:2 4heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (2, 4)(2, 2) = (2, 4)hne1:2 2hne2:4 1heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (4, 1)(2, 2) = (4, 1)hne1:2 2hne2:4 2heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (4, 2)(2, 2) = (4, 2)hne1:2 2hne2:4 4heq:(fun x => match x with | (a, b) => a - b) (2, 2) = (fun x => match x with | (a, b) => a - b) (4, 4)(2, 2) = (4, 4)hne1:2 4hne2:1 1heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (1, 1)(2, 4) = (1, 1)hne1:2 4hne2:1 2heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (1, 2)(2, 4) = (1, 2)hne1:2 4hne2:1 4heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (1, 4)(2, 4) = (1, 4)hne1:2 4hne2:2 1heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (2, 1)(2, 4) = (2, 1)hne1:2 4hne2:2 2heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (2, 2)(2, 4) = (2, 2)hne1:2 4hne2:2 4heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (2, 4)(2, 4) = (2, 4)hne1:2 4hne2:4 1heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (4, 1)(2, 4) = (4, 1)hne1:2 4hne2:4 2heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (4, 2)(2, 4) = (4, 2)hne1:2 4hne2:4 4heq:(fun x => match x with | (a, b) => a - b) (2, 4) = (fun x => match x with | (a, b) => a - b) (4, 4)(2, 4) = (4, 4)hne1:4 1hne2:1 1heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (1, 1)(4, 1) = (1, 1)hne1:4 1hne2:1 2heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (1, 2)(4, 1) = (1, 2)hne1:4 1hne2:1 4heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (1, 4)(4, 1) = (1, 4)hne1:4 1hne2:2 1heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (2, 1)(4, 1) = (2, 1)hne1:4 1hne2:2 2heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (2, 2)(4, 1) = (2, 2)hne1:4 1hne2:2 4heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (2, 4)(4, 1) = (2, 4)hne1:4 1hne2:4 1heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (4, 1)(4, 1) = (4, 1)hne1:4 1hne2:4 2heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (4, 2)(4, 1) = (4, 2)hne1:4 1hne2:4 4heq:(fun x => match x with | (a, b) => a - b) (4, 1) = (fun x => match x with | (a, b) => a - b) (4, 4)(4, 1) = (4, 4)hne1:4 2hne2:1 1heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (1, 1)(4, 2) = (1, 1)hne1:4 2hne2:1 2heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (1, 2)(4, 2) = (1, 2)hne1:4 2hne2:1 4heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (1, 4)(4, 2) = (1, 4)hne1:4 2hne2:2 1heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (2, 1)(4, 2) = (2, 1)hne1:4 2hne2:2 2heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (2, 2)(4, 2) = (2, 2)hne1:4 2hne2:2 4heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (2, 4)(4, 2) = (2, 4)hne1:4 2hne2:4 1heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (4, 1)(4, 2) = (4, 1)hne1:4 2hne2:4 2heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (4, 2)(4, 2) = (4, 2)hne1:4 2hne2:4 4heq:(fun x => match x with | (a, b) => a - b) (4, 2) = (fun x => match x with | (a, b) => a - b) (4, 4)(4, 2) = (4, 4)hne1:4 4hne2:1 1heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (1, 1)(4, 4) = (1, 1)hne1:4 4hne2:1 2heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (1, 2)(4, 4) = (1, 2)hne1:4 4hne2:1 4heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (1, 4)(4, 4) = (1, 4)hne1:4 4hne2:2 1heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (2, 1)(4, 4) = (2, 1)hne1:4 4hne2:2 2heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (2, 2)(4, 4) = (2, 2)hne1:4 4hne2:2 4heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (2, 4)(4, 4) = (2, 4)hne1:4 4hne2:4 1heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (4, 1)(4, 4) = (4, 1)hne1:4 4hne2:4 2heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (4, 2)(4, 4) = (4, 2)hne1:4 4hne2:4 4heq:(fun x => match x with | (a, b) => a - b) (4, 4) = (fun x => match x with | (a, b) => a - b) (4, 4)(4, 4) = (4, 4) All goals completed! 🐙 SurjOn (fun x => match x with | (a, b) => a - b) {1, 2, 4}.offDiag {x | x 0} intro x x:ZMod 7hx:x {x | x 0}x (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiag x:ZMod 7hx:x 0x (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiag hx:(fun i => i) 0, 0(fun i => i) 0, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiaghx:(fun i => i) 1, 0(fun i => i) 1, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiaghx:(fun i => i) 2, 0(fun i => i) 2, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiaghx:(fun i => i) 3, 0(fun i => i) 3, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiaghx:(fun i => i) 4, 0(fun i => i) 4, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiaghx:(fun i => i) 5, 0(fun i => i) 5, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiaghx:(fun i => i) 6, 0(fun i => i) 6, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiag hx:(fun i => i) 0, 0(fun i => i) 0, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiag All goals completed! 🐙 hx:(fun i => i) 1, 0(fun i => i) 1, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiag refine (2, 1), hx:(fun i => i) 1, 0(2, 1) {1, 2, 4}.offDiag All goals completed! 🐙, hx:(fun i => i) 1, 0(fun x => match x with | (a, b) => a - b) (2, 1) = (fun i => i) 1, All goals completed! 🐙 hx:(fun i => i) 2, 0(fun i => i) 2, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiag refine (4, 2), hx:(fun i => i) 2, 0(4, 2) {1, 2, 4}.offDiag All goals completed! 🐙, hx:(fun i => i) 2, 0(fun x => match x with | (a, b) => a - b) (4, 2) = (fun i => i) 2, All goals completed! 🐙 hx:(fun i => i) 3, 0(fun i => i) 3, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiag refine (4, 1), hx:(fun i => i) 3, 0(4, 1) {1, 2, 4}.offDiag All goals completed! 🐙, hx:(fun i => i) 3, 0(fun x => match x with | (a, b) => a - b) (4, 1) = (fun i => i) 3, All goals completed! 🐙 hx:(fun i => i) 4, 0(fun i => i) 4, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiag refine (1, 4), hx:(fun i => i) 4, 0(1, 4) {1, 2, 4}.offDiag All goals completed! 🐙, hx:(fun i => i) 4, 0(fun x => match x with | (a, b) => a - b) (1, 4) = (fun i => i) 4, All goals completed! 🐙 hx:(fun i => i) 5, 0(fun i => i) 5, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiag refine (2, 4), hx:(fun i => i) 5, 0(2, 4) {1, 2, 4}.offDiag All goals completed! 🐙, hx:(fun i => i) 5, 0(fun x => match x with | (a, b) => a - b) (2, 4) = (fun i => i) 5, All goals completed! 🐙 hx:(fun i => i) 6, 0(fun i => i) 6, (fun x => match x with | (a, b) => a - b) '' {1, 2, 4}.offDiag refine (1, 2), hx:(fun i => i) 6, 0(1, 2) {1, 2, 4}.offDiag All goals completed! 🐙, hx:(fun i => i) 6, 0(fun x => match x with | (a, b) => a - b) (1, 2) = (fun i => i) 6, All goals completed! 🐙

For small Sidon sets, we can check the conjecture directly.

@[category textbook, AMS 5 11] theorem declaration uses 'sorry'erdos_707.variants.small_sidon_sets (A : Set ) (hA : A.Finite) (h : A.ncard 3) (hSidon : IsSidon A) : (B : Set ) (p : ), IsPrimePow p A B IsPerfectDifferenceSet B (p^2 + p + 1) := A:Set hA:A.Finiteh:A.ncard 3hSidon:IsSidon A B p, IsPrimePow p A B IsPerfectDifferenceSet B (p ^ 2 + p + 1) All goals completed! 🐙 end Erdos707