Zulip Chat Archive

Stream: lean4

Topic: Abstractions for working with permutation


Zhuanhao Wu (Apr 07 2024 at 22:46):

Hi all, I'm wondering what I should use to reason about permutations of some T (that is also a Fintype, if needed), any suggestions would be appreciated.

I know I can probably use List T, but my problem with using List T is that doesn't really capture the fact that it is a permutation of elements of T (so it may not have all elements, it has duplication).
Similar issue with Finset T, where I don't have the order of elements embedded.
My question would be: What should I use in Mathlib to represent the permutation so that (1) I can operate on the actual permutation like a List T where I can take or swap elements, and (2) embed the property that it is indeed a permutation within the type.

Thanks!


Some context of what I'm trying to do:

  1. Have some way of representing permutations of (all) elements in T (currently I knew I can use List T)
  2. Define equivalence between two permutations based on some domain specific logic (so something like Equiv: List T -> List T -> Prop)
  3. Define a partial order on T, and measure the "unorderness" in a permutation (something like: f: List T -> Nat)
  4. Define operations that can transform one permutation to another (g: List T -> List T) that maintains equivalence and alter the "unorderness".
  5. Proving that for certain permutations, there exists an equivalent permutation with certain "unorderness".

Henrik BΓΆving (Apr 07 2024 at 22:52):

How about docs#List.Perm

πš πš˜πš“πšŒπš’πšŽπšŒπš‘ πš—πšŠπš πš›πš˜πšŒπš”πš’ (Apr 07 2024 at 23:03):

You could also consider the type of equivalences T ≃ T.

Mario Carneiro (Apr 07 2024 at 23:03):

which is docs#Equiv.Perm

Zhuanhao Wu (Apr 08 2024 at 01:58):

thanks! i will give it a try


Last updated: May 02 2025 at 03:31 UTC