-
Notifications
You must be signed in to change notification settings - Fork 298
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
feat(group_theory/perm/concrete_cycle): isomorphism between permutations and cycles #8226
Conversation
…union' into pechersky/more-perm-cycle
…sjoint" This reverts commit a2a427a.
…-prod-disjoint-union
Previously, both `support_pow_le` and `support_gpow_le` had the power as an `int`. Now we properly differentiate the two and avoid slow defeq checks.
🎉 Great news! Looks like all the dependencies have been resolved:
💡 To add or remove a dependency please update this issue/PR description. Brought to you by Dependent Issues (:robot: ). Happy coding! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some remarks on the overall structure. I haven't gone through concrete_cycle.lean
yet.
{ rw [to_list_eq_nil_iff.mpr hx, is_rotated_nil_iff', to_list_eq_nil_iff], | ||
obtain ⟨k, rfl⟩ := h, | ||
simpa using hx } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a good candidate for a separate lemma, along the lines of
lemma same_cycle.mem_support_iff {f : perm α} {x y : α} (h : same_cycle f x y) :
x ∈ support f ↔ y ∈ support f :=
sorry
{ obtain ⟨_ | k, hk, hy⟩ := h.nat_of_mem_support _ hx, | ||
{ simp only [coe_one, id.def, pow_zero] at hy, | ||
simp [hy] }, | ||
use k.succ, | ||
apply list.ext_le, | ||
{ simp only [length_rotate, length_to_list, ←hy], | ||
congr' 1, | ||
ext z, | ||
rw [mem_support, mem_support], | ||
by_cases hz : same_cycle f x z, | ||
{ rw [hz.cycle_of_apply, same_cycle.cycle_of_apply], | ||
simpa using hz }, | ||
{ rw [cycle_of_apply_of_not_same_cycle hz, cycle_of_apply_of_not_same_cycle], | ||
simpa using hz } }, | ||
{ intros n hn hn', | ||
suffices : (f ^ ((n + k.succ) % (f.cycle_of x).support.card)) x = | ||
(f ^ n) ((f ^ k.succ) x), | ||
{ simpa [nth_le_rotate, nth_le_to_list, ←hy], }, | ||
rw [←cycle_of_pow_apply_self, ←mul_apply, ←pow_add, ←cycle_of_pow_apply_self f, | ||
←order_of_is_cycle, ←pow_eq_mod_order_of], | ||
exact is_cycle_cycle_of _ (mem_support.mp hx) } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some good sublemmas to extract here:
f.to_list ((f ^ k) x) = (f.to_list x).rotate k
(f ^ (n % (f.cycle_of x).support.card)) x = (f ^ n) x
{ rw [cycle.mem_coe_iff, mem_to_list_iff], | ||
exact ⟨⟨1, by simp⟩, mem_support.mpr hx⟩ }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be extracted as a lemma f^n x ∈ f.to_list x ↔ x ∈ f.support
.
simp [cycle.form_perm_eq_form_perm_iff, (iff_not_comm.mp hs.nontrivial_iff), | ||
(iff_not_comm.mp hs'.nontrivial_iff), ht] } } | ||
|
||
-- why does the decidability of `cycle.nodup` fail otherwise? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this refers to?
By the way, >500 lines of additions really is a lot to do in one PR, especially when it introduces multiple |
Closed in favor #9470 |
In the following,
{α : Type*} [fintype α] [decidable_eq α]
.cycle.form_perm
: the cyclic permutation created by looping over acycle α
equiv.perm.to_list
: thelist
representation of the cycle generated byf : perm α
starting fromx : α
equiv.perm.to_cycle
: thecycle
representation of the cycle generated byf : perm α
wherehf : f.is_cycle
equiv.perm.iso_cycle
: the equivalence between cyclic permutationsf : perm α
and the terms of
cycle α
that correspond to themequiv.perm.iso_cycle'
: the same equivalence asequiv.perm.iso_cycle
but with faster evaluation via
#eval
c[1, 2, 3]
to emulate notation of cyclic permutations(1 2 3)
has_repr
instance for anyperm α
, by representing thefinset
ofcycle α
that correspond to the cycle factors.equiv.perm.is_cycle.exists_unique_cycle
: there is only one nontrivialcycle α
corresponding to each cyclic
f : perm α
A caveat:
Running
#eval
on even a simple noncyclic permutationc[(1 : fin 7), 2, 3] * c[0, 5]
to show it takes a long time. TODO: is this because computing the cycle factors is slow?