-
Notifications
You must be signed in to change notification settings - Fork 245
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 ] Relation.Binary._Reflects_⟶_
as a companion to _Preserves_⟶_
#2566
Closed
+10
−2
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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'm kind of against this change personally. I read
Injective f = ∀ {x y} → f x ≈₂ f y → x ≈₁ y
and I understand exactly what it says.I read
Injective = _Reflects _≈₂_ ⟶ _≈₁_
and I have to do the following:Injective f = f Reflects _≈₂_ ⟶ _≈₁_
(non-trivial for beginners)(_≈₁_ on f) ⇒ _≈₂_
which is equally baffling.on
..._⇒_
...All of these definitions are in different modules and Agda currently provides no easy method of expanding them. In my mind the very small benefit of this change is outweighed by the quite large decrease in usability!
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.
@MatthewDaggitt very sharp critique from the ux perspective (I think perhaps we should have
ux
as a new label category for tagging issues/PRs), for which all thanks.As the preamble to this PR indicates, I wanted this concept/definition in
stdlib
so that (eventually) all theCancellative
properties could be rephrased in terms of it. Currently, under #1436 / #2573 we only treat the cancellative properties for equality... if you will, perhaps as another, more directly graspable concept, we should get rid ofCancellative
and friends altogether in favour of saying that egm +_
isInjective
onNat
with_≡_
(that would be the other way to go).It's perhaps the case that my ideological/reformatory zeal on [DRY] issues leads to (over-)generalisations like those considered here (or most recently, in #2581 ), and that reflects what is (probably!) the greater abstraction power of higher-order languages such as Agda's type theory relative to the abstraction power of users (esp. wrt definitional expansion across modules, as you indicate so forcefully).
Against your suggestion, my own preference would be to record as a comment, the 'conventional' usage as being a definitional expansion of the abstract one. Something like
Of course, that would be a break from existing practice in the library, as well as opening the door to bit-rot if/when definitions change, but here I don't think we are at quite such a risk... precisely because the definition is so 'stable'?
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.
All of that said, happy to revert this particular instance of the definition (it was introduced above as 'illustrative'), but then what about
Cancellative
in all its variety?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 adding non-type checked comments is very susceptible to bit rot as you say. I would be more open to a private definition that performed an equality check.
However, I'm still not entirely sure what advantages the generalisation brings in this case. It's not like we have either a) a set of properties/theory about these kinds of definitions in general or b) lots of definitions in this form?
Injective
,Cancellative
, anything else?Ditto, I'm not sure that I would be keen on replacing the definitions of
Cancellative
for exactly the same reasons...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 guess I would still try (but ) to justify the addition
Respects
but this particular stone seems to be getting harder to push uphill. I'll stop!