You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add structures/bundles for pairs of strict and non-strict orders #1179
Currently, whenever we have a generic proof that involves both a non-strict and a strict order we translate from one to the other using Relation.Binary.Construct.NonStrictToStrict/StrictToNonStrict. This works fine for generic data, but runs into serious problems when dealing with data where the non-strict and strict orders exploit some structure of the data and are therefore not defined in that way. The most common examples are our numeric datatypes.
Currently we've been getting around this by adding specialised modules for each of the numeric datatypes, e.g. Data.List.Extrema.Nat, but this doesn't scale very well as it requires a module for each problematic datatype.
I propose adding some additional relational structures/bundles to the library along the following lines (names are definitely open for discussion!):
recordIsStrictNonStrictPair (_≤_ : Rel A ℓ₂) (_<_ : Rel A ℓ₃) :Set (a ⊔ ℓ ⊔ ℓ₂ ⊔ ℓ₃) wherefield<⇒≉ : _<_ ⇒ _≉_
<⇒≤ : _<_ ⇒ _≤_
≤∧≉⇒< :∀ {x y} → x ≤ y → x ≉ y → x < y
Is _≉_ from a setoid? So it's more like a triple than a pair then.
Well, our methodology, when it's working, sees ...Structures parametrised on the ambient _ ≈_, for which it is indeed canonical that _≉_ be defined as its negation, either locally in-place, or else a defintional extension of the underlying RawRelation/RawSetoid defined by _≈_. Cf. #2274 .
Relative to such parameterisation (and see #3053 for a higher-level view of the design issues involved), I think it would still make sense to think of these as 'pair'ed' rather than 'triple'd... but agree that a better name is required! And that the proposal is, on its face, a good one. Devils in the details?
Oh, I've looked for this too! I definitely have a need for IsTotalOrderPair.
I agree that it a bit odd to call it a pair as it is a predicate on the parameters, of which there are 3 (or even 4 if you count the carrier separately). However, I think that since much of the library is "relative to a given Setoid", it makes a certain amount of sense to not count it.
Looking up synonyms: we could go with 'Duo' or 'Dyad' for the relative case? [I'm fine with 'Pair', but would prefer a fulsome discussion.]
Activity
gallais commentedon Apr 29, 2020
Is
_≉_from a setoid? So it's more like a triple than a pair then.jamesmckinna commentedon Jul 9, 2026
Well, our methodology, when it's working, sees
...Structuresparametrised on the ambient_ ≈_, for which it is indeed canonical that_≉_be defined as its negation, either locally in-place, or else a defintional extension of the underlyingRawRelation/RawSetoiddefined by_≈_. Cf. #2274 .Relative to such parameterisation (and see #3053 for a higher-level view of the design issues involved), I think it would still make sense to think of these as 'pair'ed' rather than 'triple'd... but agree that a better name is required! And that the proposal is, on its face, a good one. Devils in the details?
JacquesCarette commentedon Jul 9, 2026
Oh, I've looked for this too! I definitely have a need for
IsTotalOrderPair.I agree that it a bit odd to call it a pair as it is a predicate on the parameters, of which there are 3 (or even 4 if you count the carrier separately). However, I think that since much of the library is "relative to a given Setoid", it makes a certain amount of sense to not count it.
Looking up synonyms: we could go with 'Duo' or 'Dyad' for the relative case? [I'm fine with 'Pair', but would prefer a fulsome discussion.]
jamesmckinna commentedon Jul 9, 2026
And... given such a structure/bundle, there should be a 'unified'
Reasoningsyntax for all the various relational steps?