Zulip Chat Archive

Stream: Is there code for X?

Topic: list equivalence relation


Martin Dvořák (Jul 20 2022 at 18:05):

I want to take an equivalence relation and apply it to a pair of lists. If the lists have different lengths, it should return false. If the lists have the same lengths, it should apply the binary relation pointwisely and return the conjunction of all outputs.

I want to have a lemma (instance) saying that the resulting relation on lists is again an equivalence relation. Is it in mathlib?

Eric Wieser (Jul 20 2022 at 18:28):

Is this docs#list.forall₂? (Edit: https://leanprover-community.github.io/mathlib_docs/data/list/defs.html#list.forall%E2%82%82)

Eric Wieser (Jul 20 2022 at 18:31):

Yeah, it's that

Kyle Miller (Jul 20 2022 at 18:32):

Here's where API for that goes: https://leanprover-community.github.io/mathlib_docs/data/list/forall2.html

Kyle Miller (Jul 20 2022 at 18:32):

Nothing about equivalence relations yet

Eric Wieser (Jul 20 2022 at 18:40):

We have the fact it's transitive and reflexive already

Violeta Hernández (Jul 20 2022 at 18:47):

Would a list.sublist_forall₂.is_equiv instance cause loops?

Violeta Hernández (Jul 20 2022 at 18:49):

Not too sure how typeclass inference works for these predicates made out of simpler ones

Eric Wieser (Jul 20 2022 at 19:07):

It ought to be fine

Violeta Hernández (Jul 20 2022 at 19:18):

Wait, is this really symmetric? Surely sublist_forall₂ r [] (a :: l) but not the other way around?

Eric Wieser (Jul 20 2022 at 19:45):

We weren't talking about sublist_forall₂, were we?

Violeta Hernández (Jul 20 2022 at 20:25):

oops


Last updated: Dec 20 2023 at 11:08 UTC