From b06a7bbef3bb7311c53bd58617f6cf215b620605 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Mon, 9 Mar 2026 12:51:33 +0000 Subject: [PATCH 1/5] refactor: introduce revised notation, plus knock-ons --- CHANGELOG.md | 34 ++++++++++++++ .../List/Relation/Binary/Lex/NonStrict.agda | 31 ++++++++++--- src/Data/List/Relation/Binary/Lex/Strict.agda | 43 +++++++++++++----- .../Relation/Binary/Lex/NonStrict.agda | 24 +++++++--- .../Product/Relation/Binary/Lex/Strict.agda | 19 +++++++- src/Data/String/Properties.agda | 2 +- .../Vec/Relation/Binary/Lex/NonStrict.agda | 29 ++++++++++-- src/Data/Vec/Relation/Binary/Lex/Strict.agda | 44 ++++++++++++++----- 8 files changed, 186 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d61629e75..15991a643f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -89,6 +89,28 @@ Deprecated names ¬∀⟶∃¬- ↦ ¬∀⇒∃¬ ``` +* In `Data.List.Relation.Binary.Lex.NonStrict`: + ```agda + <-decidable ↦ _ xs≮ys xs≉ys ys (¬≤-next x≮y xs≮ys) (xs≉ys ∘ tail) (next (sym x≈y) ys xs≮ys xs≋̸ys xs>ys = tri> (≰-next x⊀y xs≮ys) (xs≋̸ys ∘ tail) (next (≈-sym x≈y) xs>ys) - <-decidable : Decidable _≈_ → Decidable _≺_ → + _ys = inj₂ (next (≈-sym x≈y) xs>ys) - ≤-dec : Decidable _≈_ → Decidable _≺_ → + _≤?_ : Decidable _≈_ → Decidable _≺_ → ∀ {m n} → Decidable (_≤_ {m} {n}) - ≤-dec = Core.decidable (yes tt) + _≤?_ = Core.decidable (yes tt) ≤-irrelevant : Irrelevant _≈_ → Irrelevant _≺_ → Irreflexive _≈_ _≺_ → ∀ {m n} → Irrelevant (_≤_ {m} {n}) @@ -278,10 +278,10 @@ module _ {_≈_ : Rel A ℓ₁} {_≺_ : Rel A ℓ₂} where ≤-isDecPartialOrder : IsDecStrictPartialOrder _≈_ _≺_ → ∀ {n} → IsDecPartialOrder (_≋_ {n} {n}) _≤_ ≤-isDecPartialOrder ≺-isDecStrictPartialOrder = record - { isPartialOrder = ≤-isPartialOrder isStrictPartialOrder - ; _≟_ = Pointwise.decidable _≟_ - ; _≤?_ = ≤-dec _≟_ _ Date: Tue, 10 Mar 2026 08:33:09 +0000 Subject: [PATCH 2/5] refactor: use `variable`s --- src/Data/List/Relation/Binary/Lex.agda | 29 +++++++++++-------- .../List/Relation/Binary/Lex/NonStrict.agda | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Data/List/Relation/Binary/Lex.agda b/src/Data/List/Relation/Binary/Lex.agda index 1baaf2a4a0..fe4fdde580 100644 --- a/src/Data/List/Relation/Binary/Lex.agda +++ b/src/Data/List/Relation/Binary/Lex.agda @@ -16,7 +16,7 @@ open import Data.List.Relation.Binary.Pointwise.Base open import Data.Sum.Base using (_⊎_; inj₁; inj₂; [_,_]) open import Function.Base using (_∘_; flip; id) open import Function.Bundles using (_⇔_; mk⇔) -open import Level using (_⊔_) +open import Level using (Level; _⊔_) open import Relation.Nullary.Negation.Core using (¬_; contradiction) open import Relation.Nullary.Decidable as Dec using (Dec; yes; no; _×?_; _⊎?_) @@ -26,6 +26,14 @@ open import Relation.Binary.Definitions using (Symmetric; Transitive; Irreflexive; Asymmetric; Antisymmetric ; Decidable; _Respects₂_; _Respects_) +private + variable + a ℓ₁ ℓ₂ : Level + A : Set a + x y : A + xs ys : List A + + ------------------------------------------------------------------------ -- Re-exporting the core definitions and properties @@ -35,20 +43,17 @@ open import Data.List.Relation.Binary.Lex.Core public ------------------------------------------------------------------------ -- Properties -module _ {a ℓ₁ ℓ₂} {A : Set a} {P : Set} - {_≈_ : Rel A ℓ₁} {_≺_ : Rel A ℓ₂} where +module _ {A : Set a} {P : Set} {_≈_ : Rel A ℓ₁} {_≺_ : Rel A ℓ₂} where private _≋_ = Pointwise _≈_ _<_ = Lex P _≈_ _≺_ - ¬≤-this : ∀ {x y xs ys} → ¬ (x ≈ y) → ¬ (x ≺ y) → - ¬ (x ∷ xs) < (y ∷ ys) + ¬≤-this : ¬ (x ≈ y) → ¬ (x ≺ y) → ¬ (x ∷ xs) < (y ∷ ys) ¬≤-this x≉y x≮y (this x≺y) = x≮y x≺y ¬≤-this x≉y x≮y (next x≈y xs Date: Tue, 17 Mar 2026 09:19:38 +0000 Subject: [PATCH 3/5] fix: typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 028a78f717..faea9f24d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -113,7 +113,7 @@ Deprecated names * In `Data.Product.Relation.Binary.Lex.NonStrict`: ```agda - ×-decidable ↦ <ₗₑₓ? + ×-decidable ↦ ≤ₗₑₓ? ``` * In `Data.Product.Relation.Binary.Lex.Strict`: From 059f5c988e3bf11a201233dd42b5c9a8a0e89f30 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Tue, 17 Mar 2026 09:24:26 +0000 Subject: [PATCH 4/5] fix: typo --- src/Data/Product/Relation/Binary/Lex/NonStrict.agda | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Data/Product/Relation/Binary/Lex/NonStrict.agda b/src/Data/Product/Relation/Binary/Lex/NonStrict.agda index 3583836e90..873cc344b9 100644 --- a/src/Data/Product/Relation/Binary/Lex/NonStrict.agda +++ b/src/Data/Product/Relation/Binary/Lex/NonStrict.agda @@ -82,9 +82,9 @@ module _ {_≈₁_ : Rel A ℓ₁} {_≤₁_ : Rel A ℓ₂} {_≤₂_ : Rel B ... | inj₁ x₂≤y₂ = inj₁ (inj₂ (x₁≈y₁ , x₂≤y₂)) ... | inj₂ x₂≥y₂ = inj₂ (inj₂ (sym₁ x₁≈y₁ , x₂≥y₂)) - <ₗₑₓ? : Decidable _≈₁_ → Decidable _≤₁_ → Decidable _≤₂_ → + ≤ₗₑₓ? : Decidable _≈₁_ → Decidable _≤₁_ → Decidable _≤₂_ → Decidable _≤ₗₑₓ_ - <ₗₑₓ? ≈?₁ ≤?₁ ≤?₂ = + ≤ₗₑₓ? ≈?₁ ≤?₁ ≤?₂ = Strict.<ₗₑₓ? ≈?₁ (Conv.<-decidable _ _ ≈?₁ ≤?₁) ≤?₂ module _ {_≈₁_ : Rel A ℓ₁} {_≤₁_ : Rel A ℓ₂} @@ -157,7 +157,7 @@ module _ {_≈₁_ : Rel A ℓ₁} {_≤₁_ : Rel A ℓ₂} (isTotalOrder to₁) (isTotalOrder to₂) ; _≟_ = Pointwise.×-decidable (_≟_ to₁) (_≟_ to₂) - ; _≤?_ = <ₗₑₓ? (_≟_ to₁) (_≤?_ to₁) (_≤?_ to₂) + ; _≤?_ = ≤ₗₑₓ? (_≟_ to₁) (_≤?_ to₁) (_≤?_ to₂) } where open IsDecTotalOrder @@ -192,8 +192,8 @@ module _ {_≈₁_ : Rel A ℓ₁} {_≤₁_ : Rel A ℓ₂} -- Version 2.4 -×-decidable = <ₗₑₓ? +×-decidable = ≤ₗₑₓ? {-# WARNING_ON_USAGE ×-decidable "Warning: ×-decidable was deprecated in v2.4. -Please use <ₗₑₓ? instead." +Please use ≤ₗₑₓ? instead." #-} From 09327cd699d998059e039928eec9bc969fb36991 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Tue, 17 Mar 2026 09:26:13 +0000 Subject: [PATCH 5/5] fix: whitespace --- src/Data/List/Relation/Binary/Lex.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/List/Relation/Binary/Lex.agda b/src/Data/List/Relation/Binary/Lex.agda index fe4fdde580..979fb6e4c0 100644 --- a/src/Data/List/Relation/Binary/Lex.agda +++ b/src/Data/List/Relation/Binary/Lex.agda @@ -32,7 +32,7 @@ private A : Set a x y : A xs ys : List A - + ------------------------------------------------------------------------