Skip to content

Conversation

@jonathanknowles
Copy link
Contributor

@jonathanknowles jonathanknowles commented Jan 6, 2025

This PR adds explicit documentation and tests for the following Monus laws:

a <\> a == mempty
mempty <\> a == mempty
a <> (b <\> a) == b <> (a <\> b)
(a <\> b) <\> c == a <\> (b <> c)

These are equivalent to the laws stated here.

Furthermore, this PR tests that the following equivalences hold:

(a <\> b) == stripPrefixOverlap b a
(a <\> b) == stripSuffixOverlap b a

Prior to this PR, it looks like the existing Monus instances were not explicitly tested. (The Test data type did already have a MonusTest constructor, but this wasn't used in the definition of tests, and the import of <\> was redundant.)

Finally, this PR adds test coverage for all instances of Monus provided by the library.

@jonathanknowles
Copy link
Contributor Author

Hi @blamario

Hope it's okay for me to create this PR. Of course, let me know if you'd like me to change anything!

@jonathanknowles jonathanknowles force-pushed the jonathanknowles/test-monus-laws branch 2 times, most recently from 2733711 to 8bb1464 Compare January 6, 2025 11:04
@jonathanknowles jonathanknowles force-pushed the jonathanknowles/test-monus-laws branch from 8bb1464 to 5e80973 Compare January 7, 2025 04:09
Copy link
Owner

@blamario blamario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I don't know how I missed the monus laws on Wikipedia.

@blamario blamario merged commit 7a952af into blamario:master Jan 8, 2025
11 checks passed
@jonathanknowles jonathanknowles deleted the jonathanknowles/test-monus-laws branch January 8, 2025 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants