Skip to content

Add left and right versions of ++⁺ for pointwise relations #1131

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

Closed
mechvel opened this issue Mar 29, 2020 · 1 comment · Fixed by #2426
Closed

Add left and right versions of ++⁺ for pointwise relations #1131

mechvel opened this issue Mar 29, 2020 · 1 comment · Fixed by #2426

Comments

@mechvel
Copy link
Contributor

mechvel commented Mar 29, 2020

Data.List.Relation.Binary.Pointwise has

module _ {_∼_ : REL A B ℓ} where                                                                                                                                
  ++⁺ : ∀ {ws xs ys zs} → Pointwise _∼_ ws xs → Pointwise _∼_ ys zs →             
                                        Pointwise _∼_ (ws ++ ys) (xs ++ zs)  

According to the library style, needs it to be
++-cong₂ : _++_ Preserves₂ (Pointwise _~_) ⟶ (Pointwise _~_) ⟶ (Pointwise _~_)
?
There remains a question of the difference between REL A B _ and Rel A _, Rel B _.
So that I wonder.
Anyway, it has, probably, sense to add lemmas derived from ++⁺, named ++-cong<foo>,
and having Preserves/Preserves₂ in the signature.
For example, in my program, I write for lists over a setoid:

  ++cong1=ₗ :   ∀ {ys} → (_++ ys) Preserves _=ₗ_ ⟶ _=ₗ_
  ++cong1=ₗ {ys} ws=ₗxs =   ++⁺ {_∼_ = _≈_} ws=ₗxs =ₗrefl 
@MatthewDaggitt MatthewDaggitt changed the title ...Pointwise.++⁺ in lib1.3 Add left and right versions of ++⁺ for pointwise relations Apr 12, 2020
jamesmckinna added a commit to jamesmckinna/agda-stdlib that referenced this issue Jul 2, 2024
@jamesmckinna
Copy link
Contributor

jamesmckinna commented Jul 3, 2024

For Lists defined over a Setoid, S say, you can now, since #2393 (part of the v2.1-rc1), proceed as follows: instead of defining such things directly, write

open import Data.List.Relation.Binary.Equality.Setoid S using (isMagma)
open IsMagma isMagma using () renaming (∙-congʳ to ++⁺ʳ; ∙-congˡ to ++⁺ˡ)

(or whatever names you find convenient)

This does not tackle the Pointwise heterogeneous definitions directly, but suffices for the homogeneous Equality.Setoid case.

Suggest closing this issue now, unless the full generality for Pointwise is required... in which case #2426 will eventually do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants