Conversation
This adds a type for the symmetric square of a type, which is the quotient of the cartesian square by permutations. These are also known as unordered pairs. We provide some definitions and lemmas for equalities, functoriality, and a relationship between symmetric relations and terms of the symmetric square.
There was a problem hiding this comment.
Thank you for your pull request!
Do you have a particular use case for this file already? Generally you get a much better library if you work towards a particular goal, and add things that you need (and lemmas similar to those) than if you just start writing a library without a goal in mind.
For example, are mem and vmem both useful?
Incorporated suggestions from code review.
|
Thank you for reviewing my PR @fpvandoorn!
I hope this PR didn't look quite so aimless! This library came from some work dealing with graphs over the last few weeks, and I figured I would try a PR with this before attempting the rest. Some of the lemmas in this file, though, are purely for well-definedness/uniqueness purposes to prove the definition is good, in that I think they let you work with each definition without expanding them. The |
Added a mention that one of the key definitions is `sym2.from_rel`, which transforms a symmetric relation into set membership. Also added a lemma that is useful for simple graphs.
Also reformatted the lemma statement.
|
I just added documentation pointing to I also added a lemma I forgot to include, |
That's good! I also thought that this could be useful for graph theory.
That's indeed a good think to aim for!
Yeah, Btw, the linter complains that it wants you to add an instance
So for simple graphs isn't it easier to work with the type of unordered pairs where the two components are unequal (so the irreflexivity is built in)? |
To do this in a clean way, defined symmetric powers in general and an equivalence between two potential definitions (subtype of multisets, or quotient of vectors). The difference is whether the cardinality/length condition is outside or inside the quotient.
Ok, I'll look into that. I was going to ask how to deal with this linter warning.
I've found it to be really hard to say what's better than what when defining graphs, since people use them for all sorts of things (and as for me, I tend to use multigraphs exclusively, or sometimes simple graphs allowing loops). Perhaps it's worth defining a symmetric square with deleted diagonal, but at least |
And reorganized some of data.sym2 accordingly.
jcommelin
left a comment
There was a problem hiding this comment.
Looks good to me! Some minor stylistic issues, but I think after that this is ready for merging.
@fpvandoorn Do you have further comments?
|
✌️ kmill can now approve this pull request. To approve and merge a pull request, simply reply with |
|
bors merge |
This adds a type for the symmetric square of a type, which is the quotient of the cartesian square by permutations. These are also known as unordered pairs. Additionally, this provides some definitions and lemmas for equalities, functoriality, membership, and a relationship between symmetric relations and terms of the symmetric square. I preferred `sym2` over `unordered_pairs` out of a combination of familiarity and brevity, but I could go either way for naming.
|
Pull request successfully merged into master. Build succeeded: |
|
Oops, we probably shouldn't leave |
…prover-community#3264) This adds a type for the symmetric square of a type, which is the quotient of the cartesian square by permutations. These are also known as unordered pairs. Additionally, this provides some definitions and lemmas for equalities, functoriality, membership, and a relationship between symmetric relations and terms of the symmetric square. I preferred `sym2` over `unordered_pairs` out of a combination of familiarity and brevity, but I could go either way for naming.
This adds a type for the symmetric square of a type, which is the quotient of the cartesian square by permutations. These are also known as unordered pairs.
Additionally, this provides some definitions and lemmas for equalities, functoriality, membership, and a relationship between symmetric relations and terms of the symmetric square.
I preferred
sym2overunordered_pairsout of a combination of familiarity and brevity, but I could go either way for naming.