From fe2b3bddc38d2a17809e5b4a5b31be81d8812ddb Mon Sep 17 00:00:00 2001 From: MatthewDaggitt Date: Thu, 12 Oct 2023 17:44:00 +0900 Subject: [PATCH 1/2] Change definition of IsStrictTotalOrder --- CHANGELOG.md | 40 +++++++++++++++ src/Data/Bool/Properties.agda | 5 +- src/Data/Char/Properties.agda | 5 +- src/Data/Fin/Properties.agda | 5 +- src/Data/Integer/Properties.agda | 5 +- src/Data/List/Relation/Binary/Lex/Strict.agda | 5 +- src/Data/Nat/Binary/Properties.agda | 5 +- src/Data/Nat/Properties.agda | 9 +--- .../Product/Relation/Binary/Lex/Strict.agda | 9 ++-- src/Data/Rational/Properties.agda | 5 +- .../Rational/Unnormalised/Properties.agda | 5 +- src/Data/Sum/Relation/Binary/LeftOrder.agda | 5 +- src/Data/Vec/Relation/Binary/Lex/Strict.agda | 3 +- src/Induction/WellFounded.agda | 4 +- src/Relation/Binary.agda | 1 + src/Relation/Binary/Bundles.agda | 2 +- .../Binary/Construct/Add/Infimum/Strict.agda | 10 ++-- .../Binary/Construct/Add/Supremum/Strict.agda | 10 ++-- .../Binary/Construct/Flip/EqAndOrd.agda | 5 +- src/Relation/Binary/Construct/Flip/Ord.agda | 5 +- .../Binary/Construct/NonStrictToStrict.agda | 5 +- src/Relation/Binary/Construct/On.agda | 5 +- .../Binary/Morphism/OrderMonomorphism.agda | 5 +- src/Relation/Binary/Structures.agda | 51 ++++++++++--------- src/Relation/Binary/Structures/Biased.agda | 49 ++++++++++++++++++ 25 files changed, 162 insertions(+), 96 deletions(-) create mode 100644 src/Relation/Binary/Structures/Biased.agda diff --git a/CHANGELOG.md b/CHANGELOG.md index 988355bd5a..cf452b2bd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -918,6 +918,46 @@ Non-backwards compatible changes * The old names (and the names of all proofs about these functions) have been deprecated appropriately. +### Changes to definition of `IsStrictTotalOrder` + +* The previous definition of the record `IsStrictTotalOrder` did not build upon `IsStrictPartialOrder` + as would be expected. Instead it omitted several fields like irreflexivity as they were derivable from the + proof of trichotomy. However, this led to problems further up the hierarchy where bundles such as `StrictTotalOrder` + which contained multiple distinct proofs of `IsStrictPartialOrder`. + +* To remedy this the definition of `IsStrictTotalOrder` has been changed to so that it builds upon + `IsStrictPartialOrder` as would be expected. + +* To aid migration, the old record definition has been moved to `Relation.Binary.Structures.Biased` + which contains the `isStrictTotalOrderᶜ` smart constructor (which is re-exported by `Relation.Binary`) . + Therefore the old code: + ```agda + <-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_ + <-isStrictTotalOrder = record + { isEquivalence = isEquivalence + ; trans = <-trans + ; compare = <-cmp + } + ``` + can be migrated either by updating to the new record fields if you have a proof of `IsStrictPartialOrder` + available: + ```agda + <-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_ + <-isStrictTotalOrder = record + { isStrictPartialOrder = <-isStrictPartialOrder + ; compare = <-cmp + } + ``` + or simply applying the smart constructor to the record definition as follows: + ```agda + <-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_ + <-isStrictTotalOrder = isStrictTotalOrderᶜ record + { isEquivalence = isEquivalence + ; trans = <-trans + ; compare = <-cmp + } + ``` + ### Changes to triple reasoning interface * The module `Relation.Binary.Reasoning.Base.Triple` now takes an extra proof that the strict diff --git a/src/Data/Bool/Properties.agda b/src/Data/Bool/Properties.agda index 3c1c25d245..e911390366 100644 --- a/src/Data/Bool/Properties.agda +++ b/src/Data/Bool/Properties.agda @@ -210,9 +210,8 @@ true ; tri<; _Respects₂_) +open import Relation.Binary open import Relation.Binary.Consequences using (flip-Connex) open import Relation.Binary.PropositionalEquality open import Relation.Nullary hiding (Irrelevant) @@ -402,7 +397,7 @@ _>?_ = flip _?_ = flip _?_ = flip _ Date: Thu, 12 Oct 2023 17:49:50 +0900 Subject: [PATCH 2/2] Add comment about baised definition to main definition --- src/Relation/Binary/Structures.agda | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Relation/Binary/Structures.agda b/src/Relation/Binary/Structures.agda index 4ac059ea12..bf11d67250 100644 --- a/src/Relation/Binary/Structures.agda +++ b/src/Relation/Binary/Structures.agda @@ -235,7 +235,9 @@ record IsDecTotalOrder (_≤_ : Rel A ℓ₂) : Set (a ⊔ ℓ ⊔ ℓ₂) where -- Note that these orders are decidable. The current implementation --- of `Trichotomous` subsumes irreflexivity and asymmetry. +-- of `Trichotomous` subsumes irreflexivity and asymmetry. See +-- `Relation.Binary.Structures.Biased` for ways of constructing this +-- record without having to prove `isStrictPartialOrder`. record IsStrictTotalOrder (_<_ : Rel A ℓ₂) : Set (a ⊔ ℓ ⊔ ℓ₂) where field