Zulip Chat Archive

Stream: Is there code for X?

Topic: exists re-ordering of coordinates to make monotone?


David Renshaw (Mar 27 2024 at 14:08):

I'm struggling to find a nice way to prove this:

import Mathlib.Tactic

lemma can_sort (n : ) (a : Fin n  ) :
     p : Fin n  Fin n,
         i j, i  j  a (p i)  a (p j) := by
  sorry

Michael Stoll (Mar 27 2024 at 14:11):

docs#Tuple.sort (and API)?

David Renshaw (Mar 27 2024 at 14:16):

nice!

David Renshaw (Mar 27 2024 at 14:20):

This works:

lemma can_sort (n : ) (a : Fin n  ) :
     p : Fin n  Fin n,
         i j, i  j  a (p i)  a (p j) :=
  Tuple.sort a, fun _ _ hij  Tuple.monotone_sort a hij

David Renshaw (Mar 27 2024 at 14:21):

... and suggests that perhaps I should be reformulating my problem to use Equiv.Perm instead of Function.Embedding


Last updated: May 02 2025 at 03:31 UTC