Zulip Chat Archive
Stream: Is there code for X?
Topic: a chain related by `≤` and a chain related by `<`
Jujian Zhang (Apr 25 2023 at 16:20):
I think the following is true: given a list l : list X and an irreflexive relation relation r on X such that list.chain' (λ x y, r x y ∨ x = y) l, i.e. l is a chain related by r disjoint with equality, then l.destutter is a chain related by r? In another word, is there a code for the sorry below?
example {X : Type*} [decidable_eq X] (l : list X) (r : X → X → Prop)
[is_irrefl X r]
(hl : list.chain' (λ x y, r x y ∨ x = y) l) :
list.chain' r l.destutter := sorry
The mental model is taking r to be less than on integers, then l is , then removing duplication should give you a list .
Yaël Dillies (Apr 25 2023 at 16:35):
That looks like it should be easy by induction. But no I don't think we have it.
Yaël Dillies (Apr 25 2023 at 16:38):
Actually, your precise statement is wrong. If you replace dedup by destutter or assume transitivity of r, it becomes true again.
Eric Rodriguez (Apr 25 2023 at 16:40):
and destutter should have this lemma
Eric Rodriguez (Apr 25 2023 at 16:40):
Jujian Zhang (Apr 25 2023 at 16:47):
Yaël Dillies said:
Actually, your precise statement is wrong. If you replace
dedupbydestutteror assume transitivity ofr, it becomes true again.
Thanks for pointing out this, one of the application I need is that r being covby, so I can't assume transitivity of r, but destutter is a good idea!
Yaël Dillies (Apr 25 2023 at 18:07):
Ah I think what you really need is acyclicity, not transitivity.
Last updated: May 02 2025 at 03:31 UTC