Skip to content
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

[ new ] List map injection #1141

Closed
wants to merge 1 commit into from

Conversation

ajrouvoet
Copy link
Contributor

I think these were still missing

Copy link
Contributor

@MatthewDaggitt MatthewDaggitt left a comment

Choose a reason for hiding this comment

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

My main thoughts is that as these proofs are to do with the function hierarchy should perhaps live under a folder Data.List.Function just as binary relations live in Data.List.Relation.Binary?

I would tentatively recommend that they live in Data.List.Function.Map? We could then re-export the simple versions, e.g. map-injective in Data.List.Properties if we wanted to?

For example all the zipWith proofs under Data.Vec.Properties would then be moved to Data.Vec.Algebra.ZipWith...

@@ -26,6 +26,7 @@ open import Data.Product as Prod hiding (map; zip)
open import Data.Sum.Base using (_⊎_; inj₁; inj₂)
open import Data.These.Base as These using (These; this; that; these)
open import Function
open import Function.Equality using (_⟨$⟩_)
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need this import?

@@ -106,6 +107,15 @@ map-compose : {g : B → C} {f : A → B} → map (g ∘ f) ≗ map g ∘ map f
map-compose [] = refl
map-compose (x ∷ xs) = cong (_ ∷_) (map-compose xs)

map-injective : ∀ (f : A ↣ B) → Injective _≡_ _≡_ (map (Injection.f f))
Copy link
Contributor

Choose a reason for hiding this comment

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

f : A ↣ B is quite a heavy pre-condition. For the map-injective I'd have the type ∀ {f : A → B} → Injective _≡_ _≡_ f → Injective _≡_ _≡_ (map f) .

... | fx≡fy , fxs≡fys = cong₂ _∷_ (injective fx≡fy) (map-injective f fxs≡fys)
where open Injection f hiding (f)

map-injection : ∀ (f : A ↣ B) → List A ↣ List B
Copy link
Contributor

Choose a reason for hiding this comment

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

As this is the propositional variant, I think we'd better name it map-↣ and save map-injection for the setoid variety.

@ajrouvoet
Copy link
Contributor Author

Thanks for the review @MatthewDaggitt; that all sounds good to me.

@umazalakain
Copy link
Contributor

This was added as part of
b52e3e5

@MatthewDaggitt
Copy link
Contributor

@ajrouvoet as @umazalakain says map-injective has been added in another PR. Are you still keen to include the corresponding bundle or should I close this PR?

@ajrouvoet
Copy link
Contributor Author

Having map-↣ is still neat IMO; perhaps @umazalakain doesn't mind adding it alongside map-injective in that PR?

@MatthewDaggitt
Copy link
Contributor

Having map-↣ is still neat IMO; perhaps @umazalakain doesn't mind adding it alongside map-injective in that PR?

I'm afraid the PR was already merged in.

@MatthewDaggitt MatthewDaggitt removed this from the v1.4 milestone Aug 24, 2020
@ajrouvoet
Copy link
Contributor Author

Okay, let's close this anyway. Trying to keep the number of fun distractions low as I try to deliver a dissertation ;-)

@ajrouvoet ajrouvoet closed this Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants