[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlaplus] Removing "equivalents" from a set



Hello. I have a small problem that I haven't been able to solve:

What I'm trying to achieve is given a set of numbers, I want to partition it into smaller sets(in this case with size 2), and eliminate equivalent partitions to save resources.
6 hours later, I have arrived at this result, which is almost what I want:
s == { {{1}},
     
{{2}},
     
{{3}},
     
{{4}},
     
{{1, 2}},
     
{{1, 3}},
     
{{1, 4}},
     
{{2, 3}},
     
{{2, 4}},
     
{{3, 4}},
     
{{1}, {2, 3}},
     
{{1}, {2, 4}},
     
{{1}, {3, 4}},
     
{{2}, {1, 3}},
     
{{2}, {1, 4}},
     
{{2}, {3, 4}},
     
{{3}, {1, 2}},
     
{{3}, {1, 4}},
     
{{3}, {2, 4}},
     
{{4}, {1, 2}},
     
{{4}, {1, 3}},
     
{{4}, {2, 3}},
     
{{1, 2}, {3, 4}},
     
{{1, 3}, {2, 4}},
     
{{1, 4}, {2, 3}} }
What I am trying to do is to remove elements of this set, if the element's UNION is already contained in the set, giving me the following set:
{ {{1}},
     
{{2}},
     
{{3}},
     
{{4}},
     
{{1, 2}},
     
{{1, 3}},
     
{{1, 4}},
     
{{2, 3}},
     
{{2, 4}},
     
{{3, 4}},
     
{{1}, {2, 3}},
     
{{1}, {2, 4}},
     
{{1}, {3, 4}},
     
{{2}, {3, 4}},
     
{{1, 2}, {3, 4}} }

How could this be done? I have not found any way asserting that a predicate is true for every pair of elements in a set. 

--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to tlaplus@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/tlaplus.
For more options, visit https://groups.google.com/d/optout.