Zulip Chat Archive

Stream: Is there code for X?

Topic: definition of a strict subset of a list


Paige Thomas (Mar 30 2025 at 05:35):

I was just wondering why there doesn't seem to be a definition for a list being a strict subset of another list?

Paige Thomas (Mar 30 2025 at 05:40):

That is, is it for math reasons?

Paige Thomas (Mar 30 2025 at 06:27):

I was thinking like

def List.SSubset
  {α : Type}
  (l₁ l₂ : List α) :
  Prop :=
  l₁  l₂  ¬ l₂  l₁

instance
  {α : Type}
  [DecidableEq α]
  (l₁ l₂ : List α) :
  Decidable (List.SSubset l₁ l₂) :=
  by
  unfold List.SSubset
  infer_instance

Ruben Van de Velde (Mar 30 2025 at 08:29):

What does a non-strict subset mean for lists?

Ruben Van de Velde (Mar 30 2025 at 08:30):

And possibly the answer is "nobody needed it enough yet"

Aaron Liu (Mar 30 2025 at 08:58):

l₁ ⊆ l₂ means l₁.toFinset ⊆ l₂.toFinset

Antoine Chambert-Loir (Mar 30 2025 at 09:00):

You don't care about repetitions?

Aaron Liu (Mar 30 2025 at 09:01):

That's what's in core

Aaron Liu (Mar 30 2025 at 09:02):

docs#List.instHasSubset

Mario Carneiro (Mar 30 2025 at 12:36):

The one that cares about repetitions is called "sublist", l₁ <+ l₂


Last updated: May 02 2025 at 03:31 UTC