368 add alldisjoint alldistinct 2 - #382
Conversation
Establish AllDisjoint() and AllDistinct() classes to extend the Disjoint() and Distinct() variadic classes. AllDisjoint() and AllDistinct() will take a _set_ (or collection) of elements.
Add some basic axioms and theorems to disjointness pkg, defining the AllDisjoint() and AllDistinct() classes and supplying some basic theorems for disjointness and distinctiveness, including disjoint_diff and disjoint_diff_binary theorems noting that Disjoint(A-B, B) (which will be useful in the QEC branch when establishing the disjointness of boundary and non-boundary vertices).
Update disjointness package demonstrations notebook to test and illustrate simple constructions and to test the instantiation of our disjoint_diff theorems.
wwitzel
left a comment
There was a problem hiding this comment.
There are a couple issues with your 'all_distinct_def' theorem. IndexedVar is intended for use within an ExprRange. I don't think you'll be able to sensibly instantiate 'all_distinct_def' in it's current form. Instead, you should treat 'x' as a function. Also, I believe you mean to use 'Disjoint' instead of 'NotEquals', right? You can do something like:
Forall(n, Forall(x,Equals(AllDistinct(Set(ExprRange(Function(x, k), one, n),
Forall((i, j), Disjoint(Function(x, i), Function(x, j)),
conditions=[NotEquals(i, j)], domain=Interval(one, n)))),
domain=Natural))
But a more straightforward definition would be:
Forall(S, Equals(AllDistinct(S),
Forall((A, B), Disjoint(A, B),
domain=S, condition=NotEquals(A, B))))
Do I have that right?
|
Thanks @wwitzel. In response to your observations:
I am looking at this now and will switch the indexed var approach over to a functional approach. In answer to the question about 'Disjoint' instead of 'NotEquals', though, I think 'NotEquals' is what we need here — the 'all_distinct_def' is about distinctiveness, not disjointness. The items x(1), x(2), … x(n) are elements in a set and we are specifying that x(i) is distinct from x(j) (i.e. they are not equal) whenever i ≠ j. We could rewrite it to use the singleton set approach you've used in the The "more straightforward" definition you propose I think is off-track, perhaps confusing distinctiveness with disjointness. Translating your suggested text, I get: I actually toyed with something similar when constructing the definition, but realized we can't "pick out" because Looking at this afresh now, I see we could also simply "punt" and use the approach I used for the |
Update all_distinct_def axiom in logic/sets/disjointness to switch from using IndexedVar to Function (because IndexedVar is intended to be used within ExprRange, but in the axiom we also want to refer to individual items of the ExprRange outside of the ExprRange).
|
But the elements of a set are always distinct. Remember? |
Establish several basic disjointness theorems involving disjointness definition in terms of the empty set and pairwise disjointness. These are then used in Disjointness methods in an upcoming commit.
Update Disjoint class methods to establish definition(), as_defined(), unfold(), and conclude() methods. These depend on new-ish theorems established in a previous commit and the methods are demonstrated/tested in the demonstrations notebook (in the next commit).
Update the logic/sets/disjointness demonstrations notebook with brief demonstrations and tests of recently-established Disjoint methods: definition(), as_defined(), unfold(), and conclude().
Establish some additional basic Disjointness theorems, namely: disjoint_symmetry, disjoint_imp_disjoint_diff_left, disjoint_imp_disjoint_diff_right, disjoint_imp_disjoint_diffs, and disjoint_imp_disjoint_subsets.
Tweak a sets/disjointness theorem, changing the label for one of its parameters to make implementation in conclude() method a little easier.
Update Disjoint.conclude() to use recently established theorems (involving subsets and differences), and add a Disjoint. conclude_via_disjoint_supersets() method as a first try in applying a nice but more general subset-related disjointness theorem that was difficult to implement as a conclude() component.
Updated sets/disjointness demonstrations notebook to include tests/demos of recently updated Disjoint.conclude() method and a brief demo of the recently established Disjoint. conclude_via_disjoint_supersets() method.
A second initial attempt to augment the logic/sets/disjointness package with the new AllDisjoint() and AllDistinct() classes, which are intended to take a single argument consisting of a collection of sets or items (in contrast to the variadic classes Disjoint() and Distinct()). This will make some expression formulations simpler. This branch also makes an initial effort to establish some definitional axioms and new disjoint_singleton and distinct_singleton theorems. The AllDisjoint() and AllDistinct() classes are purely abstract right now with no methods for evaluation, unfolding, conclusion, etc. It is worth @wwitzel looking at the axioms/theorems with a skeptical eye.