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
327
327
``` agda
328
328
⊤-reflects : Reflects (⊤ {a}) true
329
329
⊥-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
330
344
```
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ open import Data.Fin.Base as F using (Fin)
20
20
open import Data.Fin.Properties using (suc-injective; <⇒≢)
21
21
open import Data.Nat.Base using (zero; suc; _<_; z≤n; s≤s; z<s; s<s)
22
22
open 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_ )
24
24
open import Level using (Level)
25
25
open import Relation.Binary.Core using (Rel)
26
26
open import Relation.Binary.Bundles using (DecSetoid)
@@ -42,11 +42,14 @@ private
42
42
43
43
module _ {R : Rel A ℓ} {f : B → A} where
44
44
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)
47
46
map⁺ [] = []
48
47
map⁺ (x∉xs ∷ xs!) = All.map⁺ x∉xs ∷ map⁺ xs!
49
48
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
+
50
53
------------------------------------------------------------------------
51
54
-- ++
52
55
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ open import Level using (Level)
30
30
open import Relation.Binary.Core using (Rel)
31
31
open import Relation.Binary.Bundles using (Setoid)
32
32
open import Relation.Binary.PropositionalEquality.Core
33
- using (refl; _≡_; _≢_; sym)
33
+ using (refl; _≡_; _≢_; sym; cong )
34
34
open import Relation.Binary.PropositionalEquality.Properties using (setoid)
35
35
open import Relation.Unary using (Pred; Decidable)
36
36
open import Relation.Nullary.Negation using (¬_)
@@ -53,6 +53,9 @@ module _ {A : Set a} {B : Set b} where
53
53
∀ {xs} → Unique xs → Unique (map f xs)
54
54
map⁺ = Setoid.map⁺ (setoid A) (setoid B)
55
55
56
+ map⁻ : ∀ {f xs} → Unique (map f xs) → Unique xs
57
+ map⁻ = Setoid.map⁻ (setoid A) (setoid B) (cong _)
58
+
56
59
------------------------------------------------------------------------
57
60
-- ++
58
61
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import Data.List.Relation.Unary.AllPairs.Properties as AllPairs
24
24
open import Data.Fin.Base using (Fin)
25
25
open import Data.Nat.Base using (_<_)
26
26
open import Function.Base using (_∘_; id)
27
+ open import Function.Definitions using (Congruent)
27
28
open import Level using (Level)
28
29
open import Relation.Binary.Core using (Rel)
29
30
open import Relation.Binary.Bundles using (Setoid)
@@ -50,6 +51,10 @@ module _ (S : Setoid a ℓ₁) (R : Setoid b ℓ₂) where
50
51
∀ {xs} → Unique S xs → Unique R (map f xs)
51
52
map⁺ inj xs! = AllPairs.map⁺ (AllPairs.map (contraposition inj) xs!)
52
53
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
+
53
58
------------------------------------------------------------------------
54
59
-- ++
55
60
You can’t perform that action at this time.
0 commit comments