Skip to content

Commit 8d5403a

Browse files
Remove implicit parameters from Sublist.Propositional.Properties (agda#2514)
* Remove implicit parameters from Sublist.Propositional.Properties * Addressed James' feedback * Fixed whitespace
1 parent 6633371 commit 8d5403a

File tree

2 files changed

+34
-35
lines changed

2 files changed

+34
-35
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ Bug-fixes
1919
Non-backwards compatible changes
2020
--------------------------------
2121

22-
In `Function.Related.TypeIsomorphisms`, the unprimed versions are more level polymorphic; and the primed versions retain `Level` homogeneous types for the `Semiring` axioms to hold.
22+
* In `Function.Related.TypeIsomorphisms`, the unprimed versions are more level polymorphic; and the primed versions retain `Level` homogeneous types for the `Semiring` axioms to hold.
23+
24+
* In `Data.List.Relation.Binary.Sublist.Propositional.Properties` the implicit module parameters `a` and `A` have been replaced with `variable`s. This should be a backwards compatible change for the overwhelming majority of uses, and would only be non-backwards compatible if you were explicitly supplying these implicit parameters for some reason when importing the module. Explicitly supplying the implicit parameters for functions exported from the module should not be affected.
2325

2426
Minor improvements
2527
------------------

src/Data/List/Relation/Binary/Sublist/Propositional/Properties.agda

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
{-# OPTIONS --cubical-compatible --safe #-}
88

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
1110

1211
open import Data.List.Base using (List; []; _∷_; map)
1312
open import Data.List.Membership.Propositional using (_∈_)
@@ -31,54 +30,54 @@ open import Relation.Unary using (Pred)
3130

3231
private
3332
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
3637

3738
------------------------------------------------------------------------
3839
-- Re-exporting setoid properties
3940

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)
4244

43-
map⁺ : {as bs} (f : A B) asbs map f as ⊆ map f bs
44-
map⁺ {B = B} f = SetoidProperties.map⁺ (setoid A) (setoid B) (cong f)
45+
map⁺ : (f : A B) xsys map f xs ⊆ map f ys
46+
map⁺ f = SetoidProperties.map⁺ (setoid _) (setoid _) (cong f)
4547

4648
------------------------------------------------------------------------
4749
-- Category laws for _⊆_
4850

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) τ
5253

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ʳ τ
5656

5757
-- Note: The associativity law is oriented such that rewriting with it
5858
-- may trigger reductions of ⊆-trans, which matches first on its
5959
-- second argument and then on its first argument.
6060

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}
6362
⊆-trans τ₁ (⊆-trans τ₂ τ₃) ≡ ⊆-trans (⊆-trans τ₁ τ₂) τ₃
6463
⊆-trans-assoc {τ₁ = τ₁} {τ₂ = τ₂} {τ₃ = τ₃} =
65-
SetoidProperties.⊆-trans-assoc (setoid A) (λ p _ _ ≡.sym (trans-assoc p)) τ₁ τ₂ τ₃
64+
SetoidProperties.⊆-trans-assoc (setoid _) (λ p _ _ ≡.sym (trans-assoc p)) τ₁ τ₂ τ₃
6665

6766
------------------------------------------------------------------------
6867
-- Laws concerning ⊆-trans and ∷ˡ⁻
6968

70-
⊆-trans-∷ˡ⁻ᵣ : {y} {xs ys zs : List A} {τ : xs ⊆ ys} {σ : (y ∷ ys) ⊆ zs}
69+
⊆-trans-∷ˡ⁻ᵣ : : xs ⊆ ys} {σ : (y ∷ ys) ⊆ zs}
7170
⊆-trans τ (∷ˡ⁻ σ) ≡ ⊆-trans (y ∷ʳ τ) σ
7271
⊆-trans-∷ˡ⁻ᵣ {σ = x ∷ σ} = refl
7372
⊆-trans-∷ˡ⁻ᵣ {σ = y ∷ʳ σ} = cong (y ∷ʳ_) ⊆-trans-∷ˡ⁻ᵣ
7473

75-
⊆-trans-∷ˡ⁻ₗ : {x} {xs ys zs : List A} {τ : (x ∷ xs) ⊆ ys} {σ : ys ⊆ zs}
74+
⊆-trans-∷ˡ⁻ₗ : : (x ∷ xs) ⊆ ys} {σ : ys ⊆ zs}
7675
⊆-trans (∷ˡ⁻ τ) σ ≡ ∷ˡ⁻ (⊆-trans τ σ)
7776
⊆-trans-∷ˡ⁻ₗ {σ = y ∷ʳ σ} = cong (y ∷ʳ_) ⊆-trans-∷ˡ⁻ₗ
7877
⊆-trans-∷ˡ⁻ₗ {τ = y ∷ʳ τ} {σ = refl ∷ σ} = cong (y ∷ʳ_) ⊆-trans-∷ˡ⁻ₗ
7978
⊆-trans-∷ˡ⁻ₗ {τ = refl ∷ τ} {σ = refl ∷ σ} = refl
8079

81-
⊆-∷ˡ⁻trans-∷ : {y} {xs ys zs : List A} {τ : xs ⊆ ys} {σ : (y ∷ ys) ⊆ zs}
80+
⊆-∷ˡ⁻trans-∷ : : xs ⊆ ys} {σ : (y ∷ ys) ⊆ zs}
8281
∷ˡ⁻ (⊆-trans (refl ∷ τ) σ) ≡ ⊆-trans (y ∷ʳ τ) σ
8382
⊆-∷ˡ⁻trans-∷ {σ = y ∷ʳ σ} = cong (y ∷ʳ_) ⊆-∷ˡ⁻trans-∷
8483
⊆-∷ˡ⁻trans-∷ {σ = refl ∷ σ} = refl
@@ -103,14 +102,14 @@ Any-resp-⊆ = lookup
103102

104103
-- First functor law: identity.
105104

106-
All-resp-⊆-refl : {P : Pred A ℓ} {xs : List A}
105+
All-resp-⊆-refl : {P : Pred A ℓ}
107106
All-resp-⊆ ⊆-refl ≗ id {A = All P xs}
108107
All-resp-⊆-refl [] = refl
109108
All-resp-⊆-refl (p ∷ ps) = cong (p ∷_) (All-resp-⊆-refl ps)
110109

111110
-- Second functor law: composition.
112111

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)
114113
All-resp-⊆ {P = P} (⊆-trans τ τ′) ≗ All-resp-⊆ τ ∘ All-resp-⊆ τ′
115114
All-resp-⊆-trans (_ ∷ʳ τ′) (p ∷ ps) = All-resp-⊆-trans τ′ ps
116115
All-resp-⊆-trans {τ = _ ∷ʳ _ } (refl ∷ τ′) (p ∷ ps) = All-resp-⊆-trans τ′ ps
@@ -122,7 +121,7 @@ All-resp-⊆-trans {τ = [] } ([] ) [] = refl
122121

123122
-- First functor law: identity.
124123

125-
Any-resp-⊆-refl : {P : Pred A ℓ} {xs}
124+
Any-resp-⊆-refl : {P : Pred A ℓ}
126125
Any-resp-⊆ ⊆-refl ≗ id {A = Any P xs}
127126
Any-resp-⊆-refl (here p) = refl
128127
Any-resp-⊆-refl (there i) = cong there (Any-resp-⊆-refl i)
@@ -131,7 +130,7 @@ lookup-⊆-refl = Any-resp-⊆-refl
131130

132131
-- Second functor law: composition.
133132

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)
135134
Any-resp-⊆ {P = P} (⊆-trans τ τ′) ≗ Any-resp-⊆ τ′ ∘ Any-resp-⊆ τ
136135
Any-resp-⊆-trans (_ ∷ʳ τ′) i = cong there (Any-resp-⊆-trans τ′ i)
137136
Any-resp-⊆-trans {τ = _ ∷ʳ _} (_ ∷ τ′) i = cong there (Any-resp-⊆-trans τ′ i)
@@ -147,7 +146,7 @@ lookup-⊆-trans = Any-resp-⊆-trans
147146
-- Note: `lookup` can be seen as a strictly increasing reindexing
148147
-- function for indices into `xs`, producing indices into `ys`.
149148

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}
151150
lookup τ i ≡ lookup τ j i ≡ j
152151
lookup-injective {τ = _ ∷ʳ _} = lookup-injective ∘′ there-injective
153152
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
163162
-- Note: This lemma does not hold for Sublist.Setoid, but could hold for
164163
-- a hypothetical Sublist.Groupoid where trans refl = id.
165164

