-
Notifications
You must be signed in to change notification settings - Fork 236
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 properties of Data.Refinement
and refactor module structure
#2492
Add properties of Data.Refinement
and refactor module structure
#2492
Conversation
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.
Yup, I this is definitely useful! Also I think Properties
is definitely the right place for it, even though it seems like overkill at the moment. I'm sure more stuff will be added to it!
Two things:
|
Yes please: if it grows enough, let's split it up according to the hierarchy! |
OK, I've added a proof of (inheritance of) I'll stop there. |
Data.Refinement.value
Data.Refinement
and refactor module structure
Does @fredrikNordvallForsberg 's resolution of #2495 mean that we could simplify the implementation of record Refinement {a p} (A : Set a) (P : A → Set p) : Set (a ⊔ p) where
constructor _,_
field value : A
.proof : P value
infixr 4 _,_
open Refinement public
module _ {P : A → Set p} {Q : B → Set q} where
map : (f : A → B) → ∀[ P ⇒ f ⊢ Q ] →
[ a ∈ A ∣ P a ] → [ b ∈ B ∣ Q b ]
map f prf (a , p) = f a , prf p etc. Not for this PR, but a potential simplifying, even if |
You don't get irrelevant projections so IME it's nicer to package up things affected by the irrelevant |
The old category library used to use irrelevance a lot and then broke in ways we couldn't fix at some point in Agda's evolution. So I'd be quite concerned that we'd run up against bugs "just too late" if we start using it too much in the library. Irrelevant projections (and the lack thereof) are a big deal. Conor and I more recently tried to use irrelevance quite aggressively to force Agda to ensure we stay honest (we're doing quotients "by hand"), and gave up. Now we stay honest by sheer force of will. |
Ready to merge now? |
|
||
infix 4 _≟_ | ||
_≟_ : DecidableEquality [ x ∈ A ∣ P x ] | ||
v ≟ w = Dec.map′ value-injective (cong value) (eq? (value v) (value w)) |
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 is clearly a pattern, which currently is reified only under Relation.Decidable.Nullary.Decidable.via-injection
, but it seems excessive to create an Injection
bundle solely for the sake of applying the lemma, so suggest some downstream refactoring to make this a property of Injective
(bare) functions?
NB.
Data.Refinement
directly?