@@ -38,14 +38,14 @@ namespace Equiv.Perm
38
38
39
39
section CycleOf
40
40
41
- variable [DecidableEq α] [Fintype α] {f g : Perm α} {x y : α}
41
+ variable {f g : Perm α} {x y : α} [DecidableRel f.SameCycle] [DecidableRel g.SameCycle]
42
42
43
43
/-- `f.cycleOf x` is the cycle of the permutation `f` to which `x` belongs. -/
44
- def cycleOf (f : Perm α) (x : α) : Perm α :=
44
+ def cycleOf (f : Perm α) [DecidableRel f.SameCycle] (x : α) : Perm α :=
45
45
ofSubtype (subtypePerm f fun _ => sameCycle_apply_right.symm : Perm { y // SameCycle f x y })
46
46
#align equiv.perm.cycle_of Equiv.Perm.cycleOf
47
47
48
- theorem cycleOf_apply (f : Perm α) (x y : α) :
48
+ theorem cycleOf_apply (f : Perm α) [DecidableRel f.SameCycle] (x y : α) :
49
49
cycleOf f x y = if SameCycle f x y then f y else y := by
50
50
dsimp only [cycleOf]
51
51
split_ifs with h
@@ -55,14 +55,16 @@ theorem cycleOf_apply (f : Perm α) (x y : α) :
55
55
exact h
56
56
#align equiv.perm.cycle_of_apply Equiv.Perm.cycleOf_apply
57
57
58
- theorem cycleOf_inv (f : Perm α) (x : α) : (cycleOf f x)⁻¹ = cycleOf f⁻¹ x :=
58
+ theorem cycleOf_inv (f : Perm α) [DecidableRel f.SameCycle] (x : α) :
59
+ (cycleOf f x)⁻¹ = cycleOf f⁻¹ x :=
59
60
Equiv.ext fun y => by
60
61
rw [inv_eq_iff_eq, cycleOf_apply, cycleOf_apply]
61
62
split_ifs <;> simp_all [sameCycle_inv, sameCycle_inv_apply_right]
62
63
#align equiv.perm.cycle_of_inv Equiv.Perm.cycleOf_inv
63
64
64
65
@[simp]
65
- theorem cycleOf_pow_apply_self (f : Perm α) (x : α) : ∀ n : ℕ, (cycleOf f x ^ n) x = (f ^ n) x := by
66
+ theorem cycleOf_pow_apply_self (f : Perm α) [DecidableRel f.SameCycle] (x : α) :
67
+ ∀ n : ℕ, (cycleOf f x ^ n) x = (f ^ n) x := by
66
68
intro n
67
69
induction' n with n hn
68
70
· rfl
@@ -71,7 +73,7 @@ theorem cycleOf_pow_apply_self (f : Perm α) (x : α) : ∀ n : ℕ, (cycleOf f
71
73
#align equiv.perm.cycle_of_pow_apply_self Equiv.Perm.cycleOf_pow_apply_self
72
74
73
75
@[simp]
74
- theorem cycleOf_zpow_apply_self (f : Perm α) (x : α) :
76
+ theorem cycleOf_zpow_apply_self (f : Perm α) [DecidableRel f.SameCycle] (x : α) :
75
77
∀ n : ℤ, (cycleOf f x ^ n) x = (f ^ n) x := by
76
78
intro z
77
79
induction' z with z hz
@@ -96,26 +98,27 @@ theorem SameCycle.cycleOf_eq (h : SameCycle f x y) : cycleOf f x = cycleOf f y :
96
98
#align equiv.perm.same_cycle.cycle_of_eq Equiv.Perm.SameCycle.cycleOf_eq
97
99
98
100
@[simp]
99
- theorem cycleOf_apply_apply_zpow_self (f : Perm α) (x : α) (k : ℤ) :
101
+ theorem cycleOf_apply_apply_zpow_self (f : Perm α) [DecidableRel f.SameCycle] (x : α) (k : ℤ) :
100
102
cycleOf f x ((f ^ k) x) = (f ^ (k + 1 ) : Perm α) x := by
101
103
rw [SameCycle.cycleOf_apply]
102
104
· rw [add_comm, zpow_add, zpow_one, mul_apply]
103
105
· exact ⟨k, rfl⟩
104
106
#align equiv.perm.cycle_of_apply_apply_zpow_self Equiv.Perm.cycleOf_apply_apply_zpow_self
105
107
106
108
@[simp]
107
- theorem cycleOf_apply_apply_pow_self (f : Perm α) (x : α) (k : ℕ) :
109
+ theorem cycleOf_apply_apply_pow_self (f : Perm α) [DecidableRel f.SameCycle] (x : α) (k : ℕ) :
108
110
cycleOf f x ((f ^ k) x) = (f ^ (k + 1 ) : Perm α) x := by
109
111
convert cycleOf_apply_apply_zpow_self f x k using 1
110
112
#align equiv.perm.cycle_of_apply_apply_pow_self Equiv.Perm.cycleOf_apply_apply_pow_self
111
113
112
114
@[simp]
113
- theorem cycleOf_apply_apply_self (f : Perm α) (x : α) : cycleOf f x (f x) = f (f x) := by
115
+ theorem cycleOf_apply_apply_self (f : Perm α) [DecidableRel f.SameCycle] (x : α) :
116
+ cycleOf f x (f x) = f (f x) := by
114
117
convert cycleOf_apply_apply_pow_self f x 1 using 1
115
118
#align equiv.perm.cycle_of_apply_apply_self Equiv.Perm.cycleOf_apply_apply_self
116
119
117
120
@[simp]
118
- theorem cycleOf_apply_self (f : Perm α) (x : α) : cycleOf f x x = f x :=
121
+ theorem cycleOf_apply_self (f : Perm α) [DecidableRel f.SameCycle] (x : α) : cycleOf f x x = f x :=
119
122
SameCycle.rfl.cycleOf_apply
120
123
#align equiv.perm.cycle_of_apply_self Equiv.Perm.cycleOf_apply_self
121
124
@@ -128,7 +131,7 @@ theorem IsCycle.cycleOf_eq (hf : IsCycle f) (hx : f x ≠ x) : cycleOf f x = f :
128
131
#align equiv.perm.is_cycle.cycle_of_eq Equiv.Perm.IsCycle.cycleOf_eq
129
132
130
133
@[simp]
131
- theorem cycleOf_eq_one_iff (f : Perm α) : cycleOf f x = 1 ↔ f x = x := by
134
+ theorem cycleOf_eq_one_iff (f : Perm α) [DecidableRel f.SameCycle] : cycleOf f x = 1 ↔ f x = x := by
132
135
simp_rw [ext_iff, cycleOf_apply, one_apply]
133
136
refine ⟨fun h => (if_pos (SameCycle.refl f x)).symm.trans (h x), fun h y => ?_⟩
134
137
by_cases hy : f y = y
@@ -137,32 +140,36 @@ theorem cycleOf_eq_one_iff (f : Perm α) : cycleOf f x = 1 ↔ f x = x := by
137
140
#align equiv.perm.cycle_of_eq_one_iff Equiv.Perm.cycleOf_eq_one_iff
138
141
139
142
@[simp]
140
- theorem cycleOf_self_apply (f : Perm α) (x : α) : cycleOf f (f x) = cycleOf f x :=
143
+ theorem cycleOf_self_apply (f : Perm α) [DecidableRel f.SameCycle] (x : α) :
144
+ cycleOf f (f x) = cycleOf f x :=
141
145
(sameCycle_apply_right.2 SameCycle.rfl).symm.cycleOf_eq
142
146
#align equiv.perm.cycle_of_self_apply Equiv.Perm.cycleOf_self_apply
143
147
144
148
@[simp]
145
- theorem cycleOf_self_apply_pow (f : Perm α) (n : ℕ) (x : α) : cycleOf f ((f ^ n) x) = cycleOf f x :=
149
+ theorem cycleOf_self_apply_pow (f : Perm α) [DecidableRel f.SameCycle] (n : ℕ) (x : α) :
150
+ cycleOf f ((f ^ n) x) = cycleOf f x :=
146
151
SameCycle.rfl.pow_left.cycleOf_eq
147
152
#align equiv.perm.cycle_of_self_apply_pow Equiv.Perm.cycleOf_self_apply_pow
148
153
149
154
@[simp]
150
- theorem cycleOf_self_apply_zpow (f : Perm α) (n : ℤ) (x : α) :
155
+ theorem cycleOf_self_apply_zpow (f : Perm α) [DecidableRel f.SameCycle] (n : ℤ) (x : α) :
151
156
cycleOf f ((f ^ n) x) = cycleOf f x :=
152
157
SameCycle.rfl.zpow_left.cycleOf_eq
153
158
#align equiv.perm.cycle_of_self_apply_zpow Equiv.Perm.cycleOf_self_apply_zpow
154
159
155
- protected theorem IsCycle.cycleOf (hf : IsCycle f) : cycleOf f x = if f x = x then 1 else f := by
160
+ protected theorem IsCycle.cycleOf [DecidableEq α] (hf : IsCycle f) :
161
+ cycleOf f x = if f x = x then 1 else f := by
156
162
by_cases hx : f x = x
157
163
· rwa [if_pos hx, cycleOf_eq_one_iff]
158
164
· rwa [if_neg hx, hf.cycleOf_eq]
159
165
#align equiv.perm.is_cycle.cycle_of Equiv.Perm.IsCycle.cycleOf
160
166
161
- theorem cycleOf_one (x : α) : cycleOf 1 x = 1 :=
162
- (cycleOf_eq_one_iff 1 ).mpr rfl
167
+ theorem cycleOf_one [DecidableRel ( 1 : Perm α).SameCycle] (x : α) :
168
+ cycleOf 1 x = 1 := (cycleOf_eq_one_iff 1 ).mpr rfl
163
169
#align equiv.perm.cycle_of_one Equiv.Perm.cycleOf_one
164
170
165
- theorem isCycle_cycleOf (f : Perm α) (hx : f x ≠ x) : IsCycle (cycleOf f x) :=
171
+ theorem isCycle_cycleOf (f : Perm α) [DecidableRel f.SameCycle] (hx : f x ≠ x) :
172
+ IsCycle (cycleOf f x) :=
166
173
have : cycleOf f x x ≠ x := by rwa [SameCycle.rfl.cycleOf_apply]
167
174
(isCycle_iff_sameCycle this).2 @fun y =>
168
175
⟨fun h => mt h.apply_eq_self_iff.2 this, fun h =>
@@ -175,29 +182,32 @@ theorem isCycle_cycleOf (f : Perm α) (hx : f x ≠ x) : IsCycle (cycleOf f x) :
175
182
#align equiv.perm.is_cycle_cycle_of Equiv.Perm.isCycle_cycleOf
176
183
177
184
@[simp]
178
- theorem two_le_card_support_cycleOf_iff : 2 ≤ card (cycleOf f x).support ↔ f x ≠ x := by
185
+ theorem two_le_card_support_cycleOf_iff [DecidableEq α] [Fintype α] :
186
+ 2 ≤ card (cycleOf f x).support ↔ f x ≠ x := by
179
187
refine ⟨fun h => ?_, fun h => by simpa using (isCycle_cycleOf _ h).two_le_card_support⟩
180
188
contrapose! h
181
189
rw [← cycleOf_eq_one_iff] at h
182
190
simp [h]
183
191
#align equiv.perm.two_le_card_support_cycle_of_iff Equiv.Perm.two_le_card_support_cycleOf_iff
184
192
185
- @[simp] lemma support_cycleOf_nonempty : (cycleOf f x).support.Nonempty ↔ f x ≠ x := by
193
+ @[simp] lemma support_cycleOf_nonempty [DecidableEq α] [Fintype α] :
194
+ (cycleOf f x).support.Nonempty ↔ f x ≠ x := by
186
195
rw [← two_le_card_support_cycleOf_iff, ← card_pos, ← Nat.succ_le_iff]
187
196
exact ⟨fun h => Or.resolve_left h.eq_or_lt (card_support_ne_one _).symm, zero_lt_two.trans_le⟩
188
197
#align equiv.perm.card_support_cycle_of_pos_iff Equiv.Perm.support_cycleOf_nonempty
189
198
190
199
@[deprecated support_cycleOf_nonempty (since := "2024-06-16")]
191
- theorem card_support_cycleOf_pos_iff : 0 < card (cycleOf f x).support ↔ f x ≠ x := by
200
+ theorem card_support_cycleOf_pos_iff [DecidableEq α] [Fintype α] :
201
+ 0 < card (cycleOf f x).support ↔ f x ≠ x := by
192
202
rw [card_pos, support_cycleOf_nonempty]
193
203
194
- theorem pow_mod_orderOf_cycleOf_apply (f : Perm α) (n : ℕ) (x : α) :
204
+ theorem pow_mod_orderOf_cycleOf_apply (f : Perm α) [DecidableRel f.SameCycle] (n : ℕ) (x : α) :
195
205
(f ^ (n % orderOf (cycleOf f x))) x = (f ^ n) x := by
196
206
rw [← cycleOf_pow_apply_self f, ← cycleOf_pow_apply_self f, pow_mod_orderOf]
197
207
#align equiv.perm.pow_apply_eq_pow_mod_order_of_cycle_of_apply Equiv.Perm.pow_mod_orderOf_cycleOf_apply
198
208
199
- theorem cycleOf_mul_of_apply_right_eq_self (h : Commute f g) (x : α) (hx : g x = x) :
200
- (f * g).cycleOf x = f.cycleOf x := by
209
+ theorem cycleOf_mul_of_apply_right_eq_self [DecidableRel (f * g).SameCycle]
210
+ (h : Commute f g) (x : α) (hx : g x = x) : ( f * g).cycleOf x = f.cycleOf x := by
201
211
ext y
202
212
by_cases hxy : (f * g).SameCycle x y
203
213
· obtain ⟨z, rfl⟩ := hxy
@@ -210,25 +220,29 @@ theorem cycleOf_mul_of_apply_right_eq_self (h : Commute f g) (x : α) (hx : g x
210
220
simp [h.mul_zpow, zpow_apply_eq_self_of_apply_eq_self hx]
211
221
#align equiv.perm.cycle_of_mul_of_apply_right_eq_self Equiv.Perm.cycleOf_mul_of_apply_right_eq_self
212
222
213
- theorem Disjoint.cycleOf_mul_distrib (h : f.Disjoint g) (x : α) :
223
+ theorem Disjoint.cycleOf_mul_distrib [DecidableRel (f * g).SameCycle]
224
+ [DecidableRel (g * f).SameCycle] (h : f.Disjoint g) (x : α) :
214
225
(f * g).cycleOf x = f.cycleOf x * g.cycleOf x := by
215
226
cases' (disjoint_iff_eq_or_eq.mp h) x with hfx hgx
216
227
· simp [h.commute.eq, cycleOf_mul_of_apply_right_eq_self h.symm.commute, hfx]
217
228
· simp [cycleOf_mul_of_apply_right_eq_self h.commute, hgx]
218
229
#align equiv.perm.disjoint.cycle_of_mul_distrib Equiv.Perm.Disjoint.cycleOf_mul_distrib
219
230
220
- theorem support_cycleOf_eq_nil_iff : (f.cycleOf x).support = ∅ ↔ x ∉ f.support := by simp
231
+ theorem support_cycleOf_eq_nil_iff [DecidableEq α] [Fintype α] :
232
+ (f.cycleOf x).support = ∅ ↔ x ∉ f.support := by simp
221
233
#align equiv.perm.support_cycle_of_eq_nil_iff Equiv.Perm.support_cycleOf_eq_nil_iff
222
234
223
- theorem support_cycleOf_le (f : Perm α) (x : α) : support (f.cycleOf x) ≤ support f := by
235
+ theorem support_cycleOf_le [DecidableEq α] [Fintype α] (f : Perm α) (x : α) :
236
+ support (f.cycleOf x) ≤ support f := by
224
237
intro y hy
225
238
rw [mem_support, cycleOf_apply] at hy
226
239
split_ifs at hy
227
240
· exact mem_support.mpr hy
228
241
· exact absurd rfl hy
229
242
#align equiv.perm.support_cycle_of_le Equiv.Perm.support_cycleOf_le
230
243
231
- theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
244
+ theorem mem_support_cycleOf_iff [DecidableEq α] [Fintype α] :
245
+ y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
232
246
by_cases hx : f x = x
233
247
· rw [(cycleOf_eq_one_iff _).mpr hx]
234
248
simp [hx]
@@ -241,31 +255,35 @@ theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x
241
255
· simpa [hx] using hy
242
256
#align equiv.perm.mem_support_cycle_of_iff Equiv.Perm.mem_support_cycleOf_iff
243
257
244
- theorem mem_support_cycleOf_iff' (hx : f x ≠ x) : y ∈ support (f.cycleOf x) ↔ SameCycle f x y := by
258
+ theorem mem_support_cycleOf_iff' (hx : f x ≠ x) [DecidableEq α] [Fintype α] :
259
+ y ∈ support (f.cycleOf x) ↔ SameCycle f x y := by
245
260
rw [mem_support_cycleOf_iff, and_iff_left (mem_support.2 hx)]
246
261
#align equiv.perm.mem_support_cycle_of_iff' Equiv.Perm.mem_support_cycleOf_iff'
247
262
248
- theorem SameCycle.mem_support_iff (h : SameCycle f x y) : x ∈ support f ↔ y ∈ support f :=
263
+ theorem SameCycle.mem_support_iff {f} [DecidableEq α] [Fintype α] (h : SameCycle f x y) :
264
+ x ∈ support f ↔ y ∈ support f :=
249
265
⟨fun hx => support_cycleOf_le f x (mem_support_cycleOf_iff.mpr ⟨h, hx⟩), fun hy =>
250
266
support_cycleOf_le f y (mem_support_cycleOf_iff.mpr ⟨h.symm, hy⟩)⟩
251
267
#align equiv.perm.same_cycle.mem_support_iff Equiv.Perm.SameCycle.mem_support_iff
252
268
253
- theorem pow_mod_card_support_cycleOf_self_apply (f : Perm α) (n : ℕ) (x : α) :
254
- (f ^ (n % (f.cycleOf x).support.card)) x = (f ^ n) x := by
269
+ theorem pow_mod_card_support_cycleOf_self_apply [DecidableEq α] [Fintype α]
270
+ (f : Perm α) (n : ℕ) (x : α) : (f ^ (n % (f.cycleOf x).support.card)) x = (f ^ n) x := by
255
271
by_cases hx : f x = x
256
272
· rw [pow_apply_eq_self_of_apply_eq_self hx, pow_apply_eq_self_of_apply_eq_self hx]
257
273
· rw [← cycleOf_pow_apply_self, ← cycleOf_pow_apply_self f, ← (isCycle_cycleOf f hx).orderOf,
258
274
pow_mod_orderOf]
259
275
#align equiv.perm.pow_mod_card_support_cycle_of_self_apply Equiv.Perm.pow_mod_card_support_cycleOf_self_apply
260
276
261
277
/-- `x` is in the support of `f` iff `Equiv.Perm.cycle_of f x` is a cycle. -/
262
- theorem isCycle_cycleOf_iff (f : Perm α) : IsCycle (cycleOf f x) ↔ f x ≠ x := by
278
+ theorem isCycle_cycleOf_iff (f : Perm α) [DecidableRel f.SameCycle] :
279
+ IsCycle (cycleOf f x) ↔ f x ≠ x := by
263
280
refine ⟨fun hx => ?_, f.isCycle_cycleOf⟩
264
281
rw [Ne, ← cycleOf_eq_one_iff f]
265
282
exact hx.ne_one
266
283
#align equiv.perm.is_cycle_cycle_of_iff Equiv.Perm.isCycle_cycleOf_iff
267
284
268
- theorem isCycleOn_support_cycleOf (f : Perm α) (x : α) : f.IsCycleOn (f.cycleOf x).support :=
285
+ theorem isCycleOn_support_cycleOf [DecidableEq α] [Fintype α] (f : Perm α) (x : α) :
286
+ f.IsCycleOn (f.cycleOf x).support :=
269
287
⟨f.bijOn <| by
270
288
refine fun _ ↦ ⟨fun h ↦ mem_support_cycleOf_iff.2 ?_, fun h ↦ mem_support_cycleOf_iff.2 ?_⟩
271
289
· exact ⟨sameCycle_apply_right.1 (mem_support_cycleOf_iff.1 h).1 ,
@@ -278,14 +296,14 @@ theorem isCycleOn_support_cycleOf (f : Perm α) (x : α) : f.IsCycleOn (f.cycleO
278
296
exact ha.1 .symm.trans hb.1 ⟩
279
297
#align equiv.perm.is_cycle_on_support_cycle_of Equiv.Perm.isCycleOn_support_cycleOf
280
298
281
- theorem SameCycle.exists_pow_eq_of_mem_support (h : SameCycle f x y) (hx : x ∈ f.support) :
282
- ∃ i < (f.cycleOf x).support.card, (f ^ i) x = y := by
299
+ theorem SameCycle.exists_pow_eq_of_mem_support {f} [DecidableEq α] [Fintype α] (h : SameCycle f x y)
300
+ (hx : x ∈ f.support) : ∃ i < (f.cycleOf x).support.card, (f ^ i) x = y := by
283
301
rw [mem_support] at hx
284
302
exact Equiv.Perm.IsCycleOn.exists_pow_eq (b := y) (f.isCycleOn_support_cycleOf x)
285
303
(by rw [mem_support_cycleOf_iff' hx]) (by rwa [mem_support_cycleOf_iff' hx])
286
304
#align equiv.perm.same_cycle.exists_pow_eq_of_mem_support Equiv.Perm.SameCycle.exists_pow_eq_of_mem_support
287
305
288
- theorem SameCycle.exists_pow_eq (f : Perm α) (h : SameCycle f x y) :
306
+ theorem SameCycle.exists_pow_eq [DecidableEq α] [Fintype α] (f : Perm α) (h : SameCycle f x y) :
289
307
∃ i : ℕ, 0 < i ∧ i ≤ (f.cycleOf x).support.card + 1 ∧ (f ^ i) x = y := by
290
308
by_cases hx : x ∈ f.support
291
309
· obtain ⟨k, hk, hk'⟩ := h.exists_pow_eq_of_mem_support hx
0 commit comments