@@ -576,7 +576,7 @@ calc sign f = sign (@subtype_perm _ f (λ x, f x ≠ x) (by simp)) :
576
576
577
577
def is_cycle (f : perm β) := ∃ x, f x ≠ x ∧ ∀ y, f y ≠ y → ∃ i : ℤ, (f ^ i) x = y
578
578
579
- lemma is_cycle_swap {x y : α} (hxy : x ≠ y) : is_cycle (swap x y) :=
579
+ lemma is_cycle_swap {α : Type *} [decidable_eq α] { x y : α} (hxy : x ≠ y) : is_cycle (swap x y) :=
580
580
⟨y, by rwa swap_apply_right,
581
581
λ a (ha : ite (a = x) y (ite (a = y) x a) ≠ a),
582
582
if hya : y = a then ⟨0 , hya⟩
@@ -595,7 +595,7 @@ let ⟨a, ha⟩ := hg.2 x hx in
595
595
let ⟨b, hb⟩ := hg.2 y hy in
596
596
⟨b - a, by rw [← ha, ← mul_apply, ← gpow_add, sub_add_cancel, hb]⟩
597
597
598
- lemma is_cycle_swap_mul_aux₁ : ∀ (n : ℕ) {b x : α} {f : perm α}
598
+ lemma is_cycle_swap_mul_aux₁ {α : Type *} [decidable_eq α] : ∀ (n : ℕ) {b x : α} {f : perm α}
599
599
(hb : (swap x (f x) * f) b ≠ b) (h : (f ^ n) (f x) = b),
600
600
∃ i : ℤ, ((swap x (f x) * f) ^ i) (f x) = b
601
601
| 0 := λ b x f hb h, ⟨0 , h⟩
@@ -614,7 +614,7 @@ lemma is_cycle_swap_mul_aux₁ : ∀ (n : ℕ) {b x : α} {f : perm α}
614
614
⟨i + 1 , by rw [add_comm, gpow_add, mul_apply, hi, gpow_one, mul_apply, apply_inv_self,
615
615
swap_apply_of_ne_of_ne (ne_and_ne_of_swap_mul_apply_ne_self hb).2 (ne.symm hfbx)]⟩
616
616
617
- lemma is_cycle_swap_mul_aux₂ : ∀ (n : ℤ) {b x : α} {f : perm α}
617
+ lemma is_cycle_swap_mul_aux₂ {α : Type *} [decidable_eq α] : ∀ (n : ℤ) {b x : α} {f : perm α}
618
618
(hb : (swap x (f x) * f) b ≠ b) (h : (f ^ n) (f x) = b),
619
619
∃ i : ℤ, ((swap x (f x) * f) ^ i) (f x) = b
620
620
| (n : ℕ) := λ b x f, is_cycle_swap_mul_aux₁ n
@@ -636,7 +636,8 @@ lemma is_cycle_swap_mul_aux₂ : ∀ (n : ℤ) {b x : α} {f : perm α}
636
636
mul_inv_rev, swap_inv, mul_swap_eq_swap_mul, inv_apply_self, swap_comm _ x, gpow_add, gpow_one,
637
637
mul_apply, mul_apply (_ ^ i), h, hi, mul_apply, apply_inv_self, swap_apply_of_ne_of_ne this.2 (ne.symm hfbx')]⟩
638
638
639
- lemma eq_swap_of_is_cycle_of_apply_apply_eq_self {f : perm α} (hf : is_cycle f) {x : α}
639
+ lemma eq_swap_of_is_cycle_of_apply_apply_eq_self {α : Type *} [decidable_eq α]
640
+ {f : perm α} (hf : is_cycle f) {x : α}
640
641
(hfx : f x ≠ x) (hffx : f (f x) = x) : f = swap x (f x) :=
641
642
equiv.ext $ λ y,
642
643
let ⟨z, hz⟩ := hf in
@@ -653,7 +654,7 @@ else begin
653
654
{ rw [← hj, hji] at hfyx, cc }
654
655
end
655
656
656
- lemma is_cycle_swap_mul {f : perm α} (hf : is_cycle f) {x : α}
657
+ lemma is_cycle_swap_mul {α : Type *} [decidable_eq α] { f : perm α} (hf : is_cycle f) {x : α}
657
658
(hx : f x ≠ x) (hffx : f (f x) ≠ x) : is_cycle (swap x (f x) * f) :=
658
659
⟨f x, by simp only [swap_apply_def, mul_apply];
659
660
split_ifs; simp [injective.eq_iff f.injective] at *; cc,
@@ -664,14 +665,14 @@ lemma is_cycle_swap_mul {f : perm α} (hf : is_cycle f) {x : α}
664
665
... = y : by rwa [← gpow_add, sub_add_cancel],
665
666
is_cycle_swap_mul_aux₂ (i - 1 ) hy hi⟩
666
667
667
- @[simp] lemma support_swap [fintype α] {x y : α} (hxy : x ≠ y) : (swap x y).support = {x, y} :=
668
+ @[simp] lemma support_swap {x y : α} (hxy : x ≠ y) : (swap x y).support = {x, y} :=
668
669
finset.ext $ λ a, by simp [swap_apply_def]; split_ifs; cc
669
670
670
- lemma card_support_swap [fintype α] {x y : α} (hxy : x ≠ y) : (swap x y).support.card = 2 :=
671
+ lemma card_support_swap {x y : α} (hxy : x ≠ y) : (swap x y).support.card = 2 :=
671
672
show (swap x y).support.card = finset.card ⟨x::y::0 , by simp [hxy]⟩,
672
673
from congr_arg card $ by rw [support_swap hxy]; simp [*, finset.ext_iff]; cc
673
674
674
- lemma sign_cycle [fintype α] : ∀ {f : perm α} (hf : is_cycle f),
675
+ lemma sign_cycle : ∀ {f : perm α} (hf : is_cycle f),
675
676
sign f = -(-1 ) ^ f.support.card
676
677
| f := λ hf,
677
678
let ⟨x, hx⟩ := hf in
@@ -698,6 +699,72 @@ calc sign f = sign (swap x (f x) * (swap x (f x) * f)) :
698
699
pow_one, units.neg_mul_neg]
699
700
using_well_founded {rel_tac := λ _ _, `[exact ⟨_, measure_wf (λ f, f.support.card)⟩]}
700
701
702
+ /-- If we apply `prod_extend_right a (σ a)` for all `a : α` in turn,
703
+ we get `prod_congr_right σ`. -/
704
+ lemma prod_prod_extend_right {α : Type *} [decidable_eq α] (σ : α → perm β)
705
+ {l : list α} (hl : l.nodup) (mem_l : ∀ a, a ∈ l) :
706
+ (l.map (λ a, prod_extend_right a (σ a))).prod = prod_congr_right σ :=
707
+ begin
708
+ ext ⟨a, b⟩ : 1 ,
709
+ -- We'll use induction on the list of elements,
710
+ -- but we have to keep track of whether we already passed `a` in the list.
711
+ suffices : (a ∈ l ∧ (l.map (λ a, prod_extend_right a (σ a))).prod (a, b) = (a, σ a b)) ∨
712
+ (a ∉ l ∧ (l.map (λ a, prod_extend_right a (σ a))).prod (a, b) = (a, b)),
713
+ { obtain ⟨_, prod_eq⟩ := or.resolve_right this (not_and.mpr (λ h _, h (mem_l a))),
714
+ rw [prod_eq, prod_congr_right_apply] },
715
+ clear mem_l,
716
+
717
+ induction l with a' l ih,
718
+ { refine or.inr ⟨list.not_mem_nil _, _⟩,
719
+ rw [list.map_nil, list.prod_nil, one_apply] },
720
+
721
+ rw [list.map_cons, list.prod_cons, mul_apply],
722
+ rcases ih (list.nodup_cons.mp hl).2 with ⟨mem_l, prod_eq⟩ | ⟨not_mem_l, prod_eq⟩; rw prod_eq,
723
+ { refine or.inl ⟨list.mem_cons_of_mem _ mem_l, _⟩,
724
+ rw prod_extend_right_apply_ne _ (λ (h : a = a'), (list.nodup_cons.mp hl).1 (h ▸ mem_l)) },
725
+ by_cases ha' : a = a',
726
+ { rw ← ha' at *,
727
+ refine or.inl ⟨l.mem_cons_self a, _⟩,
728
+ rw prod_extend_right_apply_eq },
729
+ { refine or.inr ⟨λ h, not_or ha' not_mem_l ((list.mem_cons_iff _ _ _).mp h), _⟩,
730
+ rw prod_extend_right_apply_ne _ ha' },
731
+ end
732
+
733
+ section
734
+
735
+ open_locale classical
736
+
737
+ lemma sign_prod_extend_right [fintype β] (a : α) (σ : perm β) :
738
+ (prod_extend_right a σ).sign = σ.sign :=
739
+ sign_bij (λ (ab : α × β) _, ab.snd)
740
+ (λ ⟨a', b⟩ hab hab', by simp [eq_of_prod_extend_right_ne hab])
741
+ (λ ⟨a₁, b₁⟩ ⟨a₂, b₂⟩ hab₁ hab₂ h,
742
+ by simpa [eq_of_prod_extend_right_ne hab₁, eq_of_prod_extend_right_ne hab₂] using h)
743
+ (λ y hy, ⟨(a, y), by simpa, by simp⟩)
744
+
745
+ lemma sign_prod_congr_right [fintype β] (σ : α → perm β) :
746
+ sign (prod_congr_right σ) = ∏ k, (σ k).sign :=
747
+ begin
748
+ obtain ⟨l, hl, mem_l⟩ := fintype.exists_univ_list α,
749
+ have l_to_finset : l.to_finset = finset.univ,
750
+ { apply eq_top_iff.mpr,
751
+ intros b _,
752
+ exact list.mem_to_finset.mpr (mem_l b) },
753
+ rw [← prod_prod_extend_right σ hl mem_l, sign.map_list_prod,
754
+ list.map_map, ← l_to_finset, list.prod_to_finset _ hl],
755
+ simp_rw ← λ a, sign_prod_extend_right a (σ a)
756
+ end
757
+
758
+ lemma sign_prod_congr_left [fintype β] (σ : α → perm β) :
759
+ sign (prod_congr_left σ) = ∏ k, (σ k).sign :=
760
+ begin
761
+ refine (sign_eq_sign_of_equiv _ _ (prod_comm β α) _).trans (sign_prod_congr_right σ),
762
+ rintro ⟨b, α⟩,
763
+ refl
764
+ end
765
+
766
+ end
767
+
701
768
end sign
702
769
703
770
end equiv.perm
0 commit comments