Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add prime factorization and its properties #1969
Add prime factorization and its properties #1969
Changes from 20 commits
98dff4f
54ed74c
9c05449
6c9a9e1
7ec3801
8e0d749
f77023e
2f4193c
1b45ff5
cec5fac
4c8b43e
dd898f9
b330ae5
bec7b21
294bdad
8796eee
f0948e8
2a1ab80
7e73c8d
c2a712f
6262285
4073e5f
8afce74
87022d8
ea1142d
58a71c5
230d498
1f1ed8e
8b34d27
7482c46
20d8d66
aca45ad
e24f0be
fd4e806
510b7ec
9f2ef51
217d0cd
286bc7e
5063190
cf8a9c4
35153ca
578718d
a556522
cc8cef2
7dcd066
eb893ed
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'traditional' notion of PrimeFactorisation uses a list of (multiplicity, prime) pairs and has the extra invariant that all primes are distinct.
I am not suggesting you change this definition - but you should probably comment on your design choice, so that this aspect doesn't puzzle a maintainer years down the road.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for insisting on having removed such things from earlier versions of the library. Do we need to reinstate them full-bloodedly in
Data.Nat.Base
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these were snuck in by @gallais here so I'm going to refer this to him
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, and definitionally equal, but notationally distinct:
(I love
pattern
synonyms, too much perhaps)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's now the case that we have in
Data.Nat.Base
:2+
as a pattern synonymsz<ss
for the (second and) third itemSo I think these can all be removed from here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, perhaps I am mistaken here? Needs
sym
on my formulation. Ah well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be 'simpler' if this took a
PrimeFactorisation
as input instead of the pieces it contains?Also it feels like this could be proven more simply:
This would be straightforward if you already knew it was a PrimeFactorisation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've simplified it a bit. I don't think I do want it to take a
PrimeFactorisation
, because it recurses on the list, which would be a little more awkward. But maybe I'm wrong here, I'll think about it more