@@ -14,10 +14,10 @@ open import Data.List.Relation.Unary.All as All using (All; []; _∷_)
14
14
import Data.List.Relation.Unary.All.Properties as All
15
15
open import Data.List.Relation.Unary.AllPairs as AllPairs using (AllPairs; []; _∷_)
16
16
open import Data.List.Relation.Unary.Grouped
17
- open import Function. Base using (_∘ _)
18
- open import Function.Bundles using (module Equivalence ; _⇔_ )
17
+ open import Data.Product. Base using (_, _)
18
+ open import Function.Base using (_∘_; _on_ )
19
19
open import Relation.Binary.Definitions as B
20
- open import Relation.Binary.Core using (REL; Rel)
20
+ open import Relation.Binary.Core using (_⇔_; REL; Rel)
21
21
open import Relation.Unary as U using (Pred)
22
22
open import Relation.Nullary using (¬_; does; yes; no)
23
23
open import Relation.Nullary.Negation using (contradiction)
@@ -26,31 +26,23 @@ open import Level
26
26
private
27
27
variable
28
28
a b c p q : Level
29
- A : Set a
30
- B : Set b
31
- C : Set c
29
+ A B C : Set a
32
30
33
31
------------------------------------------------------------------------
34
32
-- map
35
33
36
34
module _ (P : Rel A p) (Q : Rel B q) where
37
35
38
- map⁺ : ∀ {f xs} → (∀ {x y} → P x y ⇔ Q (f x) (f y)) → Grouped P xs → Grouped Q (map f xs)
39
- map⁺ {f} {[]} P⇔Q [] = []
40
- map⁺ {f} {x ∷ xs} P⇔Q (all[¬Px,xs] ∷≉ g) = aux all[¬Px,xs] ∷≉ map⁺ P⇔Q g where
41
- aux : ∀ {ys} → All (λ y → ¬ P x y) ys → All (λ y → ¬ Q (f x) y) (map f ys)
42
- aux [] = []
43
- aux (py ∷ pys) = py ∘ Equivalence.from P⇔Q ∷ aux pys
44
- map⁺ {f} {x₁ ∷ x₂ ∷ xs} P⇔Q (Px₁x₂ ∷≈ g) = Equivalence.to P⇔Q Px₁x₂ ∷≈ map⁺ P⇔Q g
36
+ map⁺ : ∀ {f xs} → P ⇔ (Q on f) → Grouped P xs → Grouped Q (map f xs)
37
+ map⁺ P⇔Q [] = []
38
+ map⁺ P⇔Q@(_ , Q⇒P) (all[¬Px,xs] ∷≉ g[xs]) = All.gmap⁺ (_∘ Q⇒P) all[¬Px,xs] ∷≉ map⁺ P⇔Q g[xs]
39
+ map⁺ P⇔Q@(P⇒Q , _) (Px₁x₂ ∷≈ g[xs]) = P⇒Q Px₁x₂ ∷≈ map⁺ P⇔Q g[xs]
45
40
46
- map⁻ : ∀ {f xs} → (∀ {x y} → P x y ⇔ Q (f x) (f y)) → Grouped Q (map f xs) → Grouped P xs
47
- map⁻ {f} {[]} P⇔Q [] = []
48
- map⁻ {f} {x ∷ []} P⇔Q ([] ∷≉ []) = [] ∷≉ []
49
- map⁻ {f} {x₁ ∷ x₂ ∷ xs} P⇔Q (all[¬Qx,xs] ∷≉ g) = aux all[¬Qx,xs] ∷≉ map⁻ P⇔Q g where
50
- aux : ∀ {ys} → All (λ y → ¬ Q (f x₁) y) (map f ys) → All (λ y → ¬ P x₁ y) ys
51
- aux {[]} [] = []
52
- aux {y ∷ ys} (py ∷ pys) = py ∘ Equivalence.to P⇔Q ∷ aux pys
53
- map⁻ {f} {x₁ ∷ x₂ ∷ xs} P⇔Q (Qx₁x₂ ∷≈ g) = Equivalence.from P⇔Q Qx₁x₂ ∷≈ map⁻ P⇔Q g
41
+ map⁻ : ∀ {f xs} → P ⇔ (Q on f) → Grouped Q (map f xs) → Grouped P xs
42
+ map⁻ {xs = []} P⇔Q [] = []
43
+ map⁻ {xs = _ ∷ []} P⇔Q ([] ∷≉ []) = [] ∷≉ []
44
+ map⁻ {xs = _ ∷ _ ∷ _} P⇔Q@(P⇒Q , _) (all[¬Qx,xs] ∷≉ g) = All.gmap⁻ (_∘ P⇒Q) all[¬Qx,xs] ∷≉ map⁻ P⇔Q g
45
+ map⁻ {xs = _ ∷ _ ∷ _} P⇔Q@(_ , Q⇒P) (Qx₁x₂ ∷≈ g) = Q⇒P Qx₁x₂ ∷≈ map⁻ P⇔Q g
54
46
55
47
------------------------------------------------------------------------
56
48
-- [_]
0 commit comments