Skip to content

Commit 7f64664

Browse files
Change definition of IsStrictTotalOrder (#2137)
1 parent 98f8e40 commit 7f64664

File tree

25 files changed

+164
-96
lines changed

25 files changed

+164
-96
lines changed

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,46 @@ Non-backwards compatible changes
918918

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

921+
### Changes to definition of `IsStrictTotalOrder`
922+
923+
* The previous definition of the record `IsStrictTotalOrder` did not build upon `IsStrictPartialOrder`
924+
as would be expected. Instead it omitted several fields like irreflexivity as they were derivable from the
925+
proof of trichotomy. However, this led to problems further up the hierarchy where bundles such as `StrictTotalOrder`
926+
which contained multiple distinct proofs of `IsStrictPartialOrder`.
927+
928+
* To remedy this the definition of `IsStrictTotalOrder` has been changed to so that it builds upon
929+
`IsStrictPartialOrder` as would be expected.
930+
931+
* To aid migration, the old record definition has been moved to `Relation.Binary.Structures.Biased`
932+
which contains the `isStrictTotalOrderᶜ` smart constructor (which is re-exported by `Relation.Binary`) .
933+
Therefore the old code:
934+
```agda
935+
<-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_
936+
<-isStrictTotalOrder = record
937+
{ isEquivalence = isEquivalence
938+
; trans = <-trans
939+
; compare = <-cmp
940+
}
941+
```
942+
can be migrated either by updating to the new record fields if you have a proof of `IsStrictPartialOrder`
943+
available:
944+
```agda
945+
<-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_
946+
<-isStrictTotalOrder = record
947+
{ isStrictPartialOrder = <-isStrictPartialOrder
948+
; compare = <-cmp
949+
}
950+
```
951+
or simply applying the smart constructor to the record definition as follows:
952+
```agda
953+
<-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_
954+
<-isStrictTotalOrder = isStrictTotalOrderᶜ record
955+
{ isEquivalence = isEquivalence
956+
; trans = <-trans
957+
; compare = <-cmp
958+
}
959+
```
960+
921961
### Changes to triple reasoning interface
922962

923963
* The module `Relation.Binary.Reasoning.Base.Triple` now takes an extra proof that the strict

src/Data/Bool/Properties.agda

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,8 @@ true <? _ = no (λ())
210210

211211
<-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_
212212
<-isStrictTotalOrder = record
213-
{ isEquivalence = isEquivalence
214-
; trans = <-trans
215-
; compare = <-cmp
213+
{ isStrictPartialOrder = <-isStrictPartialOrder
214+
; compare = <-cmp
216215
}
217216

218217
-- Bundles

src/Data/Char/Properties.agda

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,8 @@ _<?_ = On.decidable toℕ ℕ._<_ ℕₚ._<?_
123123

124124
<-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_
125125
<-isStrictTotalOrder = record
126-
{ isEquivalence = PropEq.isEquivalence
127-
; trans = λ {a} {b} {c} <-trans {a} {b} {c}
128-
; compare = <-cmp
126+
{ isStrictPartialOrder = <-isStrictPartialOrder
127+
; compare = <-cmp
129128
}
130129

131130
<-strictPartialOrder : StrictPartialOrder _ _ _

src/Data/Fin/Properties.agda

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,8 @@ m <? n = suc (toℕ m) ℕₚ.≤? toℕ n
406406

407407
<-isStrictTotalOrder : IsStrictTotalOrder {A = Fin n} _≡_ _<_
408408
<-isStrictTotalOrder = record
409-
{ isEquivalence = P.isEquivalence
410-
; trans = <-trans
411-
; compare = <-cmp
409+
{ isStrictPartialOrder = <-isStrictPartialOrder
410+
; compare = <-cmp
412411
}
413412

414413
------------------------------------------------------------------------

src/Data/Integer/Properties.agda

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,8 @@ _<?_ : Decidable _<_
331331

332332
<-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_
333333
<-isStrictTotalOrder = record
334-
{ isEquivalence = isEquivalence
335-
; trans = <-trans
336-
; compare = <-cmp
334+
{ isStrictPartialOrder = <-isStrictPartialOrder
335+
; compare = <-cmp
337336
}
338337

339338
------------------------------------------------------------------------

src/Data/List/Relation/Binary/Lex/Strict.agda

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,8 @@ module _ {a ℓ₁ ℓ₂} {A : Set a} where
121121
<-isStrictTotalOrder : IsStrictTotalOrder _≈_ _≺_
122122
IsStrictTotalOrder _≋_ _<_
123123
<-isStrictTotalOrder sto = record
124-
{ isEquivalence = Pointwise.isEquivalence isEquivalence
125-
; trans = <-transitive isEquivalence <-resp-≈ trans
126-
; compare = <-compare Eq.sym compare
124+
{ isStrictPartialOrder = <-isStrictPartialOrder isStrictPartialOrder
125+
; compare = <-compare Eq.sym compare
127126
} where open IsStrictTotalOrder sto
128127

129128
<-strictPartialOrder : {a ℓ₁ ℓ₂} StrictPartialOrder a ℓ₁ ℓ₂

src/Data/Nat/Binary/Properties.agda

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,8 @@ _<?_ = tri⇒dec< <-cmp
414414

415415
<-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_
416416
<-isStrictTotalOrder = record
417-
{ isEquivalence = isEquivalence
418-
; trans = <-trans
419-
; compare = <-cmp
417+
{ isStrictPartialOrder = <-isStrictPartialOrder
418+
; compare = <-cmp
420419
}
421420

422421
------------------------------------------------------------------------

src/Data/Nat/Properties.agda

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@ open import Level using (0ℓ)
3232
open import Relation.Unary as U using (Pred)
3333
open import Relation.Binary.Core
3434
using (_⇒_; _Preserves_⟶_; _Preserves₂_⟶_⟶_)
35-
open import Relation.Binary.Bundles
36-
using (DecSetoid; Preorder; TotalPreorder; Poset; TotalOrder; DecTotalOrder; StrictPartialOrder; StrictTotalOrder)
37-
open import Relation.Binary.Structures
38-
using (IsDecEquivalence; IsPreorder; IsTotalPreorder; IsPartialOrder; IsTotalOrder; IsDecTotalOrder; IsStrictPartialOrder; IsStrictTotalOrder)
39-
open import Relation.Binary.Definitions
40-
using (DecidableEquality; Irrelevant; Reflexive; Antisymmetric; Transitive; Total; Decidable; Connex; Irreflexive; Asymmetric; LeftTrans; RightTrans; Trichotomous; tri≈; tri>; tri<; _Respects₂_)
35+
open import Relation.Binary
4136
open import Relation.Binary.Consequences using (flip-Connex)
4237
open import Relation.Binary.PropositionalEquality
4338
open import Relation.Nullary hiding (Irrelevant)
@@ -402,7 +397,7 @@ _>?_ = flip _<?_
402397
}
403398

404399
<-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_
405-
<-isStrictTotalOrder = record
400+
<-isStrictTotalOrder = isStrictTotalOrderᶜ record
406401
{ isEquivalence = isEquivalence
407402
; trans = <-trans
408403
; compare = <-cmp

src/Data/Product/Relation/Binary/Lex/Strict.agda

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,9 @@ module _ {_≈₁_ : Rel A ℓ₁} {_<₁_ : Rel A ℓ₂}
269269
IsStrictTotalOrder _≋_ _<ₗₑₓ_
270270
×-isStrictTotalOrder spo₁ spo₂ =
271271
record
272-
{ isEquivalence = Pointwise.×-isEquivalence
273-
(isEquivalence spo₁) (isEquivalence spo₂)
274-
; trans = ×-transitive {_<₁_ = _<₁_} {_<₂_ = _<₂_}
275-
(isEquivalence spo₁)
276-
(<-resp-≈ spo₁) (trans spo₁)
277-
(trans spo₂)
272+
{ isStrictPartialOrder = ×-isStrictPartialOrder
273+
(isStrictPartialOrder spo₁)
274+
(isStrictPartialOrder spo₂)
278275
; compare = ×-compare (Eq.sym spo₁) (compare spo₁)
279276
(compare spo₂)
280277
}

src/Data/Rational/Properties.agda

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,9 +702,8 @@ _>?_ = flip _<?_
702702

703703
<-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_
704704
<-isStrictTotalOrder = record
705-
{ isEquivalence = isEquivalence
706-
; trans = <-trans
707-
; compare = <-cmp
705+
{ isStrictPartialOrder = <-isStrictPartialOrder
706+
; compare = <-cmp
708707
}
709708

710709
<-isDenseLinearOrder : IsDenseLinearOrder _≡_ _<_

0 commit comments

Comments
 (0)