File tree Expand file tree Collapse file tree 4 files changed +29
-4
lines changed
src/Data/List/Relation/Unary Expand file tree Collapse file tree 4 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -327,4 +327,18 @@ Additions to existing modules
327327 ``` agda
328328 ⊤-reflects : Reflects (⊤ {a}) true
329329 ⊥-reflects : Reflects (⊥ {a}) false
330+
331+ * In `Data.List.Relation.Unary.AllPairs.Properties`:
332+ ```agda
333+ map⁻ : AllPairs R (map f xs) → AllPairs (R on f) xs
334+ ```
335+
336+ * In ` Data.List.Relation.Unary.Unique.Setoid.Properties ` :
337+ ``` agda
338+ map⁻ : Congruent _≈₁_ _≈₂_ f → Unique R (map f xs) → Unique S xs
339+ ```
340+
341+ * In ` Data.List.Relation.Unary.Unique.Propositional.Properties ` :
342+ ``` agda
343+ map⁻ : Unique (map f xs) → Unique xs
330344 ```
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ open import Data.Fin.Base as F using (Fin)
2020open import Data.Fin.Properties using (suc-injective; <⇒≢)
2121open import Data.Nat.Base using (zero; suc; _<_; z≤n; s≤s; z<s; s<s)
2222open import Data.Nat.Properties using (≤-refl; m<n⇒m<1+n)
23- open import Function.Base using (_∘_; flip)
23+ open import Function.Base using (_∘_; flip; _on_ )
2424open import Level using (Level)
2525open import Relation.Binary.Core using (Rel)
2626open import Relation.Binary.Bundles using (DecSetoid)
@@ -42,11 +42,14 @@ private
4242
4343module _ {R : Rel A ℓ} {f : B → A} where
4444
45- map⁺ : ∀ {xs} → AllPairs (λ x y → R (f x) (f y)) xs →
46- AllPairs R (map f xs)
45+ map⁺ : ∀ {xs} → AllPairs (R on f) xs → AllPairs R (map f xs)
4746 map⁺ [] = []
4847 map⁺ (x∉xs ∷ xs!) = All.map⁺ x∉xs ∷ map⁺ xs!
4948
49+ map⁻ : ∀ {xs} → AllPairs R (map f xs) → AllPairs (R on f) xs
50+ map⁻ {[]} _ = []
51+ map⁻ {_ ∷ _} (fx∉fxs ∷ fxs!) = All.map⁻ fx∉fxs ∷ map⁻ fxs!
52+
5053------------------------------------------------------------------------
5154-- ++
5255
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ open import Level using (Level)
3030open import Relation.Binary.Core using (Rel)
3131open import Relation.Binary.Bundles using (Setoid)
3232open import Relation.Binary.PropositionalEquality.Core
33- using (refl; _≡_; _≢_; sym)
33+ using (refl; _≡_; _≢_; sym; cong )
3434open import Relation.Binary.PropositionalEquality.Properties using (setoid)
3535open import Relation.Unary using (Pred; Decidable)
3636open import Relation.Nullary.Negation using (¬_)
@@ -53,6 +53,9 @@ module _ {A : Set a} {B : Set b} where
5353 ∀ {xs} → Unique xs → Unique (map f xs)
5454 map⁺ = Setoid.map⁺ (setoid A) (setoid B)
5555
56+ map⁻ : ∀ {f xs} → Unique (map f xs) → Unique xs
57+ map⁻ = Setoid.map⁻ (setoid A) (setoid B) (cong _)
58+
5659------------------------------------------------------------------------
5760-- ++
5861
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import Data.List.Relation.Unary.AllPairs.Properties as AllPairs
2424open import Data.Fin.Base using (Fin)
2525open import Data.Nat.Base using (_<_)
2626open import Function.Base using (_∘_; id)
27+ open import Function.Definitions using (Congruent)
2728open import Level using (Level)
2829open import Relation.Binary.Core using (Rel)
2930open import Relation.Binary.Bundles using (Setoid)
@@ -50,6 +51,10 @@ module _ (S : Setoid a ℓ₁) (R : Setoid b ℓ₂) where
5051 ∀ {xs} → Unique S xs → Unique R (map f xs)
5152 map⁺ inj xs! = AllPairs.map⁺ (AllPairs.map (contraposition inj) xs!)
5253
54+ map⁻ : ∀ {f} → Congruent _≈₁_ _≈₂_ f →
55+ ∀ {xs} → Unique R (map f xs) → Unique S xs
56+ map⁻ cong fxs! = AllPairs.map (contraposition cong) (AllPairs.map⁻ fxs!)
57+
5358------------------------------------------------------------------------
5459-- ++
5560
You can’t perform that action at this time.
0 commit comments