Skip to content

Commit

Permalink
fixes #2375 (#2377)
Browse files Browse the repository at this point in the history
* fixes #2375

* removed redundant `Membership` instances

* fix merge conflict error
  • Loading branch information
jamesmckinna authored and andreasabel committed Jul 10, 2024
1 parent b378d4b commit 507fcf8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ Additions to existing modules

* In `Data.List.Relation.Binary.Subset.Setoid.Properties`:
```agda
map⁺ : f Preserves _≈_ ⟶ _≈′_ → as ⊆ bs → map f as ⊆′ map f bs
reverse-selfAdjoint : as ⊆ reverse bs → reverse as ⊆ bs
reverse⁺ : as ⊆ bs → reverse as ⊆ reverse bs
reverse⁻ : reverse as ⊆ reverse bs → as ⊆ bs
Expand Down
26 changes: 23 additions & 3 deletions src/Data/List/Relation/Binary/Subset/Setoid/Properties.agda
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ open import Level using (Level)
open import Relation.Nullary using (¬_; does; yes; no)
open import Relation.Nullary.Negation using (contradiction)
open import Relation.Unary using (Pred; Decidable) renaming (_⊆_ to _⋐_)
open import Relation.Binary.Core using (_⇒_)
open import Relation.Binary.Core using (_⇒_; _Preserves_⟶_)
open import Relation.Binary.Definitions
using (Reflexive; Transitive; _Respectsʳ_; _Respectsˡ_; _Respects_)
open import Relation.Binary.Bundles using (Setoid; Preorder)
Expand All @@ -39,7 +39,7 @@ open Setoid using (Carrier)

private
variable
a p q ℓ : Level
a b p q r: Level

------------------------------------------------------------------------
-- Relational properties with _≋_ (pointwise equality)
Expand Down Expand Up @@ -210,6 +210,27 @@ module _ (S : Setoid a ℓ) where
++⁺ : {ws xs ys zs} ws ⊆ xs ys ⊆ zs ws ++ ys ⊆ xs ++ zs
++⁺ ws⊆xs ys⊆zs = ⊆-trans S (++⁺ˡ _ ws⊆xs) (++⁺ʳ _ ys⊆zs)

------------------------------------------------------------------------
-- map

module _ (S : Setoid a ℓ) (R : Setoid b r) where

private
module S = Setoid S
module R = Setoid R

module S⊆ = Subset S
module R⊆ = Subset R

open Membershipₚ

map⁺ : {as bs} {f : S.Carrier R.Carrier}
f Preserves S._≈_ ⟶ R._≈_
as S⊆.⊆ bs map f as R⊆.⊆ map f bs
map⁺ {f = f} f-pres as⊆bs v∈f[as] =
let x , x∈as , v≈f[x] = ∈-map⁻ S R v∈f[as] in
∈-resp-≈ R (R.sym v≈f[x]) (∈-map⁺ S R f-pres (as⊆bs x∈as))

------------------------------------------------------------------------
-- reverse

Expand Down Expand Up @@ -242,7 +263,6 @@ module _ (S : Setoid a ℓ) where
bs ∎
where open ⊆-Reasoning S


------------------------------------------------------------------------
-- filter

Expand Down

0 comments on commit 507fcf8

Please sign in to comment.