Skip to content

Commit a2341cc

Browse files
jamesmckinnaandreasabel
authored andcommitted
De-symmetrising Relation.Binary.Bundles.Preorder._∼_ (#2099)
1 parent 698dfee commit a2341cc

File tree

18 files changed

+156
-69
lines changed

18 files changed

+156
-69
lines changed

CHANGELOG.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,23 @@ Non-backwards compatible changes
797797
IO.Instances
798798
```
799799

800+
### (Issue #2096) Introduction of flipped relation symbol for `Relation.Binary.Bundles.Preorder`
801+
802+
* Previously, the relation symbol `_∼_` was (notationally) symmetric, so that its
803+
converse relation could only be discussed *semantically* in terms of `flip _∼_`
804+
in `Relation.Binary.Properties.Preorder`, `Relation.Binary.Construct.Flip.{Ord|EqAndOrd}`
805+
806+
* Now, the symbol `_∼_` has been renamed to a new symbol `_≲_`, with `_≳_`
807+
introduced as a definition in `Relation.Binary.Bundles.Preorder` whose properties
808+
in `Relation.Binary.Properties.Preorder` now refer to it. Partial backwards compatible
809+
has been achieved by redeclaring a deprecated version of the old name in the record.
810+
Therefore, only _declarations_ of `PartialOrder` records will need their field names
811+
updating.
812+
813+
* NB (issues #1214 #2098) the corresponding situation regarding the `flip`ped
814+
relation symbols `_≥_`, `_>_` (and their negated versions!) has not (yet)
815+
been addressed.
816+
800817
### Standardisation of `insertAt`/`updateAt`/`removeAt`
801818

802819
* Previously, the names and argument order of index-based insertion, update and removal functions for
@@ -840,7 +857,6 @@ Non-backwards compatible changes
840857

841858
* The old names (and the names of all proofs about these functions) have been deprecated appropriately.
842859

843-
844860
### Changes to triple reasoning interface
845861

846862
* The module `Relation.Binary.Reasoning.Base.Triple` now takes an extra proof that the strict
@@ -1251,6 +1267,11 @@ Deprecated names
12511267
push-function-into-if ↦ if-float
12521268
```
12531269

1270+
* In `Data.Container.Related`:
1271+
```
1272+
_∼[_]_ ↦ _≲[_]_
1273+
```
1274+
12541275
* In `Data.Fin.Base`: two new, hopefully more memorable, names `↑ˡ` `↑ʳ`
12551276
for the 'left', resp. 'right' injection of a Fin m into a 'larger' type,
12561277
`Fin (m + n)`, resp. `Fin (n + m)`, with argument order to reflect the
@@ -1661,6 +1682,16 @@ Deprecated names
16611682
fromForeign ↦ Foreign.Haskell.Coerce.coerce
16621683
```
16631684

1685+
* In `Relation.Binary.Bundles.Preorder`:
1686+
```
1687+
_∼_ ↦ _≲_
1688+
```
1689+
1690+
* In `Relation.Binary.Indexed.Heterogeneous.Bundles.Preorder`:
1691+
```
1692+
_∼_ ↦ _≲_
1693+
```
1694+
16641695
* In `Relation.Binary.Properties.Preorder`:
16651696
```
16661697
invIsPreorder ↦ converse-isPreorder

src/Data/Container/Related.agda

+19-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,23 @@ open Related public
3333
Setoid (s ⊔ p ⊔ ℓ) (p ⊔ ℓ)
3434
[ k ]-Equality C X = Related.InducedEquivalence₂ k (_∈_ {C = C} {X = X})
3535

36-
infix 4 _[_]_
37-
_[_]_ : {s p x} {C : Container s p} {X : Set x}
36+
infix 4 _[_]_
37+
_[_]_ : {s p x} {C : Container s p} {X : Set x}
3838
⟦ C ⟧ X Kind ⟦ C ⟧ X Set (p ⊔ x)
39-
_∼[_]_ {C = C} {X} xs k ys = Preorder._∼_ ([ k ]-Order C X) xs ys
39+
_≲[_]_ {C = C} {X} xs k ys = Preorder._≲_ ([ k ]-Order C X) xs ys
40+
41+
42+
43+
------------------------------------------------------------------------
44+
-- DEPRECATED
45+
------------------------------------------------------------------------
46+
-- Please use the new names as continuing support for the old names is
47+
-- not guaranteed.
48+
49+
-- Version 2.0
50+
51+
infix 4 _∼[_]_
52+
_∼[_]_ = _≲[_]_
53+
{-# WARNING_ON_USAGE _∼[_]_
54+
"Warning: _∼[_]_ was deprecated in v2.0. Please use _≲[_]_ instead. "
55+
#-}

src/Data/Container/Relation/Unary/Any/Properties.agda

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module _ {s p} {C : Container s p} {x} {X : Set x}
6464
-- ◇ is a congruence for bag and set equality and related preorders.
6565

6666
cong : {k} {xs₁ xs₂ : ⟦ C ⟧ X}
67-
( x Related k (P₁ x) (P₂ x)) xs₁ [ k ] xs₂
67+
( x Related k (P₁ x) (P₂ x)) xs₁ [ k ] xs₂
6868
Related k (◇ C P₁ xs₁) (◇ C P₂ xs₂)
6969
cong {k} {xs₁} {xs₂} P₁↔P₂ xs₁≈xs₂ =
7070
◇ C P₁ xs₁ ↔⟨ ↔∈ C ⟩
@@ -185,8 +185,8 @@ module _ {s p} (C : Container s p) {x y} {X : Set x} {Y : Set y}
185185
{ℓ} (P : Pred Y ℓ) where
186186

187187
map-cong : {k} {f₁ f₂ : X Y} {xs₁ xs₂ : ⟦ C ⟧ X}
188-
f₁ ≗ f₂ xs₁ [ k ] xs₂
189-
map f₁ xs₁ [ k ] map f₂ xs₂
188+
f₁ ≗ f₂ xs₁ [ k ] xs₂
189+
map f₁ xs₁ [ k ] map f₂ xs₂
190190
map-cong {f₁ = f₁} {f₂} {xs₁} {xs₂} f₁≗f₂ xs₁≈xs₂ {x} =
191191
x ∈ map f₁ xs₁ ↔⟨ map↔∘ C (_≡_ x) f₁ ⟩
192192
◇ C (λ y x ≡ f₁ y) xs₁ ∼⟨ cong (Related.↔⇒ ∘ helper) xs₁≈xs₂ ⟩
@@ -286,7 +286,7 @@ module _ {s₁ s₂ p₁ p₂} {C₁ : Container s₁ p₁} {C₂ : Container s
286286

287287
module _ {s p} {C : Container s p} {x} {X : Set x} where
288288

289-
linear-identity : {xs : ⟦ C ⟧ X} (m : C ⊸ C) ⟪ m ⟫⊸ xs [ bag ] xs
289+
linear-identity : {xs : ⟦ C ⟧ X} (m : C ⊸ C) ⟪ m ⟫⊸ xs [ bag ] xs
290290
linear-identity {xs} m {x} =
291291
x ∈ ⟪ m ⟫⊸ xs ↔⟨ remove-linear (_≡_ x) m ⟩
292292
x ∈ xs ∎

src/Data/List/Relation/Binary/BagAndSetEquality.agda

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ open Related public using (Kind; SymmetricKind) renaming
7272

7373
infix 4 _∼[_]_
7474

75-
_∼[_]_ : List A Kind List A Set _
76-
_∼[_]_ {A = A} xs k ys = Preorder.__ ([ k ]-Order A) xs ys
75+
_∼[_]_ : {a} {A : Set a} List A Kind List A Set _
76+
_∼[_]_ {A = A} xs k ys = Preorder.__ ([ k ]-Order A) xs ys
7777

7878
private
7979
module Eq {k a} {A : Set a} = Setoid ([ k ]-Equality A)

src/Effect/Monad/Partiality.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ module _ {A : Set a} {_∼_ : A → A → Set ℓ} where
301301
preorder pre k = record
302302
{ Carrier = A ⊥
303303
; _≈_ = _≡_
304-
; __ = Rel k
304+
; __ = Rel k
305305
; isPreorder = record
306306
{ isEquivalence = P.isEquivalence
307307
; reflexive = refl′

src/Function/Related.agda

+2-2
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ InducedPreorder₁ : Kind → ∀ {a s} {A : Set a} →
404404
(A Set s) Preorder _ _ _
405405
InducedPreorder₁ k S = record
406406
{ _≈_ = _≡_
407-
; __ = InducedRelation₁ k S
407+
; __ = InducedRelation₁ k S
408408
; isPreorder = record
409409
{ isEquivalence = P.isEquivalence
410410
; reflexive = reflexive ∘
@@ -437,7 +437,7 @@ InducedPreorder₂ : Kind → ∀ {a b s} {A : Set a} {B : Set b} →
437437
(A B Set s) Preorder _ _ _
438438
InducedPreorder₂ k _S_ = record
439439
{ _≈_ = _≡_
440-
; __ = InducedRelation₂ k _S_
440+
; __ = InducedRelation₂ k _S_
441441
; isPreorder = record
442442
{ isEquivalence = P.isEquivalence
443443
; reflexive = λ x≡y {z}

src/Function/Related/Propositional.agda

+2-2
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ InducedRelation₁ k P = λ x y → P x ∼[ k ] P y
339339
InducedPreorder₁ : Kind (P : A Set p) Preorder _ _ _
340340
InducedPreorder₁ k P = record
341341
{ _≈_ = _≡_
342-
; __ = InducedRelation₁ k P
342+
; __ = InducedRelation₁ k P
343343
; isPreorder = record
344344
{ isEquivalence = P.isEquivalence
345345
; reflexive = reflexive ∘
@@ -369,7 +369,7 @@ InducedRelation₂ k _S_ = λ x y → ∀ {z} → (z S x) ∼[ k ] (z S y)
369369
InducedPreorder₂ : Kind {s} (A B Set s) Preorder _ _ _
370370
InducedPreorder₂ k _S_ = record
371371
{ _≈_ = _≡_
372-
; __ = InducedRelation₂ k _S_
372+
; __ = InducedRelation₂ k _S_
373373
; isPreorder = record
374374
{ isEquivalence = P.isEquivalence
375375
; reflexive = λ x≡y {z}

src/Relation/Binary/Bundles.agda

+26-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
module Relation.Binary.Bundles where
1212

13+
open import Function.Base using (flip)
1314
open import Level
1415
open import Relation.Nullary.Negation using (¬_)
1516
open import Relation.Binary.Core
@@ -73,12 +74,12 @@ record DecSetoid c ℓ : Set (suc (c ⊔ ℓ)) where
7374
------------------------------------------------------------------------
7475

7576
record Preorder c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where
76-
infix 4 _≈_ __
77+
infix 4 _≈_ __
7778
field
7879
Carrier : Set c
7980
_≈_ : Rel Carrier ℓ₁ -- The underlying equality.
80-
__ : Rel Carrier ℓ₂ -- The relation.
81-
isPreorder : IsPreorder _≈_ __
81+
__ : Rel Carrier ℓ₂ -- The relation.
82+
isPreorder : IsPreorder _≈_ __
8283

8384
open IsPreorder isPreorder public
8485
hiding (module Eq)
@@ -91,6 +92,12 @@ record Preorder c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where
9192

9293
open Setoid setoid public
9394

95+
infix 4 _≳_
96+
_≳_ = flip _≲_
97+
98+
infix 4 _∼_ -- for deprecation
99+
_∼_ = _≲_
100+
94101

95102
record TotalPreorder c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where
96103
infix 4 _≈_ _≲_
@@ -107,7 +114,7 @@ record TotalPreorder c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where
107114
preorder = record { isPreorder = isPreorder }
108115

109116
open Preorder preorder public
110-
using (module Eq)
117+
using (module Eq; _≳_)
111118

112119

113120
------------------------------------------------------------------------
@@ -331,3 +338,18 @@ record ApartnessRelation c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) w
331338
isApartnessRelation : IsApartnessRelation _≈_ _#_
332339

333340
open IsApartnessRelation isApartnessRelation public
341+
342+
343+
344+
345+
------------------------------------------------------------------------
346+
-- DEPRECATED
347+
------------------------------------------------------------------------
348+
-- Please use the new names as continuing support for the old names is
349+
-- not guaranteed.
350+
351+
-- Version 2.0
352+
353+
{-# WARNING_ON_USAGE Preorder._∼_
354+
"Warning: Preorder._∼_ was deprecated in v2.0. Please use Preorder._≲_ instead. "
355+
#-}

src/Relation/Binary/Construct/Closure/ReflexiveTransitive/Properties.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ module _ {i t} {I : Set i} (T : Rel I t) where
104104
preorder : Preorder _ _ _
105105
preorder = record
106106
{ _≈_ = _≡_
107-
; __ = Star T
107+
; __ = Star T
108108
; isPreorder = isPreorder
109109
}
110110

src/Relation/Binary/HeterogeneousEquality.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ preorder : Set ℓ → Preorder ℓ ℓ ℓ
219219
preorder A = record
220220
{ Carrier = A
221221
; _≈_ = _≡_
222-
; __ = λ x y x ≅ y
222+
; __ = λ x y x ≅ y
223223
; isPreorder = isPreorder-≡
224224
}
225225

src/Relation/Binary/Indexed/Heterogeneous/Bundles.agda

+20-3
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,28 @@ record IndexedSetoid {i} (I : Set i) c ℓ : Set (suc (i ⊔ c ⊔ ℓ)) where
3333

3434
record IndexedPreorder {i} (I : Set i) c ℓ₁ ℓ₂ :
3535
Set (suc (i ⊔ c ⊔ ℓ₁ ⊔ ℓ₂)) where
36-
infix 4 _≈_ __
36+
infix 4 _≈_ __
3737
field
3838
Carrier : I Set c
3939
_≈_ : IRel Carrier ℓ₁ -- The underlying equality.
40-
__ : IRel Carrier ℓ₂ -- The relation.
41-
isPreorder : IsIndexedPreorder Carrier _≈_ __
40+
__ : IRel Carrier ℓ₂ -- The relation.
41+
isPreorder : IsIndexedPreorder Carrier _≈_ __
4242

4343
open IsIndexedPreorder isPreorder public
44+
45+
infix 4 _∼_
46+
_∼_ = _≲_
47+
48+
49+
50+
------------------------------------------------------------------------
51+
-- DEPRECATED
52+
------------------------------------------------------------------------
53+
-- Please use the new names as continuing support for the old names is
54+
-- not guaranteed.
55+
56+
-- Version 2.0
57+
58+
{-# WARNING_ON_USAGE IndexedPreorder._∼_
59+
"Warning: IndexedPreorder._∼_ was deprecated in v2.0. Please use IndexedPreorder._≲_ instead. "
60+
#-}

src/Relation/Binary/Indexed/Heterogeneous/Construct/At.agda

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ module _ {a i} {I : Set i} {A : I → Set a} where
2727
}
2828
where open IsIndexedEquivalence isEq
2929

30-
isPreorder : {ℓ₁ ℓ₂} {_≈_ : IRel A ℓ₁} {__ : IRel A ℓ₂}
31-
IsIndexedPreorder A _≈_ __
32-
(index : I) IsPreorder (_≈_ {index}) __
30+
isPreorder : {ℓ₁ ℓ₂} {_≈_ : IRel A ℓ₁} {__ : IRel A ℓ₂}
31+
IsIndexedPreorder A _≈_ __
32+
(index : I) IsPreorder (_≈_ {index}) __
3333
isPreorder isPreorder index = record
3434
{ isEquivalence = isEquivalence O.isEquivalence index
3535
; reflexive = O.reflexive
@@ -54,7 +54,7 @@ module _ {a i} {I : Set i} where
5454
preorder O index = record
5555
{ Carrier = O.Carrier index
5656
; _≈_ = O._≈_
57-
; __ = O.__
57+
; __ = O.__
5858
; isPreorder = isPreorder O.isPreorder index
5959
}
6060
where module O = IndexedPreorder O

src/Relation/Binary/Indexed/Heterogeneous/Structures.agda

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ record IsIndexedEquivalence : Set (i ⊔ a ⊔ ℓ) where
3434
reflexive P.refl = refl
3535

3636

37-
record IsIndexedPreorder {ℓ₂} (__ : IRel A ℓ₂) : Set (i ⊔ a ⊔ ℓ ⊔ ℓ₂) where
37+
record IsIndexedPreorder {ℓ₂} (__ : IRel A ℓ₂) : Set (i ⊔ a ⊔ ℓ ⊔ ℓ₂) where
3838
field
3939
isEquivalence : IsIndexedEquivalence
40-
reflexive : {i j} (_≈_ {i} {j}) ⟨ _⇒_ ⟩ __
41-
trans : Transitive A __
40+
reflexive : {i j} (_≈_ {i} {j}) ⟨ _⇒_ ⟩ __
41+
trans : Transitive A __
4242

4343
module Eq = IsIndexedEquivalence isEquivalence
4444

45-
refl : Reflexive A __
45+
refl : Reflexive A __
4646
refl = reflexive Eq.refl

src/Relation/Binary/Morphism/Bundles.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ record PreorderHomomorphism (S₁ : Preorder ℓ₁ ℓ₂ ℓ₃)
7070
open Preorder
7171
field
7272
⟦_⟧ : Carrier S₁ Carrier S₂
73-
isOrderHomomorphism : IsOrderHomomorphism (_≈_ S₁) (_≈_ S₂) (__ S₁) (__ S₂) ⟦_⟧
73+
isOrderHomomorphism : IsOrderHomomorphism (_≈_ S₁) (_≈_ S₂) (__ S₁) (__ S₂) ⟦_⟧
7474

7575
open IsOrderHomomorphism isOrderHomomorphism public
7676

0 commit comments

Comments
 (0)