Skip to content

Commit 2fecb3c

Browse files
committed
refactor(NumberTheory): golf Mathlib/NumberTheory/LegendreSymbol/GaussEisensteinLemmas (#38402)
- golfs `GaussEisensteinLemmas` by replacing a manual `prod_bij_ne_one` argument with `Finset.prod_ite` - closes the resulting product identity directly with `simp` Extracted from #38144 [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)
1 parent fdc4666 commit 2fecb3c

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

Mathlib/NumberTheory/LegendreSymbol/GaussEisensteinLemmas.lean

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,8 @@ private theorem gauss_lemma_aux₁ (p : ℕ) [Fact p.Prime] {a : ℤ} (hap : (a
7474
split_ifs <;> simp)
7575
_ = (-1 : ZMod p) ^ #{x ∈ Ico 1 (p / 2).succ | ¬(a * x.cast : ZMod p).val ≤ p / 2} *
7676
∏ x ∈ Ico 1 (p / 2).succ, ↑((a * x : ZMod p).valMinAbs.natAbs) := by
77-
have :
78-
(∏ x ∈ Ico 1 (p / 2).succ, if (a * x : ZMod p).val ≤ p / 2 then (1 : ZMod p) else -1) =
79-
∏ x ∈ Ico 1 (p / 2).succ with ¬(a * x.cast : ZMod p).val ≤ p / 2, -1 :=
80-
prod_bij_ne_one (fun x _ _ => x)
81-
(fun x => by split_ifs <;> (dsimp; simp_all))
82-
(fun _ _ _ _ _ _ => id) (fun b h _ => ⟨b, by simp_all [-not_le]⟩)
83-
(by intros; split_ifs at * <;> simp_all)
84-
rw [prod_mul_distrib, this, prod_const]
77+
rw [prod_mul_distrib, Finset.prod_ite]
78+
simp
8579
_ = (-1 : ZMod p) ^ #{x ∈ Ico 1 (p / 2).succ | ¬(a * x.cast : ZMod p).val ≤ p / 2} *
8680
(p / 2)! := by
8781
rw [← prod_natCast, Finset.prod_eq_multiset_prod,

0 commit comments

Comments
 (0)