Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit e1312b4

Browse files
ChrisHughes24digama0
authored andcommitted
feat(group_theory/perm): signatures of permutations (#231)
1 parent 251a8c3 commit e1312b4

File tree

8 files changed

+362
-4
lines changed

8 files changed

+362
-4
lines changed

algebra/big_operators.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,11 @@ section group
378378
open list
379379
variables [group α] [group β]
380380

381-
theorem is_group_hom.prod {f : α → β} [is_group_hom f] (l : list α) :
381+
theorem is_group_hom.prod (f : α → β) [is_group_hom f] (l : list α) :
382382
f (prod l) = prod (map f l) :=
383383
by induction l; simp [*, is_group_hom.mul f, is_group_hom.one f]
384384

385-
theorem is_group_anti_hom.prod {f : α → β} [is_group_anti_hom f] (l : list α) :
385+
theorem is_group_anti_hom.prod (f : α → β) [is_group_anti_hom f] (l : list α) :
386386
f (prod l) = prod (map f (reverse l)) :=
387387
by induction l; simp [*, is_group_anti_hom.mul f, is_group_anti_hom.one f]
388388

algebra/group.lean

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ by refine {mul := (*), one := 1, inv := has_inv.inv, ..};
247247
instance {α} [comm_monoid α] : comm_group (units α) :=
248248
{ mul_comm := λ u₁ u₂, ext $ mul_comm _ _, ..units.group }
249249

250+
instance [has_repr α] : has_repr (units α) := ⟨repr ∘ val⟩
251+
250252
@[simp] theorem mul_left_inj (a : units α) {b c : α} : (a:α) * b = a * c ↔ b = c :=
251253
⟨λ h, by simpa using congr_arg ((*) ↑(a⁻¹ : units α)) h, congr_arg _⟩
252254

@@ -576,6 +578,19 @@ end add_comm_group
576578

577579
variables {β : Type*} [group α] [group β]
578580

581+
def is_conj (a b : α) := ∃ c : α, c * a * c⁻¹ = b
582+
583+
@[refl] lemma is_conj_refl (a : α) : is_conj a a := ⟨1, by simp⟩
584+
585+
@[symm] lemma is_conj_symm (a b : α) : is_conj a b → is_conj b a
586+
| ⟨c, hc⟩ := ⟨c⁻¹, by simp [hc.symm, mul_assoc]⟩
587+
588+
@[trans] lemma is_conj_trans (a b c : α) : is_conj a b → is_conj b c → is_conj a c
589+
| ⟨c₁, hc₁⟩ ⟨c₂, hc₂⟩ := ⟨c₂ * c₁, by simp [hc₁.symm, hc₂.symm, mul_assoc]⟩
590+
591+
@[simp] lemma is_conj_iff_eq {α : Type*} [comm_group α] {a b : α} : is_conj a b ↔ a = b :=
592+
⟨λ ⟨c, hc⟩, by rw [← hc, mul_right_comm, mul_inv_self, one_mul], λ h, by rw h⟩
593+
579594
/-- Predicate for group homomorphism. -/
580595
class is_group_hom (f : α → β) : Prop :=
581596
(mul : ∀ a b : α, f (a * b) = f a * f b)
@@ -598,6 +613,9 @@ instance comp {γ} [group γ] (g : β → γ) [is_group_hom g] :
598613
g (f (x * y)) = g (f x * f y) : by rw mul f
599614
... = g (f x) * g (f y) : by rw mul g⟩
600615

616+
protected lemma is_conj (f : α → β) [is_group_hom f] {a b : α} : is_conj a b → is_conj (f a) (f b)
617+
| ⟨c, hc⟩ := ⟨f c, by rw [← is_group_hom.mul f, ← is_group_hom.inv f, ← is_group_hom.mul f, hc]⟩
618+
601619
end is_group_hom
602620

603621
/-- Predicate for group anti-homomorphism, or a homomorphism

data/equiv/basic.lean

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ rfl
8282
@[simp] theorem inverse_apply_apply : ∀ (e : α ≃ β) (x : α), e.symm (e x) = x
8383
| ⟨f₁, g₁, l₁, r₁⟩ x := by simp [equiv.symm]; rw l₁
8484

85-
@[simp] lemma inverse_trans_apply (f : α ≃ β) (g : β ≃ γ) (a : γ) :
85+
@[simp] lemma inverse_trans_apply (f : α ≃ β) (g : β ≃ γ) (a : γ) :
8686
(f.trans g).symm a = f.symm (g.symm a) := rfl
8787

8888
@[simp] theorem apply_eq_iff_eq : ∀ (f : α ≃ β) (x y : α), f x = f y ↔ x = y
@@ -98,6 +98,14 @@ theorem apply_eq_iff_eq_inverse_apply : ∀ (f : α ≃ β) (x : α) (y : β), f
9898

9999
@[simp] theorem symm_symm (e : α ≃ β) : e.symm.symm = e := by cases e; refl
100100

101+
@[simp] theorem trans_refl (e : α ≃ β) : e.trans (equiv.refl β) = e := by cases e; refl
102+
103+
@[simp] theorem refl_trans (e : α ≃ β) : (equiv.refl α).trans e = e := by cases e; refl
104+
105+
@[simp] theorem symm_trans (e : α ≃ β) : e.symm.trans e = equiv.refl β := ext _ _ (by simp)
106+
107+
@[simp] theorem trans_symm (e : α ≃ β) : e.trans e.symm = equiv.refl α := ext _ _ (by simp)
108+
101109
theorem left_inverse_symm (f : equiv α β) : left_inverse f.symm f := f.left_inv
102110

103111
theorem right_inverse_symm (f : equiv α β) : function.right_inverse f.symm f := f.right_inv
@@ -562,6 +570,18 @@ theorem swap_comp_apply {a b x : α} (π : perm α) :
562570
π.trans (swap a b) x = if π x = a then b else if π x = b then a else π x :=
563571
by cases π; refl
564572

573+
@[simp] lemma swap_inv {α : Type*} [decidable_eq α] (x y : α) :
574+
(swap x y)⁻¹ = swap x y := rfl
575+
576+
@[simp] lemma symm_trans_swap_trans [decidable_eq α] [decidable_eq β] (a b : α)
577+
(e : α ≃ β) : (e.symm.trans (swap a b)).trans e = swap (e a) (e b) :=
578+
equiv.ext _ _ (λ x, begin
579+
have : ∀ a, e.symm x = a ↔ x = e a :=
580+
λ a, by rw @eq_comm _ (e.symm x); split; intros; simp * at *,
581+
simp [swap_apply_def, this],
582+
split_ifs; simp
583+
end)
584+
565585
/-- Augment an equivalence with a prescribed mapping `f a = b` -/
566586
def set_value (f : α ≃ β) (a : α) (b : β) : α ≃ β :=
567587
(swap a (f.symm b)).trans f

data/fin.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ by cases j; simp [fin.pred]
2121
@[simp] protected lemma eta (a : fin n) (h : a.1 < n) : (⟨a.1, h⟩ : fin n) = a :=
2222
by cases a; refl
2323

24-
instance {n : ℕ} : linear_order (fin n) :=
24+
instance {n : ℕ} : decidable_linear_order (fin n) :=
2525
{ le_refl := λ a, @le_refl ℕ _ _,
2626
le_trans := λ a b c, @le_trans ℕ _ _ _ _,
2727
le_antisymm := λ a b ha hb, fin.eq_of_veq $ le_antisymm ha hb,
2828
le_total := λ a b, @le_total ℕ _ _ _,
2929
lt_iff_le_not_le := λ a b, @lt_iff_le_not_le ℕ _ _ _,
30+
decidable_le := fin.decidable_le,
3031
..fin.has_le,
3132
..fin.has_lt }
3233

data/finset.lean

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ instance : inhabited (finset α) := ⟨∅⟩
127127
theorem eq_empty_of_forall_not_mem {s : finset α} (H : ∀x, x ∉ s) : s = ∅ :=
128128
eq_of_veq (eq_zero_of_forall_not_mem H)
129129

130+
lemma eq_empty_iff_forall_not_mem {s : finset α} : s = ∅ ↔ ∀ x, x ∉ s :=
131+
⟨λ h, by simp [h], λ h, eq_empty_of_forall_not_mem h⟩
132+
130133
@[simp] theorem val_eq_zero {s : finset α} : s.1 = 0 ↔ s = ∅ := @val_inj _ s ∅
131134

132135
theorem subset_empty {s : finset α} : s ⊆ ∅ ↔ s = ∅ := subset_zero.trans val_eq_zero
@@ -1298,6 +1301,9 @@ sort_eq _ _
12981301
@[simp] theorem sort_to_finset [decidable_eq α] (s : finset α) : (sort r s).to_finset = s :=
12991302
list.to_finset_eq (sort_nodup r s) ▸ eq_of_veq (sort_eq r s)
13001303

1304+
@[simp] theorem mem_sort {s : finset α} {a : α} : a ∈ sort r s ↔ a ∈ s :=
1305+
multiset.mem_sort _
1306+
13011307
end sort
13021308

13031309
section disjoint
@@ -1362,6 +1368,17 @@ theorem sort_sorted_lt [decidable_linear_order α] (s : finset α) :
13621368

13631369
instance [has_repr α] : has_repr (finset α) := ⟨λ s, repr s.1
13641370

1371+
def attach_fin (s : finset ℕ) {n : ℕ} (h : ∀ m ∈ s, m < n) : finset (fin n) :=
1372+
⟨s.1.pmap (λ a ha, ⟨a, ha⟩) h, multiset.nodup_pmap (λ _ _ _ _, fin.mk.inj) s.2
1373+
1374+
@[simp] lemma mem_attach_fin {n : ℕ} {s : finset ℕ} (h : ∀ m ∈ s, m < n) {a : fin n} :
1375+
a ∈ s.attach_fin h ↔ a.1 ∈ s :=
1376+
⟨λ h, let ⟨b, hb₁, hb₂⟩ := multiset.mem_pmap.1 h in hb₂ ▸ hb₁,
1377+
λ h, multiset.mem_pmap.2 ⟨a.1, h, fin.eta _ _⟩⟩
1378+
1379+
@[simp] lemma card_attach_fin {n : ℕ} (s : finset ℕ) (h : ∀ m ∈ s, m < n) :
1380+
(s.attach_fin h).card = s.card := multiset.card_pmap _ _ _
1381+
13651382
end finset
13661383

13671384
namespace list

data/fintype.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ instance : fintype bool := ⟨⟨tt::ff::0, by simp⟩, λ x, by cases x; simp
179179

180180
@[simp] theorem fintype.univ_bool : @univ bool _ = {ff, tt} := rfl
181181

182+
instance units_int.fintype : fintype (units ℤ) :=
183+
⟨{1, -1}, λ x, by cases int.units_eq_one_or x; simp *⟩
184+
185+
@[simp] theorem fintype.card_units_int : fintype.card (units ℤ) = 2 := rfl
186+
182187
@[simp] theorem fintype.card_bool : fintype.card bool = 2 := rfl
183188

184189
def finset.insert_none (s : finset α) : finset (option α) :=

data/multiset.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,6 +2533,9 @@ quot.induction_on s $ λ l, sorted_merge_sort r _
25332533
@[simp] theorem sort_eq (s : multiset α) : ↑(sort r s) = s :=
25342534
quot.induction_on s $ λ l, quot.sound $ perm_merge_sort _ _
25352535

2536+
@[simp] theorem mem_sort {s : multiset α} {a : α} : a ∈ sort r s ↔ a ∈ s :=
2537+
by conv in (a ∈ s) {rw ← sort_eq r s}; simp [-sort_eq]
2538+
25362539
end sort
25372540

25382541
instance [has_repr α] : has_repr (multiset α) :=

0 commit comments

Comments
 (0)