Zulip Chat Archive

Stream: Is there code for X?

Topic: Exists unique in list


Yakov Pechersky (May 09 2021 at 04:17):

Do we have a simple statement to state that a term that is in a list occurs only once in the list?

Adam Topaz (May 09 2021 at 04:25):

We must have something because of how finset is defined

Yakov Pechersky (May 09 2021 at 04:26):

nodup l says that every single element exists only once. I mean that condition, but only on a single element.

Adam Topaz (May 09 2021 at 04:27):

Ah list.nodup uses pairwise...

Adam Topaz (May 09 2021 at 04:27):

You can always filter the list with the prop =x and say something about the length of the result

Yakov Pechersky (May 09 2021 at 04:30):

Basically, there is a stronger statement than this:

lemma support_le_prod_of_me {l : list (perm α)} (h : f  l) (hl : l.pairwise disjoint) :
  f.support  l.prod.support :=
begin
  induction l with hd l IH,
  { simpa using h },
  { rw [list.prod_cons, (disjoint_prod_right _ _).support_mul],
    { rcases h with rfl|h,
      { exact subset_union_left _ _ },
      { exact subset.trans (IH h (list.pairwise_of_pairwise_cons hl)) (subset_union_right _ _) } },
    { intros g hg,
      exact list.rel_of_pairwise_cons hl hg } }
end

Yakov Pechersky (May 09 2021 at 04:30):

Where you don't have to have l.pairwise disjoint, just disjoint f g for all g \in l, as long as f \ne g and f is in the list only once.


Last updated: Dec 20 2023 at 11:08 UTC