Skip to content
Snippets Groups Projects

Multiset set notation

Closed Robbert Krebbers requested to merge robbert/multiset_singleton into master

This MR adds a notation {[ x1 ;+ .. ;+ xn ]} for {{ x1 ]} ⊎ .. ⊎ {{ xn ]}.

Todo:

  • bikeshed about notation
  • port tests in !231 (merged) to new notation

Fixes #100 (closed)

Edited by Robbert Krebbers

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
866 866 (union .. (union (singleton x) (singleton y)) .. (singleton z))
867 867 (at level 1) : stdpp_scope.
868 868
869 Notation "{[ x ;+ y ;+ .. ;+ z ]}" :=
  • We asked on Mattermost, and the opinions were:

    • @lepigre Use {[+ x1 ; .. ; xn +]}.
    • @robbertkrebbers: Problem: what about the singleton, then there's both {[ x ]} and {[+ x +]} which parse to the same term, namely singleton x. Pretty printing will then always give {[ x ]}.
    • @lepigre / @Blaisorblade: Use special type class for multiset singleton.

    We already have SingletonM for maps, so we could have SingletonMS for sets. Then there would be no longer a Singleton instance for multisets, making {[ x1; ...; xn ]} on multisets no longer type check.

    Not having Singleton for multisets, also has the consequence that we can no longer have Set_ instances for multisets, which "fixes" #98 (closed) and #87 (closed).

  • Not having Singleton for multisets, also has the consequence that we can no longer have Set_ instances for multisets, which "fixes" #98 (closed) and #87 (closed).

    It certainly doesn't fix #98 (closed) since we'd still not have a lemma for x ∈ X ∩ Y ↔ x ∈ X ∧ x ∈ Y... that issue says that currently Set_ is already not satisfied for multisets so in fact I am confused by your statement saying "no longer".

    making {[ x1; ...; xn ]} on multisets no longer type check

    That sounds good, actually -- it prevents people from accidentally using the wrong notation.

  • It certainly doesn't fix #98 (closed) since we'd still not have a lemma for x ∈ X ∩ Y ↔ x ∈ X ∧ x ∈ Y... that issue says that currently Set_ is already not satisfied for multisets so in fact I am confused by your statement saying "no longer".

    Oh, I meant no longer have SemiSet. This "fixes" it in the way that we consistently have no overloaded set lemmas for multisets. This might be a good thing, since the ones from sets give you the wrong ⊆ (if that appears in the statement).

  • It also means we need to have multiset copies of all of these lemmas.

  • I don't think that's a big problem. The majority of the lemmas in sets.v have to do with set inclusion (⊆, ⊂) or set equality (≡), both of which are the wrong notion for multisets (#87 (closed)). There aren't that many lemmas that just involve ∈, especially if you exclude those that involve ∩ or ∖, which currently do not work for multisets either (#98 (closed)).

  • Fair.

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading