Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(*): small additions that prepare for Chevalley-Warning #2560

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/algebra/big_operators.lean
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,12 @@ lemma sum_flip [add_comm_monoid β] {n : ℕ} (f : ℕ → β) :
@prod_flip (multiplicative β) _ _ _
attribute [to_additive] prod_flip

@[norm_cast]
lemma sum_nat_cast [add_comm_monoid β] [has_one β] (s : finset α) (f : α → ℕ) :
↑(s.sum f) = s.sum (λa, f a : α → β) :=
(nat.cast_add_monoid_hom β).map_sum f s

@[norm_cast]
lemma prod_nat_cast [comm_semiring β] (s : finset α) (f : α → ℕ) :
↑(s.prod f) = s.prod (λa, f a : α → β) :=
(nat.cast_ring_hom β).map_prod f s
Expand Down Expand Up @@ -782,6 +784,11 @@ begin
{ simp only [mem_image], rintro ⟨⟨_, hm⟩, _, rfl⟩, exact ha hm } }
end

lemma sum_mul_sum {ι₁ : Type*} {ι₂ : Type*} (s₁ : finset ι₁) (s₂ : finset ι₂)
(f₁ : ι₁ → β) (f₂ : ι₂ → β) :
s₁.sum f₁ * s₂.sum f₂ = (s₁.product s₂).sum (λ p, f₁ p.1 * f₂ p.2) :=
by { rw [sum_product, sum_mul, sum_congr rfl], intros, rw mul_sum }

open_locale classical

/-- The product of `f a + g a` over all of `s` is the sum
Expand Down
3 changes: 3 additions & 0 deletions src/algebra/group_with_zero.lean
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ units.ext rfl
units.mk0 a ha = units.mk0 b hb ↔ a = b :=
⟨λ h, by injection h, λ h, units.ext h⟩

@[simp] lemma exists_iff_ne_zero (x : G₀) : (∃ u : units G₀, ↑u = x) ↔ x ≠ 0 :=
jcommelin marked this conversation as resolved.
Show resolved Hide resolved
⟨λ ⟨u, hu⟩, by { rw ← hu, exact unit_ne_zero u }, assume hx, ⟨mk0 x hx, rfl⟩⟩

end units

section group_with_zero
Expand Down
4 changes: 4 additions & 0 deletions src/data/fintype/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,10 @@ finset.card_powerset finset.univ
instance subtype.fintype (p : α → Prop) [decidable_pred p] [fintype α] : fintype {x // p x} :=
set_fintype _

@[simp] lemma set.to_finset_univ [fintype α] :
(set.univ : set α).to_finset = finset.univ :=
by { ext, simp only [set.mem_univ, mem_univ, set.mem_to_finset] }

theorem fintype.card_subtype_le [fintype α] (p : α → Prop) [decidable_pred p] :
fintype.card {x // p x} ≤ fintype.card α :=
by rw fintype.subtype_card; exact card_le_of_subset (subset_univ _)
Expand Down
16 changes: 16 additions & 0 deletions src/data/fintype/card.lean
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ namespace fintype
lemma card_eq_sum_ones {α} [fintype α] : fintype.card α = (finset.univ : finset α).sum (λ _, 1) :=
finset.card_eq_sum_ones _

section
open finset

variables {ι : Type*} [fintype ι] [decidable_eq ι]

@[to_additive]
lemma prod_extend_by_one [comm_monoid α] (s : finset ι) (f : ι → α) :
univ.prod (λ i, if i ∈ s then f i else 1) = s.prod f :=
jcommelin marked this conversation as resolved.
Show resolved Hide resolved
begin
rw [← prod_sdiff (subset_univ s), prod_eq_one, one_mul, prod_congr rfl],
{ intros i hi, exact dif_pos hi },
{ intros i hi, rw mem_sdiff at hi, exact dif_neg hi.2 }
end

end

end fintype

open finset
Expand Down
21 changes: 21 additions & 0 deletions src/group_theory/order_of_element.lean
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ dvd_antisymm
(by rwa [nat.div_mul_cancel (gcd_dvd_left _ _), mul_assoc,
nat.div_mul_cancel (gcd_dvd_right _ _), mul_comm])))

lemma image_range_order_of (a : α) :
finset.image (λ i, a ^ i) (finset.range (order_of a)) = (gpowers a).to_finset :=
by { ext x, rw [set.mem_to_finset, mem_gpowers_iff_mem_range_order_of] }

omit dec
open_locale classical

Expand Down Expand Up @@ -368,6 +372,23 @@ calc (univ.filter (λ a : α, a ^ n = 1)).card ≤ (gpowers (g ^ (fintype.card
exact le_of_dvd hn0 (gcd_dvd_left _ _)
end

section

variables [group α] [fintype α] [decidable_eq α]

lemma is_cyclic.image_range_order_of (ha : ∀ x : α, x ∈ gpowers a) :
bryangingechen marked this conversation as resolved.
Show resolved Hide resolved
finset.image (λ i, a ^ i) (range (order_of a)) = univ :=
begin
simp only [image_range_order_of, set.eq_univ_iff_forall.mpr ha],
convert set.to_finset_univ
end

lemma is_cyclic.image_range_card (ha : ∀ x : α, x ∈ gpowers a) :
finset.image (λ i, a ^ i) (range (fintype.card α)) = univ :=
by rw [← order_of_eq_card_of_forall_mem_gpowers ha, is_cyclic.image_range_order_of ha]

end

section totient

variables [group α] [fintype α] [decidable_eq α] (hn : ∀ n : ℕ, 0 < n → (univ.filter (λ a : α, a ^ n = 1)).card ≤ n)
Expand Down