Zulip Chat Archive

Stream: Is there code for X?

Topic: Equivariant Functions


Jorge Medina (Jul 12 2022 at 20:38):

Hi, im new here (just downloaded LEAN last week), is there already a theorem or proof related to Equivariant functions?
this being f(g(x)) = g (f(x)). Maybe there's already a theorem about it but i haven't found it.

I want to see if i can check such a property given two functions they have such property.

Filippo A. E. Nuccio (Jul 12 2022 at 22:22):

Can you provide some #mwe with what you have in mind?

Jorge Medina (Jul 12 2022 at 22:57):

sure, something of the likes:

Sure!
something like this:

theorem Equivar (a : alfa) (h :alfa ->beta) (g : Type -> Type) : f(g(a)) =g (f (a)) :=
begin ...

--type of g, depends on whether its input is alfa o beta

so then if i define two functions, prove if they have such property
def blah : alfa -> beta := something
def bleh: type -> type := else

Eric Wieser (Jul 12 2022 at 23:16):

docs#function.commute?

Eric Wieser (Jul 12 2022 at 23:17):

Or possibly docs#function.semiconj, since it sounds like you're asking about two different gs

Jorge Medina (Jul 13 2022 at 00:03):

That looks just like it! Thank you!
one more question that occur to me would be, is it possible in Lean to show or prove if a particular set of functions have that property?
like:
example: fun1(fun2 x) = fun2(fun1 x) :=
like with a trivial example as:
def fun1 (x:R) := x
def fun2 (x:R):= x*0
is there tactics for that?

Eric Wieser (Jul 13 2022 at 05:36):

Can you write that as a #mwe with #backticks?

Jorge Medina (Jul 13 2022 at 12:27):

def foo (x:R):R := x
def boo (x:R) :R:= x * 0

theorem this_commutes : \all x:R , function.commute foo boo := foo boo x = boo foo x.

I think I just managed to prove it there but from my understanding of lean. To prove that two functions commute I need to be able to write f(b( x) = b (f (x)). And not write in reverse as:

def foo (x:R):R := x
def boo (x:R) :R:= x * 0

theorem this_commutes : \all x:R , foo boo x = boo foo x :=  function.commute foo boo

right? or are these two equivalent?

Yaël Dillies (Jul 13 2022 at 12:29):

Neither of those statements make sense. The first is saying that foo and boo commute for all x, but x isn't used anywhere! The second one is effectively the same as saying that is a natural.

Yaël Dillies (Jul 13 2022 at 12:30):

What you want is

theorem this_commutes : function.commute foo boo := λ x, sorry -- your proof here

Last updated: Dec 20 2023 at 11:08 UTC