-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set::intersectPartial() method added to the SetTheory namespace #464
base: develop
Are you sure you want to change the base?
Conversation
Hi @Smoren, Thank you for your interest in MathPHP and for your pull request. I understand the functionality from our conversations in the IterTools PRs. I have a question about implementation. Based on your description here:
Since this new set operation seems to be able to be defined in terms of other set operations (union, difference, symmetric difference, and intersection), and those set operations are already defined on Also, whether or not the above is possible or not, allow me to introduce how we do unit testing for MathPHP. In addition to the individual unit tests on each method (Which you added, thank you!), whenever possible, we also add axiom unit tests based on mathematical axioms that show principles that should hold regardless of how things are implemented. See the SetAxiomsTest for examples for the class you are working on. For other examples, see MatrixAxiomsTest and VectorAxiomsTest for instance. The definitions you stated above seem like good axiom tests to add for this new operation. For these kinds of tests, using a wide variety of inputs is recommended, as the axioms should hold regardless, and no pre-computed results generally need to be done as the axioms compute the rules that must hold. Thanks, |
Hi @markrogoyski, Thanks for the feedback! Indeed, there are cases (N=1, N=2, N=M, N>M) in which the operation is easily defined in terms of classical set operations. However, I don't see an easy way to express the partial intersection in terms of other operations for the cases 2<M<N.
As for axiomatic tests: I'll try to figure it out. P.S. Can you unlock github workflow for me to run without manual approval please? Thank you! UPD: All the axiomatic unit tests are added. |
It seems like first time contributors to a repository require manual approval from what I can tell. I think this is a relatively new GitHub feature probably to prevent abuse of resources. After you have merged something it should run automatically on each PR and additional commit. I'll just have to kick it off manually for now it seems. |
@markrogoyski, OK, got it. So I think this PR is ready to merge if you do not have new questions. Thank you! |
- testPartialIntersectionDefinition(); - testOnePartialIntersectionIsUnion(); - testTwoPartialIntersectionIsDifferenceOfUnionAndSymmetricDifference(); - testNPartialIntersectionIsCompleteIntersection(); - testNPartialIntersectionIsEmptySetWhenMMoreThanN().
04958a9
to
f5a52dc
Compare
Hi @markrogoyski, I've rebase this branch from |
Hi @markrogoyski,
This is a PR about the M-partial intersection which have been previously added to your IterTools repository.
Definition
Properties
For any N sets:
Example
Given: sets A, B, C, D (N = 4).
M = 1
It is equivalent to
A ∪ B ∪ C ∪ D
.M = 2
It is equivalent to
(A ∪ B ∪ C ∪ D) \ ∆(A, B, C, D)
.M = 3
M = 4 (M = N)
It is equivalent to
A ∩ B ∩ C ∩ D
.M = 5 (M > N)
Equals to an empty set.
More examples you can see in this repo.