Zulip Chat Archive

Stream: Is there code for X?

Topic: List.Chain' that fixes both ends


Paige Thomas (Sep 20 2024 at 15:56):

Does this already exist in Mathlib somewhere?

inductive Walk {α : Type} (R : α -> α -> Prop) : α -> List α -> α -> Prop
| one (a : α) : Walk R a [] a
| cons (a b c : α) (l : List α) : R a b -> Walk R b l c -> Walk R a (b :: l) c

Floris van Doorn (Sep 20 2024 at 15:58):

docs#SimpleGraph.Walk if your R is symmetric and irreflexive.

Floris van Doorn (Sep 20 2024 at 15:59):

docs#SimpleGraph.Walk.support gives the list.

Paige Thomas (Sep 20 2024 at 16:01):

Hmm. I see. Thank you.

Paige Thomas (Sep 20 2024 at 16:02):

Floris van Doorn said:

docs#SimpleGraph.Walk if your R is symmetric and irreflexive.

I'm not sure it is.

Yury G. Kudryashov (Sep 20 2024 at 17:09):

You can use List.Chain' R (a :: l ++ [b])

Paige Thomas (Sep 20 2024 at 18:41):

That makes sense. Thank you.


Last updated: May 02 2025 at 03:31 UTC