166-
from∈∘to∈ : {x : A} {xs ys} : x ∷ xs ⊆ ys)
165+
from∈∘to∈ : : x ∷ xs ⊆ ys)
167166
from∈ (to∈ τ) ≡ ⊆-trans (refl ∷ minimum xs) τ
168167
from∈∘to∈ (x≡y ∷ τ) = cong (x≡y ∷_) ([]⊆-irrelevant _ _)
169168
from∈∘to∈ (y ∷ʳ τ) = cong (y ∷ʳ_) (from∈∘to∈ τ)
170169

171-
from∈∘lookup : {x : A} {xs ys}: xs ⊆ ys) (i : x ∈ xs)
170+
from∈∘lookup : : xs ⊆ ys) (i : x ∈ xs)
172171
from∈ (lookup τ i) ≡ ⊆-trans (from∈ i) τ
173172
from∈∘lookup (y ∷ʳ τ) i = cong (y ∷ʳ_) (from∈∘lookup τ i)
174173
from∈∘lookup (_ ∷ τ) (there i) = cong (_ ∷ʳ_) (from∈∘lookup τ i)
@@ -179,15 +178,14 @@ from∈∘lookup (refl ∷ τ) (here refl) = cong (refl ∷_) ([]⊆-irrelevant
179178

180179
-- A raw pushout is a weak pushout if the pushout square commutes.
181180

182-
IsWeakPushout : {xs ys zs : List A} {τ : xs ⊆ ys} {σ : xs ⊆ zs}
183-
RawPushout τ σ Set a
181+
IsWeakPushout : : xs ⊆ ys} {σ : xs ⊆ zs} RawPushout τ σ Set _
184182
IsWeakPushout {τ = τ} {σ = σ} rpo =
185183
⊆-trans τ (RawPushout.leg₁ rpo) ≡
186184
⊆-trans σ (RawPushout.leg₂ rpo)
187185

188186
-- Joining two list extensions with ⊆-pushout produces a weak pushout.
189187

190-
⊆-pushoutˡ-is-wpo : {xs ys zs : List A}: xs ⊆ ys) (σ : xs ⊆ zs)
188+
⊆-pushoutˡ-is-wpo : : xs ⊆ ys) (σ : xs ⊆ zs)
191189
IsWeakPushout (⊆-pushoutˡ τ σ)
192190
⊆-pushoutˡ-is-wpo [] σ
193191
rewrite ⊆-trans-idʳ {τ = σ}
@@ -201,7 +199,7 @@ IsWeakPushout {τ = τ} {σ = σ} rpo =
201199

202200
-- From τ₁ ⊎ τ₂ = τ, compute the injection ι₁ such that τ₁ = ⊆-trans ι₁ τ.
203201

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}
205203
DisjointUnion τ₁ τ₂ τ λ (ι₁ : xs ⊆ xys) ⊆-trans ι₁ τ ≡ τ₁
206204
DisjointUnion-inj₁ [] = [] , refl
207205
DisjointUnion-inj₁ (y ∷ₙ d) = _ , cong (y ∷ʳ_) (proj₂ (DisjointUnion-inj₁ d))
@@ -210,7 +208,7 @@ DisjointUnion-inj₁ (x≈y ∷ᵣ d) = _ ∷ʳ _ , cong (_ ∷ʳ_) (proj₂
210208

211209
-- From τ₁ ⊎ τ₂ = τ, compute the injection ι₂ such that τ₂ = ⊆-trans ι₂ τ.
212210

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}
214212
DisjointUnion τ₁ τ₂ τ λ (ι₂ : ys ⊆ xys) ⊆-trans ι₂ τ ≡ τ₂
215213
DisjointUnion-inj₂ [] = [] , refl
216214
DisjointUnion-inj₂ (y ∷ₙ d) = _ , cong (y ∷ʳ_) (proj₂ (DisjointUnion-inj₂ d))
@@ -220,8 +218,7 @@ DisjointUnion-inj₂ (x≈y ∷ₗ d) = _ ∷ʳ _ , cong (_ ∷ʳ_) (proj₂
220218
-- A sublist σ disjoint to both τ₁ and τ₂ is an equalizer
221219
-- for the separators of τ₁ and τ₂.
222220

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ˡ τ₁ τ₂)
225222
Disjoint σ τ₁ Disjoint σ τ₂
226223
⊆-trans σ (Separation.separator₁ s) ≡
227224
⊆-trans σ (Separation.separator₂ s)

0 commit comments

Comments
 (0)