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
Added Z mod n as Fin #2073
Added Z mod n as Fin #2073
Changes from 1 commit
19566db
94d8aa9
c87e35a
af96faa
7e6a392
467b190
600035c
5cdbaf7
e64b543
d3d4770
1d28e8e
3773f2c
e853059
fccf44d
e7edaee
ab5493d
7ccd05e
644a8cb
417fa28
4d3a4ab
84cc27b
473ac6d
b539e70
aeb1c4a
bdf0651
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.
This can be an anonymous module?
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.
Consider the following alternative definition (which doesn't actually use the view; but simulates its effect, in the same way as the definition of
Data.Fin.Base.opposite
:for which one may then prove injectivity, and the view-related inversions, as follows:
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.
Can you give me an example of a use-case of this operation? Seems a little unnatural to me adding together two numbers of different mods and arbitrarily returning the result mod the right one?
And why does
_-_
return the result mod the left one?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.
Is this ever necessary over
_+_
? A lot of the time Agda should be able to unify the two dimensions.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 could be necessary if someone wants a more restrictive version.
This is one example:
agda-stdlib/src/Function/Base.agda
Line 134 in 78e11bd
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.
This suggests that
opposite
is an inverse function for_+_
(which I agree it should be). Can you prove this?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.
Again, for a possible alternative (re-)definition of
opposite
, see also #1923There 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.
Now, it is with the alternative re-definition.
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.
Except that there's still an asymmetry.
_+_
has heterogeneous sizes but_-_
is homogeneous?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 made it assymmetric.
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.
Should be
suc-pred
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 proof of this seems very fiddly, but I admit I'm finding it harder to do better, even for the alternative definition of
suc
. Hmmm...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.
Is this lemma not also provable in the case
n = ℕ.zero
? By inversion of the hypothesism ℕ.≤ n
, we would obtainm = ℕ.zero
, and then the proof is simplyrefl
... or am I missing something?UPDATED: it seems I might be, after banging my head against your proof for a while...