103
103
lemma mul_swap_eq_swap_mul (f : perm α) (x y : α) : f * swap x y = swap (f x) (f y) * f :=
104
104
by rw [swap_mul_eq_mul_swap, inv_apply_self, inv_apply_self]
105
105
106
+ @[simp] lemma swap_mul_self (i j : α) : equiv.swap i j * equiv.swap i j = 1 :=
107
+ equiv.swap_swap i j
108
+
109
+ @[simp] lemma swap_swap_apply (i j k : α) : equiv.swap i j (equiv.swap i j k) = k :=
110
+ equiv.swap_core_swap_core k i j
111
+
106
112
lemma is_swap_of_subtype {p : α → Prop } [decidable_pred p]
107
113
{f : perm (subtype p)} (h : is_swap f) : is_swap (of_subtype f) :=
108
114
let ⟨⟨x, hx⟩, ⟨y, hy⟩, hxy⟩ := h in
@@ -362,22 +368,34 @@ def sign [fintype α] (f : perm α) := sign_aux3 f mem_univ
362
368
instance sign.is_group_hom [fintype α] : is_group_hom (@sign α _ _) :=
363
369
⟨λ f g, (sign_aux3_mul_and_swap f g _ mem_univ).1 ⟩
364
370
365
- @[simp] lemma sign_mul [fintype α] (f g : perm α) : sign (f * g) = sign f * sign g :=
371
+ section sign
372
+
373
+ variable [fintype α]
374
+
375
+ @[simp] lemma sign_mul (f g : perm α) : sign (f * g) = sign f * sign g :=
366
376
is_group_hom.mul sign _ _
367
377
368
- @[simp] lemma sign_one [fintype α] : (sign (1 : perm α)) = 1 :=
378
+ @[simp] lemma sign_one : (sign (1 : perm α)) = 1 :=
369
379
is_group_hom.one sign
370
380
371
- @[simp] lemma sign_inv [fintype α] (f : perm α) : sign f⁻¹ = sign f :=
381
+ @[simp] lemma sign_refl : sign (equiv.refl α) = 1 :=
382
+ is_group_hom.one sign
383
+
384
+ @[simp] lemma sign_inv (f : perm α) : sign f⁻¹ = sign f :=
372
385
by rw [is_group_hom.inv sign, int.units_inv_eq_self]; apply_instance
373
386
374
- lemma sign_swap [fintype α] {x y : α} (h : x ≠ y) : sign (swap x y) = -1 :=
387
+ lemma sign_swap {x y : α} (h : x ≠ y) : sign (swap x y) = -1 :=
375
388
(sign_aux3_mul_and_swap 1 1 _ mem_univ).2 x y h
376
389
377
- lemma sign_eq_of_is_swap [fintype α] {f : perm α} (h : is_swap f) : sign f = -1 :=
390
+ @[simp] lemma sign_swap' {x y : α} :
391
+ (swap x y).sign = if x = y then 1 else -1 :=
392
+ if H : x = y then by simp [H, swap_self] else
393
+ by simp [sign_swap H, H]
394
+
395
+ lemma sign_eq_of_is_swap {f : perm α} (h : is_swap f) : sign f = -1 :=
378
396
let ⟨x, y, hxy⟩ := h in hxy.2 .symm ▸ sign_swap hxy.1
379
397
380
- lemma sign_aux3_symm_trans_trans [fintype α] [ decidable_eq β] [fintype β] (f : perm α)
398
+ lemma sign_aux3_symm_trans_trans [decidable_eq β] [fintype β] (f : perm α)
381
399
(e : α ≃ β) {s : multiset α} {t : multiset β} (hs : ∀ x, x ∈ s) (ht : ∀ x, x ∈ t) :
382
400
sign_aux3 ((e.symm.trans f).trans e) ht = sign_aux3 f hs :=
383
401
quotient.induction_on₂ t s
@@ -388,19 +406,19 @@ quotient.induction_on₂ t s
388
406
exact congr_arg sign_aux (equiv.ext _ _ (λ x, by simp)))
389
407
ht hs
390
408
391
- lemma sign_symm_trans_trans [fintype α] [ decidable_eq β] [fintype β] (f : perm α)
409
+ lemma sign_symm_trans_trans [decidable_eq β] [fintype β] (f : perm α)
392
410
(e : α ≃ β) : sign ((e.symm.trans f).trans e) = sign f :=
393
411
sign_aux3_symm_trans_trans f e mem_univ mem_univ
394
412
395
- lemma sign_prod_list_swap [fintype α] {l : list (perm α)}
413
+ lemma sign_prod_list_swap {l : list (perm α)}
396
414
(hl : ∀ g ∈ l, is_swap g) : sign l.prod = -1 ^ l.length :=
397
415
have h₁ : l.map sign = list.repeat (-1 ) l.length :=
398
416
list.eq_repeat.2 ⟨by simp, λ u hu,
399
417
let ⟨g, hg⟩ := list.mem_map.1 hu in
400
418
hg.2 ▸ sign_eq_of_is_swap (hl _ hg.1 )⟩,
401
419
by rw [← list.prod_repeat, ← h₁, ← is_group_hom.prod (@sign α _ _)]
402
420
403
- lemma eq_sign_of_surjective_hom [fintype α] {s : perm α → units ℤ}
421
+ lemma eq_sign_of_surjective_hom {s : perm α → units ℤ}
404
422
[is_group_hom s] (hs : surjective s) : s = sign :=
405
423
have ∀ {f}, is_swap f → s f = -1 :=
406
424
λ f ⟨x, y, hxy, hxy'⟩, hxy'.symm ▸ by_contradiction (λ h,
@@ -422,7 +440,7 @@ have hsl : ∀ a ∈ l.map s, a = (-1 : units ℤ) := λ a ha,
422
440
by rw [← hl₁, is_group_hom.prod s, list.eq_repeat'.2 hsl, list.length_map,
423
441
list.prod_repeat, sign_prod_list_swap hl₂]
424
442
425
- lemma sign_subtype_perm [fintype α] (f : perm α) {p : α → Prop } [decidable_pred p]
443
+ lemma sign_subtype_perm (f : perm α) {p : α → Prop } [decidable_pred p]
426
444
(h₁ : ∀ x, p x ↔ p (f x)) (h₂ : ∀ x, f x ≠ x → p x) : sign (subtype_perm f h₁) = sign f :=
427
445
let l := trunc.out (trunc_swap_factors (subtype_perm f h₁)) in
428
446
have hl' : ∀ g' ∈ l.1 .map of_subtype, is_swap g' :=
@@ -434,17 +452,17 @@ have hl'₂ : (l.1.map of_subtype).prod = f,
434
452
by conv {congr, rw ← l.2 .1 , skip, rw ← hl'₂};
435
453
rw [sign_prod_list_swap l.2 .2 , sign_prod_list_swap hl', list.length_map]
436
454
437
- @[simp] lemma sign_of_subtype [fintype α] {p : α → Prop } [decidable_pred p]
455
+ @[simp] lemma sign_of_subtype {p : α → Prop } [decidable_pred p]
438
456
(f : perm (subtype p)) : sign (of_subtype f) = sign f :=
439
457
have ∀ x, of_subtype f x ≠ x → p x, from λ x, not_imp_comm.1 (of_subtype_apply_of_not_mem f),
440
458
by conv {to_rhs, rw [← subtype_perm_of_subtype f, sign_subtype_perm _ _ this ]}
441
459
442
- lemma sign_eq_sign_of_equiv [fintype α] [ decidable_eq β] [fintype β] (f : perm α) (g : perm β)
460
+ lemma sign_eq_sign_of_equiv [decidable_eq β] [fintype β] (f : perm α) (g : perm β)
443
461
(e : α ≃ β) (h : ∀ x, e (f x) = g (e x)) : sign f = sign g :=
444
462
have hg : g = (e.symm.trans f).trans e, from equiv.ext _ _ $ by simp [h],
445
463
by rw [hg, sign_symm_trans_trans]
446
464
447
- lemma sign_bij [fintype α] [ decidable_eq β] [fintype β]
465
+ lemma sign_bij [decidable_eq β] [fintype β]
448
466
{f : perm α} {g : perm β} (i : Π x : α, f x ≠ x → β)
449
467
(h : ∀ x hx hx', i (f x) hx' = g (i x hx))
450
468
(hi : ∀ x₁ x₂ hx₁ hx₂, i x₁ hx₁ = i x₂ hx₂ → x₁ = x₂)
@@ -463,6 +481,8 @@ calc sign f = sign (@subtype_perm _ f (λ x, f x ≠ x) (by simp)) :
463
481
(λ ⟨x, _⟩, subtype.eq (h x _ _))
464
482
... = sign g : sign_subtype_perm _ _ (λ _, id)
465
483
484
+ end sign
485
+
466
486
lemma is_cycle_swap {x y : α} (hxy : x ≠ y) : is_cycle (swap x y) :=
467
487
⟨y, by rwa swap_apply_right,
468
488
λ a (ha : ite (a = x) y (ite (a = y) x a) ≠ a),
0 commit comments