6
6
7
7
{-# OPTIONS --cubical-compatible --safe #-}
8
8
9
- module Data.List.Relation.Binary.Sublist.Propositional.Properties
10
- {a} {A : Set a} where
9
+ module Data.List.Relation.Binary.Sublist.Propositional.Properties where
11
10
12
11
open import Data.List.Base using (List; []; _∷_; map)
13
12
open import Data.List.Membership.Propositional using (_∈_)
@@ -31,54 +30,54 @@ open import Relation.Unary using (Pred)
31
30
32
31
private
33
32
variable
34
- b ℓ : Level
35
- B : Set b
33
+ a ℓ : Level
34
+ A B : Set a
35
+ x y : A
36
+ ws xs ys zs : List A
36
37
37
38
------------------------------------------------------------------------
38
39
-- Re-exporting setoid properties
39
40
40
- open SetoidProperties (setoid A) public
41
- hiding (map⁺; ⊆-trans-idˡ; ⊆-trans-idʳ; ⊆-trans-assoc)
41
+ module _ {A : Set a} where
42
+ open SetoidProperties (setoid A) public
43
+ hiding (map⁺; ⊆-trans-idˡ; ⊆-trans-idʳ; ⊆-trans-assoc)
42
44
43
- map⁺ : ∀ {as bs} (f : A → B) → as ⊆ bs → map f as ⊆ map f bs
44
- map⁺ {B = B} f = SetoidProperties.map⁺ (setoid A ) (setoid B ) (cong f)
45
+ map⁺ : (f : A → B) → xs ⊆ ys → map f xs ⊆ map f ys
46
+ map⁺ f = SetoidProperties.map⁺ (setoid _ ) (setoid _ ) (cong f)
45
47
46
48
------------------------------------------------------------------------
47
49
-- Category laws for _⊆_
48
50
49
- ⊆-trans-idˡ : ∀ {xs ys : List A} {τ : xs ⊆ ys} →
50
- ⊆-trans ⊆-refl τ ≡ τ
51
- ⊆-trans-idˡ {τ = τ} = SetoidProperties.⊆-trans-idˡ (setoid A) (λ _ → refl) τ
51
+ ⊆-trans-idˡ : ∀ {τ : xs ⊆ ys} → ⊆-trans ⊆-refl τ ≡ τ
52
+ ⊆-trans-idˡ {τ = τ} = SetoidProperties.⊆-trans-idˡ (setoid _) (λ _ → refl) τ
52
53
53
- ⊆-trans-idʳ : ∀ {xs ys : List A} {τ : xs ⊆ ys} →
54
- ⊆-trans τ ⊆-refl ≡ τ
55
- ⊆-trans-idʳ {τ = τ} = SetoidProperties.⊆-trans-idʳ (setoid A) trans-reflʳ τ
54
+ ⊆-trans-idʳ : ∀ {τ : xs ⊆ ys} → ⊆-trans τ ⊆-refl ≡ τ
55
+ ⊆-trans-idʳ {τ = τ} = SetoidProperties.⊆-trans-idʳ (setoid _) trans-reflʳ τ
56
56
57
57
-- Note: The associativity law is oriented such that rewriting with it
58
58
-- may trigger reductions of ⊆-trans, which matches first on its
59
59
-- second argument and then on its first argument.
60
60
61
- ⊆-trans-assoc : ∀ {ws xs ys zs : List A}
62
- {τ₁ : ws ⊆ xs} {τ₂ : xs ⊆ ys} {τ₃ : ys ⊆ zs} →
61
+ ⊆-trans-assoc : ∀ {τ₁ : ws ⊆ xs} {τ₂ : xs ⊆ ys} {τ₃ : ys ⊆ zs} →
63
62
⊆-trans τ₁ (⊆-trans τ₂ τ₃) ≡ ⊆-trans (⊆-trans τ₁ τ₂) τ₃
64
63
⊆-trans-assoc {τ₁ = τ₁} {τ₂ = τ₂} {τ₃ = τ₃} =
65
- SetoidProperties.⊆-trans-assoc (setoid A ) (λ p _ _ → ≡.sym (trans-assoc p)) τ₁ τ₂ τ₃
64
+ SetoidProperties.⊆-trans-assoc (setoid _ ) (λ p _ _ → ≡.sym (trans-assoc p)) τ₁ τ₂ τ₃
66
65
67
66
------------------------------------------------------------------------
68
67
-- Laws concerning ⊆-trans and ∷ˡ⁻
69
68
70
- ⊆-trans-∷ˡ⁻ᵣ : ∀ {y} {xs ys zs : List A} { τ : xs ⊆ ys} {σ : (y ∷ ys) ⊆ zs} →
69
+ ⊆-trans-∷ˡ⁻ᵣ : ∀ {τ : xs ⊆ ys} {σ : (y ∷ ys) ⊆ zs} →
71
70
⊆-trans τ (∷ˡ⁻ σ) ≡ ⊆-trans (y ∷ʳ τ) σ
72
71
⊆-trans-∷ˡ⁻ᵣ {σ = x ∷ σ} = refl
73
72
⊆-trans-∷ˡ⁻ᵣ {σ = y ∷ʳ σ} = cong (y ∷ʳ_) ⊆-trans-∷ˡ⁻ᵣ
74
73
75
- ⊆-trans-∷ˡ⁻ₗ : ∀ {x} {xs ys zs : List A} { τ : (x ∷ xs) ⊆ ys} {σ : ys ⊆ zs} →
74
+ ⊆-trans-∷ˡ⁻ₗ : ∀ {τ : (x ∷ xs) ⊆ ys} {σ : ys ⊆ zs} →
76
75
⊆-trans (∷ˡ⁻ τ) σ ≡ ∷ˡ⁻ (⊆-trans τ σ)
77
76
⊆-trans-∷ˡ⁻ₗ {σ = y ∷ʳ σ} = cong (y ∷ʳ_) ⊆-trans-∷ˡ⁻ₗ
78
77
⊆-trans-∷ˡ⁻ₗ {τ = y ∷ʳ τ} {σ = refl ∷ σ} = cong (y ∷ʳ_) ⊆-trans-∷ˡ⁻ₗ
79
78
⊆-trans-∷ˡ⁻ₗ {τ = refl ∷ τ} {σ = refl ∷ σ} = refl
80
79
81
- ⊆-∷ˡ⁻trans-∷ : ∀ {y} {xs ys zs : List A} { τ : xs ⊆ ys} {σ : (y ∷ ys) ⊆ zs} →
80
+ ⊆-∷ˡ⁻trans-∷ : ∀ {τ : xs ⊆ ys} {σ : (y ∷ ys) ⊆ zs} →
82
81
∷ˡ⁻ (⊆-trans (refl ∷ τ) σ) ≡ ⊆-trans (y ∷ʳ τ) σ
83
82
⊆-∷ˡ⁻trans-∷ {σ = y ∷ʳ σ} = cong (y ∷ʳ_) ⊆-∷ˡ⁻trans-∷
84
83
⊆-∷ˡ⁻trans-∷ {σ = refl ∷ σ} = refl
@@ -103,14 +102,14 @@ Any-resp-⊆ = lookup
103
102
104
103
-- First functor law: identity.
105
104
106
- All-resp-⊆-refl : ∀ {P : Pred A ℓ} {xs : List A} →
105
+ All-resp-⊆-refl : ∀ {P : Pred A ℓ} →
107
106
All-resp-⊆ ⊆-refl ≗ id {A = All P xs}
108
107
All-resp-⊆-refl [] = refl
109
108
All-resp-⊆-refl (p ∷ ps) = cong (p ∷_) (All-resp-⊆-refl ps)
110
109
111
110
-- Second functor law: composition.
112
111
113
- All-resp-⊆-trans : ∀ {P : Pred A ℓ} {xs ys zs} { τ : xs ⊆ ys} (τ′ : ys ⊆ zs) →
112
+ All-resp-⊆-trans : ∀ {P : Pred A ℓ} {τ : xs ⊆ ys} (τ′ : ys ⊆ zs) →
114
113
All-resp-⊆ {P = P} (⊆-trans τ τ′) ≗ All-resp-⊆ τ ∘ All-resp-⊆ τ′
115
114
All-resp-⊆-trans (_ ∷ʳ τ′) (p ∷ ps) = All-resp-⊆-trans τ′ ps
116
115
All-resp-⊆-trans {τ = _ ∷ʳ _ } (refl ∷ τ′) (p ∷ ps) = All-resp-⊆-trans τ′ ps
@@ -122,7 +121,7 @@ All-resp-⊆-trans {τ = [] } ([] ) [] = refl
122
121
123
122
-- First functor law: identity.
124
123
125
- Any-resp-⊆-refl : ∀ {P : Pred A ℓ} {xs} →
124
+ Any-resp-⊆-refl : ∀ {P : Pred A ℓ} →
126
125
Any-resp-⊆ ⊆-refl ≗ id {A = Any P xs}
127
126
Any-resp-⊆-refl (here p) = refl
128
127
Any-resp-⊆-refl (there i) = cong there (Any-resp-⊆-refl i)
@@ -131,7 +130,7 @@ lookup-⊆-refl = Any-resp-⊆-refl
131
130
132
131
-- Second functor law: composition.
133
132
134
- Any-resp-⊆-trans : ∀ {P : Pred A ℓ} {xs ys zs} { τ : xs ⊆ ys} (τ′ : ys ⊆ zs) →
133
+ Any-resp-⊆-trans : ∀ {P : Pred A ℓ} {τ : xs ⊆ ys} (τ′ : ys ⊆ zs) →
135
134
Any-resp-⊆ {P = P} (⊆-trans τ τ′) ≗ Any-resp-⊆ τ′ ∘ Any-resp-⊆ τ
136
135
Any-resp-⊆-trans (_ ∷ʳ τ′) i = cong there (Any-resp-⊆-trans τ′ i)
137
136
Any-resp-⊆-trans {τ = _ ∷ʳ _} (_ ∷ τ′) i = cong there (Any-resp-⊆-trans τ′ i)
@@ -147,7 +146,7 @@ lookup-⊆-trans = Any-resp-⊆-trans
147
146
-- Note: `lookup` can be seen as a strictly increasing reindexing
148
147
-- function for indices into `xs`, producing indices into `ys`.
149
148
150
- lookup-injective : ∀ {P : Pred A ℓ} {xs ys} { τ : xs ⊆ ys} {i j : Any P xs} →
149
+ lookup-injective : ∀ {P : Pred A ℓ} {τ : xs ⊆ ys} {i j : Any P xs} →
151
150
lookup τ i ≡ lookup τ j → i ≡ j
152
151
lookup-injective {τ = _ ∷ʳ _} = lookup-injective ∘′ there-injective
153
152
lookup-injective {τ = x≡y ∷ _} {here _} {here _} = cong here ∘′ subst-injective x≡y ∘′ here-injective
@@ -163,12 +162,12 @@ lookup-injective {τ = _ ∷ _} {there _} {there _} = cong there ∘′ lookup
163
162
-- Note: This lemma does not hold for Sublist.Setoid, but could hold for
164
163
-- a hypothetical Sublist.Groupoid where trans refl = id.
165
164
166
- from∈∘to∈ : ∀ {x : A} {xs ys} (τ : x ∷ xs ⊆ ys) →
165
+ from∈∘to∈ : ∀ (τ : x ∷ xs ⊆ ys) →
167
166
from∈ (to∈ τ) ≡ ⊆-trans (refl ∷ minimum xs) τ
168
167
from∈∘to∈ (x≡y ∷ τ) = cong (x≡y ∷_) ([]⊆-irrelevant _ _)
169
168
from∈∘to∈ (y ∷ʳ τ) = cong (y ∷ʳ_) (from∈∘to∈ τ)
170
169
171
- from∈∘lookup : ∀ {x : A} {xs ys} (τ : xs ⊆ ys) (i : x ∈ xs) →
170
+ from∈∘lookup : ∀ (τ : xs ⊆ ys) (i : x ∈ xs) →
172
171
from∈ (lookup τ i) ≡ ⊆-trans (from∈ i) τ
173
172
from∈∘lookup (y ∷ʳ τ) i = cong (y ∷ʳ_) (from∈∘lookup τ i)
174
173
from∈∘lookup (_ ∷ τ) (there i) = cong (_ ∷ʳ_) (from∈∘lookup τ i)
@@ -179,15 +178,14 @@ from∈∘lookup (refl ∷ τ) (here refl) = cong (refl ∷_) ([]⊆-irrelevant
179
178
180
179
-- A raw pushout is a weak pushout if the pushout square commutes.
181
180
182
- IsWeakPushout : ∀ {xs ys zs : List A} {τ : xs ⊆ ys} {σ : xs ⊆ zs} →
183
- RawPushout τ σ → Set a
181
+ IsWeakPushout : ∀ {τ : xs ⊆ ys} {σ : xs ⊆ zs} → RawPushout τ σ → Set _
184
182
IsWeakPushout {τ = τ} {σ = σ} rpo =
185
183
⊆-trans τ (RawPushout.leg₁ rpo) ≡
186
184
⊆-trans σ (RawPushout.leg₂ rpo)
187
185
188
186
-- Joining two list extensions with ⊆-pushout produces a weak pushout.
189
187
190
- ⊆-pushoutˡ-is-wpo : ∀ {xs ys zs : List A} (τ : xs ⊆ ys) (σ : xs ⊆ zs) →
188
+ ⊆-pushoutˡ-is-wpo : ∀ (τ : xs ⊆ ys) (σ : xs ⊆ zs) →
191
189
IsWeakPushout (⊆-pushoutˡ τ σ)
192
190
⊆-pushoutˡ-is-wpo [] σ
193
191
rewrite ⊆-trans-idʳ {τ = σ}
@@ -201,7 +199,7 @@ IsWeakPushout {τ = τ} {σ = σ} rpo =
201
199
202
200
-- From τ₁ ⊎ τ₂ = τ, compute the injection ι₁ such that τ₁ = ⊆-trans ι₁ τ.
203
201
204
- DisjointUnion-inj₁ : ∀ {xs ys zs xys : List A} {τ₁ : xs ⊆ zs} {τ₂ : ys ⊆ zs} {τ : xys ⊆ zs} →
202
+ DisjointUnion-inj₁ : ∀ {xys : List A} {τ₁ : xs ⊆ zs} {τ₂ : ys ⊆ zs} {τ : xys ⊆ zs} →
205
203
DisjointUnion τ₁ τ₂ τ → ∃ λ (ι₁ : xs ⊆ xys) → ⊆-trans ι₁ τ ≡ τ₁
206
204
DisjointUnion-inj₁ [] = [] , refl
207
205
DisjointUnion-inj₁ (y ∷ₙ d) = _ , cong (y ∷ʳ_) (proj₂ (DisjointUnion-inj₁ d))
@@ -210,7 +208,7 @@ DisjointUnion-inj₁ (x≈y ∷ᵣ d) = _ ∷ʳ _ , cong (_ ∷ʳ_) (proj₂
210
208
211
209
-- From τ₁ ⊎ τ₂ = τ, compute the injection ι₂ such that τ₂ = ⊆-trans ι₂ τ.
212
210
213
- DisjointUnion-inj₂ : ∀ {xs ys zs xys : List A} {τ₁ : xs ⊆ zs} {τ₂ : ys ⊆ zs} {τ : xys ⊆ zs} →
211
+ DisjointUnion-inj₂ : ∀ {xys : List A} {τ₁ : xs ⊆ zs} {τ₂ : ys ⊆ zs} {τ : xys ⊆ zs} →
214
212
DisjointUnion τ₁ τ₂ τ → ∃ λ (ι₂ : ys ⊆ xys) → ⊆-trans ι₂ τ ≡ τ₂
215
213
DisjointUnion-inj₂ [] = [] , refl
216
214
DisjointUnion-inj₂ (y ∷ₙ d) = _ , cong (y ∷ʳ_) (proj₂ (DisjointUnion-inj₂ d))
@@ -220,8 +218,7 @@ DisjointUnion-inj₂ (x≈y ∷ₗ d) = _ ∷ʳ _ , cong (_ ∷ʳ_) (proj₂
220
218
-- A sublist σ disjoint to both τ₁ and τ₂ is an equalizer
221
219
-- for the separators of τ₁ and τ₂.
222
220
223
- equalize-separators : ∀ {us xs ys zs : List A}
224
- {σ : us ⊆ zs} {τ₁ : xs ⊆ zs} {τ₂ : ys ⊆ zs} (let s = separateˡ τ₁ τ₂) →
221
+ equalize-separators : ∀ {σ : ws ⊆ zs} {τ₁ : xs ⊆ zs} {τ₂ : ys ⊆ zs} (let s = separateˡ τ₁ τ₂) →
225
222
Disjoint σ τ₁ → Disjoint σ τ₂ →
226
223
⊆-trans σ (Separation.separator₁ s) ≡
227
224
⊆-trans σ (Separation.separator₂ s)
0 commit comments