From c6fc2bd6db9b838d85a8f3dbbf7d5ce3ce892c10 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Wed, 21 Jun 2023 09:46:16 +0100 Subject: [PATCH 01/80] towards issue #1998: `Data.Nat.Base`; `CHANGELOG` --- CHANGELOG.md | 9 +++++++++ src/Data/Nat/Base.agda | 31 ++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25bc7bd058..1040d1f081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2155,9 +2155,18 @@ Other minor changes pattern z-nonZero⁻¹ (suc n) = z″_ _<″_ : Rel ℕ 0ℓ From dd0165f778284680dc680b321757f0f7f46303aa Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Wed, 21 Jun 2023 09:54:15 +0100 Subject: [PATCH 02/80] tidied up `CHANGELOG` --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1040d1f081..0738cdf0b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2156,7 +2156,7 @@ Other minor changes pattern s Date: Wed, 21 Jun 2023 11:53:22 +0100 Subject: [PATCH 03/80] reorganised to push `LessThan` further down the module` --- src/Data/Nat/Base.agda | 48 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Data/Nat/Base.agda b/src/Data/Nat/Base.agda index 48221d2d00..00d8d1ae3e 100644 --- a/src/Data/Nat/Base.agda +++ b/src/Data/Nat/Base.agda @@ -128,32 +128,11 @@ instance >-nonZero⁻¹ : ∀ n → .{{NonZero n}} → n > 0 >-nonZero⁻¹ (suc n) = z Date: Thu, 22 Jun 2023 08:34:17 +0100 Subject: [PATCH 04/80] =?UTF-8?q?relating=20`LessThan`=20and=20`=5F Date: Thu, 22 Jun 2023 08:36:02 +0100 Subject: [PATCH 05/80] =?UTF-8?q?relating=20`LessThan`=20and=20`=5F Date: Fri, 23 Jun 2023 12:50:36 +0100 Subject: [PATCH 06/80] =?UTF-8?q?reverted=20to=20using=20`=5F<=E1=B5=87=5F?= =?UTF-8?q?`;=20simplified=20imports?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Data/Fin/Base.agda | 52 ++++++++++++++++++++++++------------------ src/Data/Nat/Base.agda | 41 ++++++++++++++++++++++----------- 2 files changed, 58 insertions(+), 35 deletions(-) diff --git a/src/Data/Fin/Base.agda b/src/Data/Fin/Base.agda index 20a2636216..b7ce7f5459 100644 --- a/src/Data/Fin/Base.agda +++ b/src/Data/Fin/Base.agda @@ -13,13 +13,11 @@ module Data.Fin.Base where open import Data.Bool.Base using (Bool; true; false; T; not) open import Data.Empty using (⊥-elim) -open import Data.Nat.Base as ℕ using (ℕ; zero; suc; z≤n; s≤s; z″_ @@ -315,6 +325,11 @@ m ≥″ n = n ≤″ m _>″_ : Rel ℕ 0ℓ m >″ n = n <″ m +-- Smart destructor of _<″_ + +s<″s⁻¹ : ∀ {m n} → suc m <″ suc n → m <″ n +s<″s⁻¹ (<″-offset k) = <″-offset k + ------------------------------------------------------------------------ -- Another alternative definition of _≤_ From 44acc1fba89d83f7907c6d40b2a4059d973be4e4 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 23 Jun 2023 12:54:31 +0100 Subject: [PATCH 07/80] fixed imports --- src/Data/Nat/Base.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Nat/Base.agda b/src/Data/Nat/Base.agda index cbd5fff742..1a6c1d9b36 100644 --- a/src/Data/Nat/Base.agda +++ b/src/Data/Nat/Base.agda @@ -132,7 +132,7 @@ instance -- Arithmetic open import Agda.Builtin.Nat public - using (_+_; _*_; div-helper; mod-helper) renaming (_-_ to _∸_) + using (_+_; _*_) renaming (_-_ to _∸_) open import Agda.Builtin.Nat using (div-helper; mod-helper) From 426723254a1206b2c8f2dae57049bdd633864faf Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 23 Jun 2023 13:13:18 +0100 Subject: [PATCH 08/80] simplified imports; removed some uses of `with` --- src/Data/Nat/Properties.agda | 58 ++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index 27725b98ad..dbf7c2a06c 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -21,7 +21,6 @@ import Algebra.Lattice.Construct.NaturalChoice.MinMaxOp as LatticeMinMaxOp import Algebra.Properties.CommutativeSemigroup as CommSemigroupProperties open import Data.Bool.Base using (Bool; false; true; T) open import Data.Bool.Properties using (T?) -open import Data.Empty using (⊥) open import Data.Nat.Base open import Data.Product using (∄; ∃; _×_; _,_) open import Data.Sum.Base as Sum @@ -31,12 +30,12 @@ open import Function.Bundles using (_↣_) open import Function.Metric.Nat open import Level using (0ℓ) open import Relation.Unary as U using (Pred) -open import Relation.Binary +open import Relation.Binary as B open import Relation.Binary.Consequences using (flip-Connex) open import Relation.Binary.PropositionalEquality open import Relation.Nullary hiding (Irrelevant) open import Relation.Nullary.Decidable using (True; via-injection; map′) -open import Relation.Nullary.Negation using (contradiction; contradiction₂) +open import Relation.Nullary.Negation using (contradiction) open import Relation.Nullary.Reflects using (fromEquivalence) open import Algebra.Definitions {A = ℕ} _≡_ @@ -106,6 +105,15 @@ m ≟ n = map′ (≡ᵇ⇒≡ m n) (≡⇒≡ᵇ m n) (T? (m ≡ᵇ n)) 1+n≢n : ∀ {n} → suc n ≢ n 1+n≢n {suc n} = 1+n≢n ∘ suc-injective +------------------------------------------------------------------------ +-- Properties of LessThan +------------------------------------------------------------------------ + +lessThan? : B.Decidable LessThan +lessThan? m zero = no (¬[n]LessThan[0] {m}) +lessThan? zero (suc n) = yes _ +lessThan? (suc m) (suc n) = lessThan? m n + ------------------------------------------------------------------------ -- Properties of _<ᵇ_ ------------------------------------------------------------------------ @@ -161,9 +169,7 @@ m ≟ n = map′ (≡ᵇ⇒≡ m n) (≡⇒≡ᵇ m n) (T? (m ≡ᵇ n)) ≤-total : Total _≤_ ≤-total zero _ = inj₁ z≤n ≤-total _ zero = inj₂ z≤n -≤-total (suc m) (suc n) with ≤-total m n -... | inj₁ m≤n = inj₁ (s≤s m≤n) -... | inj₂ n≤m = inj₂ (s≤s n≤m) +≤-total (suc m) (suc n) = [ (inj₁ ∘ s≤s) , (inj₂ ∘ s≤s) ]′ (≤-total m n) ≤-irrelevant : Irrelevant _≤_ ≤-irrelevant z≤n z≤n = refl @@ -252,9 +258,6 @@ _≥?_ = flip _≤?_ s≤s-injective : ∀ {m n} {p q : m ≤ n} → s≤s p ≡ s≤s q → p ≡ q s≤s-injective refl = refl -≤-pred : ∀ {m n} → suc m ≤ suc n → m ≤ n -≤-pred (s≤s m≤n) = m≤n - m≤n⇒m≤1+n : ∀ {m n} → m ≤ n → m ≤ 1 + n m≤n⇒m≤1+n z≤n = z≤n m≤n⇒m≤1+n (s≤s m≤n) = s≤s (m≤n⇒m≤1+n m≤n) @@ -414,9 +417,6 @@ _>?_ = flip _″?_ = flip _<″?_ ≤″-irrelevant : Irrelevant _≤″_ ≤″-irrelevant {m} (less-than-or-equal eq₁) (less-than-or-equal eq₂) - with +-cancelˡ-≡ m _ _ (trans eq₁ (sym eq₂)) -... | refl = cong less-than-or-equal (≡-irrelevant eq₁ eq₂) + with refl ← +-cancelˡ-≡ m _ _ (trans eq₁ (sym eq₂)) + = cong less-than-or-equal (≡-irrelevant eq₁ eq₂) <″-irrelevant : Irrelevant _<″_ <″-irrelevant = ≤″-irrelevant @@ -2289,6 +2287,16 @@ n≤m⊔n = m≤n⊔m -- Version 2.0 +≤-pred = s≤s⁻¹ +{-# WARNING_ON_USAGE ≤-pred +"Warning: ≤-pred was deprecated in v2.0. Please use Data.Nat.Base.s≤s⁻¹ instead. " +#-} + +<-pred = s Date: Fri, 23 Jun 2023 13:15:14 +0100 Subject: [PATCH 09/80] spurious parentheses --- src/Data/Nat/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index dbf7c2a06c..626c9448ec 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -169,7 +169,7 @@ lessThan? (suc m) (suc n) = lessThan? m n ≤-total : Total _≤_ ≤-total zero _ = inj₁ z≤n ≤-total _ zero = inj₂ z≤n -≤-total (suc m) (suc n) = [ (inj₁ ∘ s≤s) , (inj₂ ∘ s≤s) ]′ (≤-total m n) +≤-total (suc m) (suc n) = [ inj₁ ∘ s≤s , inj₂ ∘ s≤s ]′ (≤-total m n) ≤-irrelevant : Irrelevant _≤_ ≤-irrelevant z≤n z≤n = refl From b57f651ae27fcf562683ae403259100f4178d7d7 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 23 Jun 2023 13:40:47 +0100 Subject: [PATCH 10/80] new proofs of old properties; old proofs of new properties; reinstated non-strict versions --- src/Data/Fin/Properties.agda | 165 ++++++++++++++++++++++------------- 1 file changed, 103 insertions(+), 62 deletions(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index d7a963f9fd..905b8a0c4e 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -18,11 +18,13 @@ open import Data.Bool.Base using (Bool; true; false; not; _∧_; _∨_) open import Data.Empty using (⊥; ⊥-elim) open import Data.Fin.Base open import Data.Fin.Patterns -open import Data.Nat.Base as ℕ using (ℕ; zero; suc; s≤s; z≤n; z) +open import Data.Product + using (Σ-syntax; ∃; ∃₂; ∄; _×_; _,_; map; proj₁; proj₂; uncurry; <_,_>) open import Data.Product.Properties using (,-injective) open import Data.Product.Algebra using (×-cong) open import Data.Sum.Base as Sum using (_⊎_; inj₁; inj₂; [_,_]; [_,_]′) @@ -156,16 +158,23 @@ toℕ-↑ʳ (suc n) i = cong suc (toℕ-↑ʳ n i) -- toℕ and the ordering relations ------------------------------------------------------------------------ +toℕ-LessThan : (i : Fin n) → ℕ.LessThan (toℕ i) n +toℕ-LessThan zero = _ +toℕ-LessThan (suc i) = toℕ-LessThan i + +toℕ Date: Fri, 23 Jun 2023 14:48:32 +0100 Subject: [PATCH 11/80] streamlining --- src/Data/Fin/Properties.agda | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index 905b8a0c4e..3486d2269c 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -278,7 +278,7 @@ fromℕ<≡fromℕ<″ (s Date: Fri, 23 Jun 2023 15:19:14 +0100 Subject: [PATCH 12/80] premature deprecation considered harmful --- src/Data/Nat/Properties.agda | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index 626c9448ec..0f6da4571a 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -155,6 +155,8 @@ lessThan? (suc m) (suc n) = lessThan? m n ≤-reflexive {zero} refl = z≤n ≤-reflexive {suc m} refl = s≤s (≤-reflexive refl) +≤-pred = s≤s⁻¹ + ≤-refl : Reflexive _≤_ ≤-refl = ≤-reflexive refl @@ -417,6 +419,8 @@ _>?_ = flip _ Date: Fri, 23 Jun 2023 16:40:31 +0100 Subject: [PATCH 13/80] =?UTF-8?q?tidied=20up=20`from=E2=84=95*`=20lemmas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Data/Fin/Base.agda | 19 +++++++++---------- src/Data/Fin/Properties.agda | 10 +++++----- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/Data/Fin/Base.agda b/src/Data/Fin/Base.agda index b7ce7f5459..832adcbb31 100644 --- a/src/Data/Fin/Base.agda +++ b/src/Data/Fin/Base.agda @@ -71,22 +71,21 @@ fromℕLessThan : ∀ m {n} → .{{ℕ.LessThan m n}} → Fin n fromℕLessThan zero {suc _} = zero fromℕLessThan (suc m) {suc _} = suc (fromℕLessThan m) --- fromℕ< {m} _ = "m". - -fromℕ< : ∀ {m n} → .(m ℕ.< n) → Fin n -fromℕ< m Date: Fri, 23 Jun 2023 16:41:48 +0100 Subject: [PATCH 14/80] corrected `DivMod` appeals to --- src/Data/Nat/DivMod.agda | 13 ++++++------- src/Data/Nat/DivMod/WithK.agda | 18 ++++++++---------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/Data/Nat/DivMod.agda b/src/Data/Nat/DivMod.agda index f2b2d8657e..58414b96c7 100644 --- a/src/Data/Nat/DivMod.agda +++ b/src/Data/Nat/DivMod.agda @@ -20,7 +20,6 @@ open import Data.Nat.Properties open import Function using (_$_) open import Relation.Binary.PropositionalEquality open import Relation.Nullary.Decidable using (yes; no) -open import Relation.Nullary.Decidable using (False; toWitnessFalse) import Algebra.Properties.CommutativeSemigroup *-commutativeSemigroup as *-CS @@ -461,12 +460,12 @@ _div_ : (dividend divisor : ℕ) .{{_ : NonZero divisor}} → ℕ _div_ = _/_ _mod_ : (dividend divisor : ℕ) .{{_ : NonZero divisor}} → Fin divisor -m mod (suc n) = fromℕ< (m%n Date: Fri, 23 Jun 2023 16:42:23 +0100 Subject: [PATCH 15/80] weird unsolved metas bug? --- src/Data/Nat/Show/Properties.agda | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Data/Nat/Show/Properties.agda b/src/Data/Nat/Show/Properties.agda index 739a00c2e4..393b9c9fe1 100644 --- a/src/Data/Nat/Show/Properties.agda +++ b/src/Data/Nat/Show/Properties.agda @@ -8,7 +8,7 @@ open import Data.Digit using (showDigit; toDigits) open import Data.Digit.Properties using (toDigits-injective; showDigit-injective) -open import Function using (_∘_) +open import Function using (_∘_; Injective) import Data.List.Properties as Listₚ open import Data.Nat.Base using (ℕ) open import Data.Nat.Properties using (_≤?_) @@ -20,7 +20,12 @@ module Data.Nat.Show.Properties where module _ (base : ℕ) {base≥2 : True (2 ≤? base)} {base≤16 : True (base ≤? 16)} where - charsInBase-injective : ∀ n m → charsInBase base {base≥2} {base≤16} n ≡ charsInBase base {base≥2} {base≤16} m → n ≡ m - charsInBase-injective n m = toDigits-injective base {base≥2} _ _ + private + charsInBase-base = charsInBase base {base≥2} {base≤16} + toDigits-injective-base = toDigits-injective base {base≥2} {base≥2} + showDigit-injective-base = showDigit-injective base {base≤16} {base≤16} + + charsInBase-injective : ∀ n m → charsInBase-base n ≡ charsInBase-base m → n ≡ m + charsInBase-injective n m = toDigits-injective-base _ _ ∘ Listₚ.reverse-injective - ∘ Listₚ.map-injective (showDigit-injective _ _ _) + ∘ Listₚ.map-injective (showDigit-injective-base _ _) From 84d136d6acbd1822e0a87a0d141e1c2a86d514fa Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 23 Jun 2023 16:43:02 +0100 Subject: [PATCH 16/80] towards deprecation; tightened dependencies --- src/Data/Vec/Relation/Unary/Linked/Properties.agda | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Data/Vec/Relation/Unary/Linked/Properties.agda b/src/Data/Vec/Relation/Unary/Linked/Properties.agda index a9604e1e6a..69024b1b51 100644 --- a/src/Data/Vec/Relation/Unary/Linked/Properties.agda +++ b/src/Data/Vec/Relation/Unary/Linked/Properties.agda @@ -8,21 +8,17 @@ module Data.Vec.Relation.Unary.Linked.Properties where -open import Data.Bool.Base using (true; false) open import Data.Vec.Base as Vec open import Data.Vec.Relation.Unary.All as All using (All; []; _∷_) import Data.Vec.Relation.Unary.All.Properties as Allₚ open import Data.Vec.Relation.Unary.Linked as Linked using (Linked; []; [-]; _∷_) open import Data.Fin.Base using (zero; suc; _<_) -open import Data.Nat.Base using (ℕ; zero; suc; NonZero) -open import Data.Nat.Properties using (<-pred) +open import Data.Nat.Base using (ℕ; zero; suc; s Date: Sat, 24 Jun 2023 11:07:56 +0100 Subject: [PATCH 17/80] tweaks --- src/Data/Nat/Base.agda | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Data/Nat/Base.agda b/src/Data/Nat/Base.agda index 1a6c1d9b36..73613d0d42 100644 --- a/src/Data/Nat/Base.agda +++ b/src/Data/Nat/Base.agda @@ -258,6 +258,10 @@ instance -- Constructors +lessThanSuc : ∀ {n} → LessThan n (suc n) +lessThanSuc {zero} = _ +lessThanSuc {suc n} = lessThanSuc {n} + <-lessThan : ∀ {m n} → .(m < n) → LessThan m n <-lessThan {zero} {suc n} _ = _ <-lessThan {suc m} {suc n} m Date: Sat, 24 Jun 2023 13:21:51 +0100 Subject: [PATCH 18/80] made `<-lessThan` more implicit; added constructors; removed non-constructor --- src/Data/Nat/Base.agda | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Data/Nat/Base.agda b/src/Data/Nat/Base.agda index 73613d0d42..765865978a 100644 --- a/src/Data/Nat/Base.agda +++ b/src/Data/Nat/Base.agda @@ -262,9 +262,13 @@ lessThanSuc : ∀ {n} → LessThan n (suc n) lessThanSuc {zero} = _ lessThanSuc {suc n} = lessThanSuc {n} -<-lessThan : ∀ {m n} → .(m < n) → LessThan m n -<-lessThan {zero} {suc n} _ = _ -<-lessThan {suc m} {suc n} m Date: Sat, 24 Jun 2023 13:22:42 +0100 Subject: [PATCH 19/80] knock-on simplification --- src/Data/Nat/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index 0f6da4571a..feac800985 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -110,7 +110,7 @@ m ≟ n = map′ (≡ᵇ⇒≡ m n) (≡⇒≡ᵇ m n) (T? (m ≡ᵇ n)) ------------------------------------------------------------------------ lessThan? : B.Decidable LessThan -lessThan? m zero = no (¬[n]LessThan[0] {m}) +lessThan? m zero = no λ() lessThan? zero (suc n) = yes _ lessThan? (suc m) (suc n) = lessThan? m n From 91a56623fb3c542cf833dcf50b6fd6c5bb0c5038 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Sat, 24 Jun 2023 13:38:14 +0100 Subject: [PATCH 20/80] overdid the instances --- src/Data/Nat/Base.agda | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Data/Nat/Base.agda b/src/Data/Nat/Base.agda index 765865978a..1769efd021 100644 --- a/src/Data/Nat/Base.agda +++ b/src/Data/Nat/Base.agda @@ -262,9 +262,9 @@ lessThanSuc : ∀ {n} → LessThan n (suc n) lessThanSuc {zero} = _ lessThanSuc {suc n} = lessThanSuc {n} -<-lessThan : ∀ {m n} → .⦃ m < n ⦄ → LessThan m n -<-lessThan {zero} {suc n} = _ -<-lessThan {suc m} {suc n} ⦃ m Date: Sat, 24 Jun 2023 15:15:14 +0100 Subject: [PATCH 21/80] final (?) reconsideration --- src/Data/Nat/Base.agda | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Data/Nat/Base.agda b/src/Data/Nat/Base.agda index 1769efd021..9b960da60f 100644 --- a/src/Data/Nat/Base.agda +++ b/src/Data/Nat/Base.agda @@ -262,9 +262,9 @@ lessThanSuc : ∀ {n} → LessThan n (suc n) lessThanSuc {zero} = _ lessThanSuc {suc n} = lessThanSuc {n} -<-lessThan : ∀ {m n} → .{m Date: Sat, 24 Jun 2023 15:15:36 +0100 Subject: [PATCH 22/80] final (?) reconsideration --- src/Data/Fin/Base.agda | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Data/Fin/Base.agda b/src/Data/Fin/Base.agda index 832adcbb31..a453649c5f 100644 --- a/src/Data/Fin/Base.agda +++ b/src/Data/Fin/Base.agda @@ -67,14 +67,15 @@ fromℕ (suc n) = suc (fromℕ n) -- fromℕLessThan m ⦃_⦄ = "m". -fromℕLessThan : ∀ m {n} → .{{ℕ.LessThan m n}} → Fin n +fromℕLessThan : ∀ m {n} → .⦃ ℕ.LessThan m n ⦄ → Fin n fromℕLessThan zero {suc _} = zero fromℕLessThan (suc m) {suc _} = suc (fromℕLessThan m) -- fromℕ<′ m ⦃_⦄ = "m". -fromℕ<′ : ∀ m {n} → .{{m ℕ.< n}} → Fin n -fromℕ<′ m {n} ⦃ m Date: Sat, 24 Jun 2023 15:16:21 +0100 Subject: [PATCH 23/80] final (?) refactoring --- src/Data/Fin/Properties.agda | 142 ++++++++++++++++++++++++----------- 1 file changed, 99 insertions(+), 43 deletions(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index d6584cdc7d..7da1e082f4 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -163,7 +163,7 @@ toℕ-LessThan zero = _ toℕ-LessThan (suc i) = toℕ-LessThan i toℕ Date: Sat, 24 Jun 2023 15:27:56 +0100 Subject: [PATCH 24/80] streamlined type signatures --- src/Data/Fin/Properties.agda | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index 7da1e082f4..f795e85a2e 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -222,13 +222,13 @@ toℕ-fromℕLessThan : ∀ m {n} .⦃ _ : ℕ.LessThan m n ⦄ → toℕ (from toℕ-fromℕLessThan zero {suc _} = refl toℕ-fromℕLessThan (suc m) {suc _} = cong suc (toℕ-fromℕLessThan m) -fromℕLessThan-cong : ∀ {m n o} ⦃ m Date: Sat, 24 Jun 2023 18:40:55 +0100 Subject: [PATCH 25/80] towards deprecation; lightneend dependencies --- src/Data/List/Relation/Unary/Linked/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/List/Relation/Unary/Linked/Properties.agda b/src/Data/List/Relation/Unary/Linked/Properties.agda index 7106ad3e1e..5c3fc896c7 100644 --- a/src/Data/List/Relation/Unary/Linked/Properties.agda +++ b/src/Data/List/Relation/Unary/Linked/Properties.agda @@ -17,7 +17,7 @@ open import Data.List.Relation.Unary.All using (All; []; _∷_) open import Data.List.Relation.Unary.Linked as Linked using (Linked; []; [-]; _∷_) open import Data.Nat.Base using (zero; suc; _<_; z Date: Sat, 24 Jun 2023 18:44:13 +0100 Subject: [PATCH 26/80] towards deprecation --- src/Data/Vec/Bounded/Base.agda | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Vec/Bounded/Base.agda b/src/Data/Vec/Bounded/Base.agda index 9c874ec89e..f76301e96b 100644 --- a/src/Data/Vec/Bounded/Base.agda +++ b/src/Data/Vec/Bounded/Base.agda @@ -132,12 +132,12 @@ align = alignWith id take : ∀ {m} n → Vec≤ A m → Vec≤ A (n ⊓ m) take zero _ = [] take (suc n) (Vec.[] , p) = [] -take {m = suc m} (suc n) (a Vec.∷ as , p) = a ∷ take n (as , ℕₚ.≤-pred p) +take {m = suc m} (suc n) (a Vec.∷ as , p) = a ∷ take n (as , s≤s⁻¹ p) drop : ∀ {m} n → Vec≤ A m → Vec≤ A (m ∸ n) drop zero v = v drop (suc n) (Vec.[] , p) = [] -drop {m = suc m} (suc n) (a Vec.∷ as , p) = drop n (as , ℕₚ.≤-pred p) +drop {m = suc m} (suc n) (a Vec.∷ as , p) = drop n (as , s≤s⁻¹ p) ------------------------------------------------------------------------ -- Lifting a collection of bounded vectors to the same size From f4f6ef0790eec6228909ecc9741a789906f758e2 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Sat, 24 Jun 2023 18:49:49 +0100 Subject: [PATCH 27/80] towards deprecation --- src/Data/Nat/Binary/Properties.agda | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Data/Nat/Binary/Properties.agda b/src/Data/Nat/Binary/Properties.agda index 3ea094ec00..fcc68fa0e2 100644 --- a/src/Data/Nat/Binary/Properties.agda +++ b/src/Data/Nat/Binary/Properties.agda @@ -15,7 +15,7 @@ open import Algebra.Consequences.Propositional open import Data.Bool.Base using (if_then_else_; Bool; true; false) open import Data.Maybe.Base using (Maybe; just; nothing) open import Data.Nat.Binary.Base -open import Data.Nat as ℕ using (ℕ; z≤n; s≤s) +open import Data.Nat as ℕ using (ℕ; z≤n; s≤s; s Date: Sat, 24 Jun 2023 20:41:40 +0100 Subject: [PATCH 28/80] towards deprecation --- src/Data/Integer/Properties.agda | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Data/Integer/Properties.agda b/src/Data/Integer/Properties.agda index 518c1456f4..a35d25d013 100644 --- a/src/Data/Integer/Properties.agda +++ b/src/Data/Integer/Properties.agda @@ -17,7 +17,7 @@ import Algebra.Properties.AbelianGroup open import Data.Bool.Base using (T; true; false) open import Data.Integer.Base renaming (suc to sucℤ) open import Data.Nat as ℕ - using (ℕ; suc; zero; _∸_; s≤s; z≤n; s m≮n m≢n n>m = tri< (-<- n>m) (m≢n ∘ -[1+-injective) (m≮n ∘ drop‿-<-) <-cmp +[1+ m ] +[1+ n ] with ℕ.<-cmp m n -... | tri< m m≮n m≢n n>m = tri> (m≮n ∘ ℕ.≤-pred ∘ drop‿+<+) (m≢n ∘ +[1+-injective) (+<+ (sm)) +... | tri< m m≮n m≢n n>m = tri> (m≮n ∘ sm)) infix 4 _ j neg-cancel-< { +[1+ m ]} { +[1+ n ]} (-<- n Date: Sat, 24 Jun 2023 20:42:26 +0100 Subject: [PATCH 29/80] Nathan's `LessThan` instance --- src/Data/Nat/Base.agda | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Data/Nat/Base.agda b/src/Data/Nat/Base.agda index 9b960da60f..83a13bcdcf 100644 --- a/src/Data/Nat/Base.agda +++ b/src/Data/Nat/Base.agda @@ -262,6 +262,13 @@ lessThanSuc : ∀ {n} → LessThan n (suc n) lessThanSuc {zero} = _ lessThanSuc {suc n} = lessThanSuc {n} +lessThanSucSuc : ∀ {m n} → ⦃ LessThan m n ⦄ → LessThan (suc m) (suc n) +lessThanSucSuc ⦃ lt ⦄ = lt +{- +lessThanSucSuc {zero} {suc _} = _ +lessThanSucSuc {suc m} {suc n} = lessThanSucSuc {m} {n} +-} + <-lessThan : ∀ {m n} → .(m Date: Sun, 25 Jun 2023 06:09:11 +0100 Subject: [PATCH 30/80] =?UTF-8?q?DEPRECATIONS=20plus=20redefinitions=20of?= =?UTF-8?q?=20`=E2=89=A4-pred`=20`<-pred`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Data/Nat.agda | 11 ++++++++++- src/Data/Nat/Properties.agda | 16 +++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/Data/Nat.agda b/src/Data/Nat.agda index 1abd7d9d7c..1a4f06b475 100644 --- a/src/Data/Nat.agda +++ b/src/Data/Nat.agda @@ -42,5 +42,14 @@ open import Data.Nat.Properties public -- Version 0.17 +-- Version 2.0 + open import Data.Nat.Properties public - using (≤-pred) + hiding (≤-pred; <-pred) + +≤-pred : ∀ {m n} → (m ≤ n) → pred m ≤ pred n +≤-pred {m = zero} _ = z≤n +≤-pred {m = suc _} {n = suc _} m≤n = s≤s⁻¹ m≤n + +<-pred : ∀ {m n} → .⦃ _ : NonZero m ⦄ → (m < n) → pred m < pred n +<-pred {m = suc _} {n = suc _} = s?_ = flip _ 0 → m < m + n m0 = n>0 @@ -2298,6 +2294,16 @@ suc[pred[n]]≡n {suc n} _ = refl "Warning: suc[pred[n]]≡n was deprecated in v2.0. Please use suc-pred instead. Note that the proof now uses instance arguments" #-} +≤-pred = s≤s⁻¹ +{-# WARNING_ON_USAGE ≤-pred +"Warning: ≤-pred was deprecated in v2.0. Please use Data.Nat.Base.s≤s⁻¹ or Data.Nat.≤-pred instead. Note that the latter now has a different type. " +#-} + +<-pred = s Date: Sun, 25 Jun 2023 06:26:10 +0100 Subject: [PATCH 31/80] tidied up som e irrefutable `with` patterns --- src/Data/Fin/Properties.agda | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index f795e85a2e..0bc83ebfd5 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -657,8 +657,10 @@ splitAt-↑ˡ (suc m) (suc i) n rewrite splitAt-↑ˡ m i n = refl splitAt⁻¹-↑ˡ : ∀ {m} {n} {i} {j} → splitAt m {n} i ≡ inj₁ j → j ↑ˡ n ≡ i splitAt⁻¹-↑ˡ {suc m} {n} {0F} {.0F} refl = refl -splitAt⁻¹-↑ˡ {suc m} {n} {suc i} {j} eq with splitAt m i in splitAt[m][i]≡inj₁[j] -... | inj₁ k with refl ← eq = cong suc (splitAt⁻¹-↑ˡ {i = i} {j = k} splitAt[m][i]≡inj₁[j]) +splitAt⁻¹-↑ˡ {suc m} {n} {suc i} {j} eq + with inj₁ k ← splitAt m i in splitAt[m][i]≡inj₁[j] + with refl ← eq + = cong suc (splitAt⁻¹-↑ˡ {i = i} {j = k} splitAt[m][i]≡inj₁[j]) splitAt-↑ʳ : ∀ m n i → splitAt m (m ↑ʳ i) ≡ inj₂ {B = Fin n} i splitAt-↑ʳ zero n i = refl @@ -666,8 +668,10 @@ splitAt-↑ʳ (suc m) n i rewrite splitAt-↑ʳ m n i = refl splitAt⁻¹-↑ʳ : ∀ {m} {n} {i} {j} → splitAt m {n} i ≡ inj₂ j → m ↑ʳ j ≡ i splitAt⁻¹-↑ʳ {zero} {n} {i} {j} refl = refl -splitAt⁻¹-↑ʳ {suc m} {n} {suc i} {j} eq with splitAt m i in splitAt[m][i]≡inj₂[k] -... | inj₂ k with refl ← eq = cong suc (splitAt⁻¹-↑ʳ {i = i} {j = k} splitAt[m][i]≡inj₂[k]) +splitAt⁻¹-↑ʳ {suc m} {n} {suc i} {j} eq + with inj₂ k ← splitAt m i in splitAt[m][i]≡inj₂[k] + with refl ← eq + = cong suc (splitAt⁻¹-↑ʳ {i = i} {j = k} splitAt[m][i]≡inj₂[k]) splitAt-join : ∀ m n i → splitAt m (join m n i) ≡ i splitAt-join m n (inj₁ x) = splitAt-↑ˡ m x n @@ -772,8 +776,9 @@ combine-injectiveˡ i j k l cᵢⱼ≡cₖₗ with <-cmp i k combine-injectiveʳ : ∀ (i : Fin m) (j : Fin n) (k : Fin m) (l : Fin n) → combine i j ≡ combine k l → j ≡ l -combine-injectiveʳ {m} {n} i j k l cᵢⱼ≡cₖₗ with combine-injectiveˡ i j k l cᵢⱼ≡cₖₗ -... | refl = toℕ-injective (ℕₚ.+-cancelˡ-≡ (n ℕ.* toℕ i) _ _ (begin +combine-injectiveʳ {m} {n} i j k l cᵢⱼ≡cₖₗ + with refl ← combine-injectiveˡ i j k l cᵢⱼ≡cₖₗ + = toℕ-injective (ℕₚ.+-cancelˡ-≡ (n ℕ.* toℕ i) _ _ (begin n ℕ.* toℕ i ℕ.+ toℕ j ≡˘⟨ toℕ-combine i j ⟩ toℕ (combine i j) ≡⟨ cong toℕ cᵢⱼ≡cₖₗ ⟩ toℕ (combine i l) ≡⟨ toℕ-combine i l ⟩ @@ -787,8 +792,8 @@ combine-injective i j k l cᵢⱼ≡cₖₗ = combine-injectiveʳ i j k l cᵢⱼ≡cₖₗ combine-surjective : ∀ (i : Fin (m ℕ.* n)) → ∃₂ λ j k → combine j k ≡ i -combine-surjective {m} {n} i with remQuot {m} n i in eq -... | j , k = j , k , (begin +combine-surjective {m} {n} i with j , k ← remQuot {m} n i in eq + = j , k , (begin combine j k ≡˘⟨ uncurry (cong₂ combine) (,-injective eq) ⟩ uncurry combine (remQuot {m} n i) ≡⟨ combine-remQuot {m} n i ⟩ i ∎) @@ -1075,10 +1080,9 @@ pigeonhole : m ℕ.< n → (f : Fin n → Fin m) → ∃₂ λ i j → i < j × pigeonhole z Date: Wed, 28 Jun 2023 09:00:02 +0100 Subject: [PATCH 32/80] simplification via instance `lessThanSucSuc` --- src/Data/Fin/Properties.agda | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index 0bc83ebfd5..9980c736e6 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -692,8 +692,9 @@ join-splitAt (suc m) n (suc i) = begin splitAt-LessThan : ∀ m {n} (i : Fin (m ℕ.+ n)) .⦃ lt : _ ⦄ → splitAt m i ≡ inj₁ (fromℕLessThan (toℕ i) ⦃ lt ⦄ ) splitAt-LessThan (suc m) zero = refl -splitAt-LessThan (suc m) (suc i) ⦃ lt ⦄ = - cong (Sum.map suc id) (splitAt-LessThan m i ⦃ lt ⦄) +splitAt-LessThan (suc m) (suc i) = + cong (Sum.map suc id) (splitAt-LessThan m i) + where instance _ = ℕ.lessThanSucSuc splitAt-< : ∀ m {n} (i : Fin (m ℕ.+ n)) .(i Date: Wed, 28 Jun 2023 09:15:25 +0100 Subject: [PATCH 33/80] further simplification --- src/Data/Fin/Properties.agda | 12 ++++++------ src/Data/Nat/Base.agda | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index 9980c736e6..9c14dd4483 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -224,17 +224,17 @@ toℕ-fromℕLessThan (suc m) {suc _} = cong suc (toℕ-fromℕLessThan m) fromℕLessThan-cong : ∀ {m n o} ⦃ m Date: Thu, 29 Jun 2023 09:34:08 +0100 Subject: [PATCH 34/80] simplified dependencies --- src/Data/Nat/Show/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Nat/Show/Properties.agda b/src/Data/Nat/Show/Properties.agda index 393b9c9fe1..fa120642cb 100644 --- a/src/Data/Nat/Show/Properties.agda +++ b/src/Data/Nat/Show/Properties.agda @@ -8,7 +8,7 @@ open import Data.Digit using (showDigit; toDigits) open import Data.Digit.Properties using (toDigits-injective; showDigit-injective) -open import Function using (_∘_; Injective) +open import Function using (_∘_) import Data.List.Properties as Listₚ open import Data.Nat.Base using (ℕ) open import Data.Nat.Properties using (_≤?_) From 228c20cebc734f152afea40f5408510a6a5c04f0 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Thu, 29 Jun 2023 09:47:06 +0100 Subject: [PATCH 35/80] simplified dependencies --- src/Data/Nat/Show/Properties.agda | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Data/Nat/Show/Properties.agda b/src/Data/Nat/Show/Properties.agda index fa120642cb..e397d9ea8c 100644 --- a/src/Data/Nat/Show/Properties.agda +++ b/src/Data/Nat/Show/Properties.agda @@ -6,15 +6,14 @@ {-# OPTIONS --cubical-compatible --safe #-} -open import Data.Digit using (showDigit; toDigits) open import Data.Digit.Properties using (toDigits-injective; showDigit-injective) -open import Function using (_∘_) import Data.List.Properties as Listₚ open import Data.Nat.Base using (ℕ) open import Data.Nat.Properties using (_≤?_) +open import Data.Nat.Show using (charsInBase) +open import Function using (_∘_) open import Relation.Nullary.Decidable using (True) open import Relation.Binary.PropositionalEquality using (_≡_) -open import Data.Nat.Show using (charsInBase) module Data.Nat.Show.Properties where From 09a1e581e13ce775e1e98a024657f2bcccbc9a43 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Thu, 29 Jun 2023 09:49:19 +0100 Subject: [PATCH 36/80] irrelevant argument --- src/Data/Nat/Base.agda | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Data/Nat/Base.agda b/src/Data/Nat/Base.agda index 43faae290e..03c268fa3b 100644 --- a/src/Data/Nat/Base.agda +++ b/src/Data/Nat/Base.agda @@ -262,10 +262,7 @@ lessThanSuc : ∀ {n} → LessThan n (suc n) lessThanSuc {zero} = _ lessThanSuc {suc n} = lessThanSuc {n} -lessThanSucSuc : ∀ {m n} → ⦃ LessThan m n ⦄ → LessThan (suc m) (suc n) -{- -lessThanSucSuc ⦃ lt ⦄ = lt --} +lessThanSucSuc : ∀ {m n} → .⦃ LessThan m n ⦄ → LessThan (suc m) (suc n) lessThanSucSuc {zero} {suc _} = _ lessThanSucSuc {suc m} {suc n} = lessThanSucSuc {m} {n} From 38f823b0c595b35e9be25ab6befe7ca3ed5f44d3 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Thu, 29 Jun 2023 10:00:30 +0100 Subject: [PATCH 37/80] updated `CHANGELOG` and deprecations --- CHANGELOG.md | 10 +++++++--- src/Data/Nat/Properties/Core.agda | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad04db38d1..6e863cf659 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1008,7 +1008,7 @@ Deprecated modules ### Deprecation of `Data.Nat.Properties.Core` -* The module `Data.Nat.Properties.Core` has been deprecated, and its one entry moved to `Data.Nat.Properties` +* The module `Data.Nat.Properties.Core` has been deprecated, and its one lemma moved to `Data.Nat.Base`, renamed as `s≤s⁻¹` Deprecated names ---------------- @@ -1234,6 +1234,8 @@ Deprecated names * In `Data.Nat.Properties`: ``` suc[pred[n]]≡n ↦ suc-pred + ≤-pred ↦ s≤s⁻¹ + <-pred ↦ s Date: Thu, 29 Jun 2023 10:07:52 +0100 Subject: [PATCH 38/80] attempt at resolving merge conflicts --- src/Data/Fin/Base.agda | 2 +- src/Data/Fin/Properties.agda | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Data/Fin/Base.agda b/src/Data/Fin/Base.agda index a453649c5f..64e623ef61 100644 --- a/src/Data/Fin/Base.agda +++ b/src/Data/Fin/Base.agda @@ -14,7 +14,7 @@ module Data.Fin.Base where open import Data.Bool.Base using (Bool; true; false; T; not) open import Data.Empty using (⊥-elim) open import Data.Nat.Base as ℕ using (ℕ; zero; suc) -open import Data.Product as Product using (_×_; _,_; proj₁; proj₂) +open import Data.Product.Base as Product using (_×_; _,_; proj₁; proj₂) open import Data.Sum.Base as Sum using (_⊎_; inj₁; inj₂; [_,_]′) open import Function.Base using (id; _∘_; _on_; flip) open import Level using (0ℓ) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index 9c14dd4483..fb64235337 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -23,8 +23,8 @@ open import Data.Nat.Base as ℕ import Data.Nat.Properties as ℕₚ open import Data.Nat.Solver open import Data.Unit using (⊤; tt) -open import Data.Product - using (Σ-syntax; ∃; ∃₂; ∄; _×_; _,_; map; proj₁; proj₂; uncurry; <_,_>) +open import Data.Product as Prod + using (∃; ∃₂; _×_; _,_; map; proj₁; proj₂; uncurry; <_,_>) open import Data.Product.Properties using (,-injective) open import Data.Product.Algebra using (×-cong) open import Data.Sum.Base as Sum using (_⊎_; inj₁; inj₂; [_,_]; [_,_]′) @@ -722,7 +722,7 @@ splitAt-≥ (suc m) (suc i) i≥m = cong (Sum.map suc id) (splitAt-≥ m i (ℕ. remQuot-combine : ∀ {n k} (i : Fin n) j → remQuot k (combine i j) ≡ (i , j) remQuot-combine {suc n} {k} zero j rewrite splitAt-↑ˡ k j (n ℕ.* k) = refl remQuot-combine {suc n} {k} (suc i) j rewrite splitAt-↑ʳ k (n ℕ.* k) (combine i j) = - cong (Data.Product.map₁ suc) (remQuot-combine i j) + cong (Prod.map₁ suc) (remQuot-combine i j) combine-remQuot : ∀ {n} k (i : Fin (n ℕ.* k)) → uncurry combine (remQuot {n} k i) ≡ i combine-remQuot {suc n} k i with splitAt k i in eq From 27415e0bf7b595ac599cd77b8e1e90f644203949 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Sun, 6 Aug 2023 13:40:38 +0100 Subject: [PATCH 39/80] typo during merge conflict resolution --- src/Data/Vec/Relation/Unary/Linked/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Vec/Relation/Unary/Linked/Properties.agda b/src/Data/Vec/Relation/Unary/Linked/Properties.agda index c75864e89a..69024b1b51 100644 --- a/src/Data/Vec/Relation/Unary/Linked/Properties.agda +++ b/src/Data/Vec/Relation/Unary/Linked/Properties.agda @@ -16,7 +16,7 @@ open import Data.Vec.Relation.Unary.Linked as Linked open import Data.Fin.Base using (zero; suc; _<_) open import Data.Nat.Base using (ℕ; zero; suc; s Date: Sun, 6 Aug 2023 13:47:57 +0100 Subject: [PATCH 40/80] more errors introduced during merge conflict resolution --- src/Data/Nat/Properties.agda | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index 5cb40c89bc..1f6d39c7f2 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -35,7 +35,7 @@ open import Relation.Binary.Consequences using (flip-Connex) open import Relation.Binary.PropositionalEquality open import Relation.Nullary hiding (Irrelevant) open import Relation.Nullary.Decidable using (True; via-injection; map′) -open import Relation.Nullary.Negation using (contradiction) +open import Relation.Nullary.Negation.Core using (¬_; contradiction) open import Relation.Nullary.Reflects using (fromEquivalence) open import Algebra.Definitions {A = ℕ} _≡_ @@ -2170,7 +2170,7 @@ module _ {p} {P : Pred ℕ p} (P? : U.Decidable P) where ... | _ | yes (n , n Date: Sun, 6 Aug 2023 13:58:30 +0100 Subject: [PATCH 41/80] another error introduced during merge conflict resolution --- src/Data/Nat/Show/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Nat/Show/Properties.agda b/src/Data/Nat/Show/Properties.agda index cc30c6aaec..13dd34ace2 100644 --- a/src/Data/Nat/Show/Properties.agda +++ b/src/Data/Nat/Show/Properties.agda @@ -13,7 +13,7 @@ open import Data.Nat.Properties using (_≤?_) open import Data.Nat.Show using (charsInBase) open import Function.Base using (_∘_) open import Relation.Nullary.Decidable using (True) -pen import Relation.Binary.PropositionalEquality.Core using (_≡_) +open import Relation.Binary.PropositionalEquality.Core using (_≡_) module Data.Nat.Show.Properties where From aedd6d4258045a2ae8b92248aae7472e5f33c3c0 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 11 Aug 2023 10:20:38 +0100 Subject: [PATCH 42/80] lightened imports ahead of merge conflict resolution --- src/Data/Vec/Relation/Unary/Linked/Properties.agda | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Data/Vec/Relation/Unary/Linked/Properties.agda b/src/Data/Vec/Relation/Unary/Linked/Properties.agda index 69024b1b51..8ff5a4d2e3 100644 --- a/src/Data/Vec/Relation/Unary/Linked/Properties.agda +++ b/src/Data/Vec/Relation/Unary/Linked/Properties.agda @@ -17,7 +17,8 @@ open import Data.Fin.Base using (zero; suc; _<_) open import Data.Nat.Base using (ℕ; zero; suc; s Date: Wed, 16 Aug 2023 09:56:24 +0100 Subject: [PATCH 43/80] =?UTF-8?q?made=20som=20e=20proofs=20lazier=20in=20t?= =?UTF-8?q?heir=20`=5F=E2=89=A4=5F`=20arguments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Data/Vec/Properties.agda | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Data/Vec/Properties.agda b/src/Data/Vec/Properties.agda index 49924a7b31..df6799c212 100644 --- a/src/Data/Vec/Properties.agda +++ b/src/Data/Vec/Properties.agda @@ -215,12 +215,13 @@ lookup⇒[]= (suc i) (_ ∷ xs) p = there (lookup⇒[]= i xs p) lookup-inject≤-take : ∀ m (m≤m+n : m ≤ m + n) (i : Fin m) (xs : Vec A (m + n)) → lookup xs (Fin.inject≤ i m≤m+n) ≡ lookup (take m xs) i -lookup-inject≤-take (suc m) m≤m+n zero (x ∷ xs) +lookup-inject≤-take (suc m) _ zero (x ∷ xs) rewrite unfold-take m x xs = refl -lookup-inject≤-take (suc (suc m)) (s≤s m≤m+n) (suc zero) (x ∷ y ∷ xs) - rewrite unfold-take (suc m) x (y ∷ xs) | unfold-take m y xs = refl -lookup-inject≤-take (suc (suc m)) (s≤s (s≤s m≤m+n)) (suc (suc i)) (x ∷ y ∷ xs) - rewrite unfold-take (suc m) x (y ∷ xs) | unfold-take m y xs = lookup-inject≤-take m m≤m+n i xs +lookup-inject≤-take (suc (suc m)) m≤m+n (suc i) (x ∷ y ∷ xs) + rewrite unfold-take (suc m) x (y ∷ xs) | unfold-take m y xs + with i +... | zero = refl +... | suc j = lookup-inject≤-take m (s≤s⁻¹ (s≤s⁻¹ m≤m+n)) j xs ------------------------------------------------------------------------ -- updateAt (_[_]%=_) @@ -480,14 +481,14 @@ map-⊛ f g (x ∷ xs) = cong (f x (g x) ∷_) (map-⊛ f g xs) lookup-++-< : ∀ (xs : Vec A m) (ys : Vec A n) → ∀ i (i Date: Fri, 29 Sep 2023 08:14:40 +0100 Subject: [PATCH 44/80] simplfied `import`s --- src/Data/Fin/Base.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Fin/Base.agda b/src/Data/Fin/Base.agda index 82e9109dc8..8a824e60dd 100644 --- a/src/Data/Fin/Base.agda +++ b/src/Data/Fin/Base.agda @@ -12,7 +12,6 @@ module Data.Fin.Base where open import Data.Bool.Base using (Bool; true; false; T; not) -open import Data.Empty using (⊥-elim) open import Data.Nat.Base as ℕ using (ℕ; zero; suc; z≤n; s≤s; z Date: Fri, 29 Sep 2023 08:17:20 +0100 Subject: [PATCH 45/80] knock-on consequence of merge conflict resolution --- src/Data/Nat/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index 8cb115856c..cb175d9cf2 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -116,7 +116,7 @@ m ≟ n = map′ (≡ᵇ⇒≡ m n) (≡⇒≡ᵇ m n) (T? (m ≡ᵇ n)) -- Properties of LessThan ------------------------------------------------------------------------ -lessThan? : B.Decidable LessThan +lessThan? : Decidable LessThan lessThan? m zero = no λ() lessThan? zero (suc n) = yes _ lessThan? (suc m) (suc n) = lessThan? m n From 7a6ad62c969b45b544d7c4187a519ace282c1740 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 29 Sep 2023 08:22:44 +0100 Subject: [PATCH 46/80] simplified irrelevance proof --- src/Data/Fin/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index 1c75f12056..5e8656f9e1 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -650,7 +650,7 @@ inject≤-injective {n = suc _} p q (suc i) (suc j) eq = inject≤-irrelevant : ∀ (m≤n m≤n′ : m ℕ.≤ n) i → inject≤ i m≤n ≡ inject≤ i m≤n′ -inject≤-irrelevant m≤n m≤n′ i = cong (inject≤ i) (ℕₚ.≤-irrelevant m≤n m≤n′) +inject≤-irrelevant m≤n m≤n′ i = refl ------------------------------------------------------------------------ -- pred From afca20f76f24f10aa9ed848fb1e557a6f886eb4f Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 29 Sep 2023 08:26:15 +0100 Subject: [PATCH 47/80] simplified irrelevance proof --- src/Data/Vec/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Vec/Properties.agda b/src/Data/Vec/Properties.agda index 45d30e9256..45ff2a296d 100644 --- a/src/Data/Vec/Properties.agda +++ b/src/Data/Vec/Properties.agda @@ -1306,7 +1306,7 @@ lookup-inject≤-take m m≤m+n i xs = sym (begin lookup (take m xs) i ≡⟨ lookup-take-inject≤ xs i ⟩ lookup xs (Fin.inject≤ i _) - ≡⟨ cong ((lookup xs) ∘ (Fin.inject≤ i)) (≤-irrelevant _ _) ⟩ + ≡⟨⟩ lookup xs (Fin.inject≤ i m≤m+n) ∎) where open ≡-Reasoning {-# WARNING_ON_USAGE lookup-inject≤-take From 34155ca252f88d446fb0b65f8ff54c32bf7fbe81 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 29 Sep 2023 08:28:50 +0100 Subject: [PATCH 48/80] typo --- src/Data/Vec/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Vec/Properties.agda b/src/Data/Vec/Properties.agda index 45ff2a296d..72276908ee 100644 --- a/src/Data/Vec/Properties.agda +++ b/src/Data/Vec/Properties.agda @@ -1293,7 +1293,7 @@ Please use take-map instead." drop-distr-zipWith = drop-zipWith {-# WARNING_ON_USAGE drop-distr-zipWith "Warning: drop-distr-zipWith was deprecated in v2.0. -Please use tdrop-zipWith instead." +Please use drop-zipWith instead." #-} drop-distr-map = drop-map {-# WARNING_ON_USAGE drop-distr-map From 5e8a4a62b64a3f10154a6514c08cef087749a663 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 29 Sep 2023 08:33:20 +0100 Subject: [PATCH 49/80] simplified injectivity proof --- src/Data/Fin/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index 5e8656f9e1..faedccb0e6 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -642,7 +642,7 @@ inject≤-trans : ∀ (i : Fin m) (m≤n : m ℕ.≤ n) (n≤o : n ℕ.≤ o) inject≤ (inject≤ i m≤n) n≤o ≡ inject≤ i (ℕₚ.≤-trans m≤n n≤o) inject≤-trans i m≤n n≤o = inject≤-idempotent i m≤n n≤o _ -inject≤-injective : ∀ (m≤n m≤n′ : m ℕ.≤ n) i j → +inject≤-injective : ∀ .(m≤n m≤n′ : m ℕ.≤ n) i j → inject≤ i m≤n ≡ inject≤ j m≤n′ → i ≡ j inject≤-injective {n = suc _} p q zero zero eq = refl inject≤-injective {n = suc _} p q (suc i) (suc j) eq = From 2d102b14a31625d5681b98e3eb08b9fb8f5bd5c4 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 29 Sep 2023 08:40:06 +0100 Subject: [PATCH 50/80] knock-on changes; further simplified `import`s --- src/Data/Digit/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Digit/Properties.agda b/src/Data/Digit/Properties.agda index 113bdde6ca..fb52d2af72 100644 --- a/src/Data/Digit/Properties.agda +++ b/src/Data/Digit/Properties.agda @@ -15,7 +15,7 @@ open import Data.Product.Base using (_,_; proj₁) open import Data.Vec.Relation.Unary.Unique.Propositional using (Unique) import Data.Vec.Relation.Unary.Unique.Propositional.Properties as Uniqueₚ open import Data.Vec.Relation.Unary.AllPairs using (allPairs?) -open import Relation.Nullary.Decidable using (True; from-yes; ¬?) +open import Relation.Nullary.Decidable.Core using (True; from-yes; ¬?) open import Relation.Binary.PropositionalEquality.Core using (_≡_; refl) open import Function.Base using (_∘_) From 57c80e2010f2516fded56ab48b5315703cba766d Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 29 Sep 2023 08:52:34 +0100 Subject: [PATCH 51/80] knock-on changes; further simplified `import`s --- src/Data/Fin/Properties.agda | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index faedccb0e6..25e411f298 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -43,10 +43,10 @@ open import Relation.Binary.Structures using (IsDecEquivalence; IsPreorder; IsPartialOrder; IsTotalOrder; IsDecTotalOrder; IsStrictPartialOrder; IsStrictTotalOrder) open import Relation.Binary.PropositionalEquality as P using (_≡_; _≢_; refl; sym; trans; cong; cong₂; subst; _≗_; module ≡-Reasoning) -open import Relation.Nullary - using (Reflects; ofʸ; ofⁿ; Dec; _because_; does; proof; yes; no; ¬_; _×-dec_; _⊎-dec_; contradiction) -open import Relation.Nullary.Reflects -open import Relation.Nullary.Decidable as Dec using (map′) +open import Relation.Nullary.Decidable as Dec + using (Dec; _because_; yes; no; _×-dec_; _⊎-dec_; map′) +open import Relation.Nullary.Negation.Core using (¬_; contradiction) +open import Relation.Nullary.Reflects using (Reflects; invert) open import Relation.Unary as U using (U; Pred; Decidable; _⊆_; Satisfiable; Universal) open import Relation.Unary.Properties using (U?) @@ -1065,8 +1065,8 @@ private -- The boolean component of the result is exactly the -- obvious fold of boolean tests (`foldr _∧_ true`). note : ∀ {p} {P : Pred (Fin 3) p} (P? : Decidable P) → - ∃ λ z → does (all? P?) ≡ z - note P? = does (P? 0F) ∧ does (P? 1F) ∧ does (P? 2F) ∧ true + ∃ λ z → Dec.does (all? P?) ≡ z + note P? = Dec.does (P? 0F) ∧ Dec.does (P? 1F) ∧ Dec.does (P? 2F) ∧ true , refl -- If a decidable predicate P over a finite set is sometimes false, From 754eefd64d535f6b4a65684ce0dc67d957498188 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 29 Sep 2023 09:00:11 +0100 Subject: [PATCH 52/80] knock-on changes; further simplified `import`s --- src/Data/Fin/Base.agda | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Fin/Base.agda b/src/Data/Fin/Base.agda index 8a824e60dd..de1998b5e7 100644 --- a/src/Data/Fin/Base.agda +++ b/src/Data/Fin/Base.agda @@ -11,8 +11,8 @@ module Data.Fin.Base where -open import Data.Bool.Base using (Bool; true; false; T; not) -open import Data.Nat.Base as ℕ using (ℕ; zero; suc; z≤n; s≤s; z Date: Fri, 29 Sep 2023 09:02:48 +0100 Subject: [PATCH 53/80] knock-on changes; further simplified `import`s --- src/Data/Vec/Base.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Vec/Base.agda b/src/Data/Vec/Base.agda index 507ac05463..0ef297392d 100644 --- a/src/Data/Vec/Base.agda +++ b/src/Data/Vec/Base.agda @@ -8,7 +8,7 @@ module Data.Vec.Base where -open import Data.Bool.Base using (Bool; true; false; if_then_else_) +open import Data.Bool.Base using (Bool; if_then_else_) open import Data.Nat.Base open import Data.Fin.Base using (Fin; zero; suc) open import Data.List.Base as List using (List) From 3f6fb748112f10905234089e7e3c84f3cdb21492 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 29 Sep 2023 09:10:09 +0100 Subject: [PATCH 54/80] knock-on changes; further simplified `import`s --- src/Data/Vec/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Vec/Properties.agda b/src/Data/Vec/Properties.agda index 72276908ee..6e4f18f03e 100644 --- a/src/Data/Vec/Properties.agda +++ b/src/Data/Vec/Properties.agda @@ -29,7 +29,7 @@ open import Relation.Binary.Definitions using (DecidableEquality) open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; _≗_; refl; sym; trans; cong; cong₂; subst; module ≡-Reasoning) open import Relation.Unary using (Pred; Decidable) -open import Relation.Nullary.Decidable.Core using (Dec; does; yes; no; _×-dec_; map′) +open import Relation.Nullary.Decidable.Core using (Dec; does; yes; _×-dec_; map′) open import Relation.Nullary.Negation.Core using (contradiction) open ≡-Reasoning From ee823acc8f610a34e2c770210d40587dd7703b5b Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 29 Sep 2023 09:37:45 +0100 Subject: [PATCH 55/80] simplified proof(s) --- src/Data/Nat/Properties.agda | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index cb175d9cf2..eb811af952 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -721,8 +721,8 @@ m 0 → m < n + m m0 rewrite +-comm n m = m0 m+n≮n : ∀ m n → m + n ≮ n -m+n≮n zero n = n≮n n -m+n≮n (suc m) (suc n) (s Date: Fri, 29 Sep 2023 12:17:08 +0100 Subject: [PATCH 56/80] removed `LessThan` from `Nat.Base` --- CHANGELOG.md | 40 ++++++++++++++++------------------------ src/Data/Nat/Base.agda | 39 +-------------------------------------- 2 files changed, 17 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb55dc1853..314d8450d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -280,7 +280,7 @@ Non-backwards compatible changes Data.Sum.Function.Setoid Data.Sum.Function.Propositional ``` - + * Additionally the following proofs now use the new definitions instead of the old ones: * `Algebra.Lattice.Properties.BooleanAlgebra` * `Algebra.Properties.CommutativeMonoid.Sum` @@ -360,8 +360,8 @@ Non-backwards compatible changes * The module `Function.Definitions` no longer has two equalities as module arguments, as they did not interact as intended with the re-exports from `Function.Definitions.(Core1/Core2)`. The latter have been removed and their definitions folded into `Function.Definitions`. - -* In `Function.Definitions` the types of `Surjective`, `Injective` and `Surjective` + +* In `Function.Definitions` the types of `Surjective`, `Injective` and `Surjective` have been changed from: ``` Surjective f = ∀ y → ∃ λ x → f x ≈₂ y @@ -376,16 +376,16 @@ Non-backwards compatible changes ``` This is for several reasons: i) the new definitions compose much more easily, ii) Agda can better infer the equalities used. - + To ease backwards compatibility: - - the old definitions have been moved to the new names `StrictlySurjective`, - `StrictlyInverseˡ` and `StrictlyInverseʳ`. - - The records in `Function.Structures` and `Function.Bundles` export proofs - of these under the names `strictlySurjective`, `strictlyInverseˡ` and - `strictlyInverseʳ`, + - the old definitions have been moved to the new names `StrictlySurjective`, + `StrictlyInverseˡ` and `StrictlyInverseʳ`. + - The records in `Function.Structures` and `Function.Bundles` export proofs + of these under the names `strictlySurjective`, `strictlyInverseˡ` and + `strictlyInverseʳ`, - Conversion functions have been added in both directions to - `Function.Consequences(.Propositional)`. - + `Function.Consequences(.Propositional)`. + #### Proofs of non-zeroness/positivity/negativity as instance arguments * Many numeric operations in the library require their arguments to be non-zero, @@ -772,14 +772,14 @@ Non-backwards compatible changes ### Changes to triple reasoning interface * The module `Relation.Binary.Reasoning.Base.Triple` now takes an extra proof that the strict - relation is irreflexive. - + relation is irreflexive. + * This allows the following new proof combinator: ```agda begin-contradiction : (r : x IsRelatedTo x) → {s : True (IsStrict? r)} → A ``` that takes a proof that a value is strictly less than itself and then applies the principle of explosion. - + * Specialised versions of this combinator are available in the following derived modules: ``` Data.Nat.Properties @@ -1465,7 +1465,7 @@ Deprecated names take-distr-map ↦ take-map drop-distr-zipWith ↦ drop-zipWith drop-distr-map ↦ drop-map - + updateAt-id-relative ↦ updateAt-id-local updateAt-compose-relative ↦ updateAt-∘-local updateAt-compose ↦ updateAt-∘ @@ -2349,7 +2349,7 @@ Additions to existing modules length-isMagmaHomomorphism : (A : Set a) → IsMagmaHomomorphism (++-rawMagma A) +-rawMagma length length-isMonoidHomomorphism : (A : Set a) → IsMonoidHomomorphism (++-[]-rawMonoid A) +-0-rawMonoid length - + take-map : take n (map f xs) ≡ map f (take n xs) drop-map : drop n (map f xs) ≡ map f (drop n xs) head-map : head (map f xs) ≡ Maybe.map f (head xs) @@ -2377,14 +2377,6 @@ Additions to existing modules s≤s⁻¹ : suc m ≤ suc n → m ≤ n s Date: Fri, 29 Sep 2023 12:20:46 +0100 Subject: [PATCH 57/80] removed `LessThan` from `Nat.Properties` --- src/Data/Nat/Properties.agda | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index eb811af952..8977a716ab 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -112,15 +112,6 @@ m ≟ n = map′ (≡ᵇ⇒≡ m n) (≡⇒≡ᵇ m n) (T? (m ≡ᵇ n)) 1+n≢n : ∀ {n} → suc n ≢ n 1+n≢n {suc n} = 1+n≢n ∘ suc-injective ------------------------------------------------------------------------- --- Properties of LessThan ------------------------------------------------------------------------- - -lessThan? : Decidable LessThan -lessThan? m zero = no λ() -lessThan? zero (suc n) = yes _ -lessThan? (suc m) (suc n) = lessThan? m n - ------------------------------------------------------------------------ -- Properties of _<ᵇ_ ------------------------------------------------------------------------ From 4ef993894910bb26d883f3c1ab72da82b76243d4 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 29 Sep 2023 12:30:33 +0100 Subject: [PATCH 58/80] removed `LessThan` from `Fin.Base` --- src/Data/Fin/Base.agda | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Data/Fin/Base.agda b/src/Data/Fin/Base.agda index de1998b5e7..ffe55a89b4 100644 --- a/src/Data/Fin/Base.agda +++ b/src/Data/Fin/Base.agda @@ -65,22 +65,11 @@ fromℕ : (n : ℕ) → Fin (suc n) fromℕ zero = zero fromℕ (suc n) = suc (fromℕ n) --- fromℕLessThan m ⦃_⦄ = "m". - -fromℕLessThan : ∀ m {n} → .⦃ ℕ.LessThan m n ⦄ → Fin n -fromℕLessThan zero {suc _} = zero -fromℕLessThan (suc m) {suc _} = suc (fromℕLessThan m) - --- fromℕ<′ m ⦃_⦄ = "m". - -fromℕ<′ : ∀ m {n} → .⦃ m ℕ.< n ⦄ → Fin n -fromℕ<′ m {n} ⦃ m Date: Fri, 29 Sep 2023 13:11:24 +0100 Subject: [PATCH 59/80] removed `LessThan` from `Fin.Properties` --- src/Data/Fin/Properties.agda | 163 ++++++++--------------------------- 1 file changed, 34 insertions(+), 129 deletions(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index 25e411f298..d38c53fc99 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -162,12 +162,9 @@ toℕ-↑ʳ (suc n) i = cong suc (toℕ-↑ʳ n i) -- toℕ and the ordering relations ------------------------------------------------------------------------ -toℕ-LessThan : (i : Fin n) → ℕ.LessThan (toℕ i) n -toℕ-LessThan zero = _ -toℕ-LessThan (suc i) = toℕ-LessThan i - -toℕ Date: Fri, 29 Sep 2023 13:45:01 +0100 Subject: [PATCH 60/80] final tweaks to `CHANGELOG` --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 314d8450d5..b2eaabaaec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1365,8 +1365,8 @@ Deprecated names * In `Data.Nat.Properties`: ``` suc[pred[n]]≡n ↦ suc-pred - ≤-pred ↦ s≤s⁻¹ - <-pred ↦ s Date: Wed, 4 Oct 2023 17:17:51 +0100 Subject: [PATCH 61/80] attempt to resolve the deprecation problem --- CHANGELOG.md | 5 +++-- src/Data/Nat.agda | 10 ++-------- src/Data/Nat/Properties.agda | 13 ++++++++++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2eaabaaec..3bf4a5d811 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2432,12 +2432,13 @@ Additions to existing modules m*n≢0 : .{{_ : NonZero m}} .{{_ : NonZero n}} → NonZero (m * n) m≤n⇒n∸m≤n : m ≤ n → n ∸ m ≤ n - ≤-pred : suc m ≤ suc n → m ≤ n s Date: Wed, 4 Oct 2023 17:23:53 +0100 Subject: [PATCH 62/80] slight rearrangement ahead of attempt to resolve merge conflict --- CHANGELOG.md | 3 +++ src/Data/Nat/Base.agda | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bf4a5d811..979e8c6699 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2381,6 +2381,9 @@ Additions to existing modules pattern <′-step {n} m<′n = ≤′-step {n} m<′n pattern ≤″-offset k = less-than-or-equal {k} refl + pattern <″-offset k = ≤″-offset k + + s<″s⁻¹ : ∀ {m n} → suc m <″ suc n → m <″ n _⊔′_ : ℕ → ℕ → ℕ _⊓′_ : ℕ → ℕ → ℕ diff --git a/src/Data/Nat/Base.agda b/src/Data/Nat/Base.agda index 01abccb8e1..59e805a4d1 100644 --- a/src/Data/Nat/Base.agda +++ b/src/Data/Nat/Base.agda @@ -279,11 +279,6 @@ record _≤″_ (m n : ℕ) : Set where {k} : ℕ proof : m + k ≡ n --- Smart constructor of _<″_ - -pattern ≤″-offset k = less-than-or-equal {k = k} refl -pattern <″-offset k = ≤″-offset k - infix 4 _≤″_ _<″_ _≥″_ _>″_ _<″_ : Rel ℕ 0ℓ @@ -295,6 +290,11 @@ m ≥″ n = n ≤″ m _>″_ : Rel ℕ 0ℓ m >″ n = n <″ m +-- Smart constructors of _≤″_ and _<″_ + +pattern ≤″-offset k = less-than-or-equal {k = k} refl +pattern <″-offset k = ≤″-offset k + -- Smart destructor of _<″_ s<″s⁻¹ : ∀ {m n} → suc m <″ suc n → m <″ n From 7dd18ce05ec4f1734a69f3864f74caacc45102fb Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Wed, 4 Oct 2023 17:34:55 +0100 Subject: [PATCH 63/80] tweak --- src/Data/Fin/Base.agda | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Fin/Base.agda b/src/Data/Fin/Base.agda index ffe55a89b4..2c708a58c4 100644 --- a/src/Data/Fin/Base.agda +++ b/src/Data/Fin/Base.agda @@ -68,8 +68,8 @@ fromℕ (suc n) = suc (fromℕ n) -- fromℕ< {m} _ = "m". fromℕ< : ∀ {m n} → .(m ℕ.< n) → Fin n -fromℕ< {zero} {n = suc _} _ = zero -fromℕ< {suc m} {n = suc _} m Date: Wed, 4 Oct 2023 17:38:34 +0100 Subject: [PATCH 64/80] tweak `import` --- src/Data/Integer/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Integer/Properties.agda b/src/Data/Integer/Properties.agda index 267047a13b..66f95807ba 100644 --- a/src/Data/Integer/Properties.agda +++ b/src/Data/Integer/Properties.agda @@ -16,7 +16,7 @@ import Algebra.Lattice.Construct.NaturalChoice.MinMaxOp as LatticeMinMaxOp import Algebra.Properties.AbelianGroup open import Data.Bool.Base using (T; true; false) open import Data.Integer.Base renaming (suc to sucℤ) -open import Data.Nat as ℕ +open import Data.Nat.Base as ℕ using (ℕ; suc; zero; _∸_; s≤s; z≤n; s Date: Thu, 5 Oct 2023 06:39:30 +0100 Subject: [PATCH 65/80] =?UTF-8?q?BUG:=20strange=20reversion=20of=20`Data.F?= =?UTF-8?q?in.Properties.<-tri`:=20reappearance=20of=20deprecated=20`?= =?UTF-8?q?=E2=89=A4-pred`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Data/Fin/Properties.agda | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index d38c53fc99..1d3bd1ef97 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -377,9 +377,9 @@ m (λ()) (λ()) z i≮j i≢j j (i≮j ∘ ℕₚ.≤-pred) (i≢j ∘ suc-injective) (s i≮j i≢j j (i≮j ∘ s Date: Thu, 5 Oct 2023 06:43:53 +0100 Subject: [PATCH 66/80] =?UTF-8?q?BUG:=20strange=20reversion=20of=20`Data.F?= =?UTF-8?q?in.Properties.<-cmp`:=20reappearance=20of=20deprecated=20`?= =?UTF-8?q?=E2=89=A4-pred`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Data/Fin/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index 1d3bd1ef97..0714907907 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -379,7 +379,7 @@ m i≮j i≢j j (i≮j ∘ s Date: Thu, 5 Oct 2023 06:47:35 +0100 Subject: [PATCH 67/80] =?UTF-8?q?fixed=20appearance=20of=20deprecated=20`?= =?UTF-8?q?=E2=89=A4-pred`=20in=20`Data.List.Properties`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Data/List/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/List/Properties.agda b/src/Data/List/Properties.agda index 5afce0cd54..b037c7bb7a 100644 --- a/src/Data/List/Properties.agda +++ b/src/Data/List/Properties.agda @@ -850,7 +850,7 @@ drop-drop (suc m) n (x ∷ xs) = drop-drop m n xs drop-all : (n : ℕ) (xs : List A) → n ≥ length xs → drop n xs ≡ [] drop-all n [] _ = drop-[] n -drop-all (suc n) (x ∷ xs) p = drop-all n xs (≤-pred p) +drop-all (suc n) (x ∷ xs) p = drop-all n xs {!s≤s⁻¹ p!} ------------------------------------------------------------------------ -- replicate From ea0aba0b74220bfb5f15348cf17ece140dcf405b Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Thu, 5 Oct 2023 06:48:07 +0100 Subject: [PATCH 68/80] =?UTF-8?q?fixed=20appearance=20of=20deprecated=20`?= =?UTF-8?q?=E2=89=A4-pred`=20in=20`Data.List.Properties`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Data/List/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/List/Properties.agda b/src/Data/List/Properties.agda index b037c7bb7a..78fc03f865 100644 --- a/src/Data/List/Properties.agda +++ b/src/Data/List/Properties.agda @@ -850,7 +850,7 @@ drop-drop (suc m) n (x ∷ xs) = drop-drop m n xs drop-all : (n : ℕ) (xs : List A) → n ≥ length xs → drop n xs ≡ [] drop-all n [] _ = drop-[] n -drop-all (suc n) (x ∷ xs) p = drop-all n xs {!s≤s⁻¹ p!} +drop-all (suc n) (x ∷ xs) p = drop-all n xs (s≤s⁻¹ p) ------------------------------------------------------------------------ -- replicate From d901b5e587125077c7cee09b76da1237cc51aa00 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 6 Oct 2023 11:35:45 +0100 Subject: [PATCH 69/80] removed redundant `variable` quantified quantifier prefix --- src/Data/Fin/Base.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Fin/Base.agda b/src/Data/Fin/Base.agda index 2c708a58c4..46db3b0910 100644 --- a/src/Data/Fin/Base.agda +++ b/src/Data/Fin/Base.agda @@ -67,7 +67,7 @@ fromℕ (suc n) = suc (fromℕ n) -- fromℕ< {m} _ = "m". -fromℕ< : ∀ {m n} → .(m ℕ.< n) → Fin n +fromℕ< : .(m ℕ.< n) → Fin n fromℕ< {zero} {suc _} _ = zero fromℕ< {suc m} {suc _} m Date: Fri, 6 Oct 2023 11:38:14 +0100 Subject: [PATCH 70/80] fixed `reduce` --- src/Data/Fin/Base.agda | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Fin/Base.agda b/src/Data/Fin/Base.agda index 46db3b0910..9b4c303f2f 100644 --- a/src/Data/Fin/Base.agda +++ b/src/Data/Fin/Base.agda @@ -93,9 +93,9 @@ zero ↑ʳ i = i -- reduce≥ "m + i" _ = "i". -reduce≥ : ∀ (i : Fin (m ℕ.+ n)) → .(m ℕ.≤ (toℕ i)) → Fin n +reduce≥ : ∀ (i : Fin (m ℕ.+ n)) → .(m ℕ.≤ toℕ i) → Fin n reduce≥ {zero} i _ = i -reduce≥ {suc m} (suc i) m≤i = reduce≥ {m} i (ℕ.s≤s⁻¹ m≤i) +reduce≥ {suc _} (suc i) m≤i = reduce≥ i (ℕ.s≤s⁻¹ m≤i) -- inject⋆ m "i" = "i". From 625f610b0b8941de59474237f200749a6ec1e8dc Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 6 Oct 2023 11:41:51 +0100 Subject: [PATCH 71/80] =?UTF-8?q?added=20`s=E2=89=A4=E2=80=B3s=E2=81=BB?= =?UTF-8?q?=C2=B9`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Data/Nat/Base.agda | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Data/Nat/Base.agda b/src/Data/Nat/Base.agda index 3bc7222fb1..9ab106194b 100644 --- a/src/Data/Nat/Base.agda +++ b/src/Data/Nat/Base.agda @@ -343,7 +343,10 @@ m >″ n = n <″ m pattern ≤″-offset k = less-than-or-equal {k = k} refl pattern <″-offset k = ≤″-offset k --- Smart destructor of _<″_ +-- Smart destructors of _<″_ + +s≤″s⁻¹ : ∀ {m n} → suc m ≤″ suc n → m ≤″ n +s≤″s⁻¹ (≤″-offset k) = ≤″-offset k s<″s⁻¹ : ∀ {m n} → suc m <″ suc n → m <″ n s<″s⁻¹ (<″-offset k) = <″-offset k From 65aa0ae2884de08b16fe107f3e7d4f6248ccd2ba Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 6 Oct 2023 11:43:10 +0100 Subject: [PATCH 72/80] =?UTF-8?q?added=20`s=E2=89=A4=E2=80=B3s=E2=81=BB?= =?UTF-8?q?=C2=B9`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e41ef98e1..7bee4ed85a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2590,6 +2590,7 @@ Additions to existing modules pattern ≤″-offset k = less-than-or-equal {k} refl pattern <″-offset k = ≤″-offset k + s≤″s⁻¹ : ∀ {m n} → suc m ≤″ suc n → m ≤″ n s<″s⁻¹ : ∀ {m n} → suc m <″ suc n → m <″ n _⊔′_ : ℕ → ℕ → ℕ From 0de41987b13f19f8d3258e40fef035e5e46a67dc Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 6 Oct 2023 11:54:38 +0100 Subject: [PATCH 73/80] use of `Sum.map` --- src/Data/Nat/Properties.agda | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index 26c50f78ef..bc17a94d3c 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -167,7 +167,7 @@ m ≟ n = map′ (≡ᵇ⇒≡ m n) (≡⇒≡ᵇ m n) (T? (m ≡ᵇ n)) ≤-total : Total _≤_ ≤-total zero _ = inj₁ z≤n ≤-total _ zero = inj₂ z≤n -≤-total (suc m) (suc n) = [ inj₁ ∘ s≤s , inj₂ ∘ s≤s ]′ (≤-total m n) +≤-total (suc m) (suc n) = Sum.map s≤s s≤s (≤-total m n) ≤-irrelevant : Irrelevant _≤_ ≤-irrelevant z≤n z≤n = refl @@ -453,8 +453,7 @@ m Date: Fri, 6 Oct 2023 12:05:46 +0100 Subject: [PATCH 74/80] rewrote header comments about alternative definitions of 'less than (or equal)' --- src/Data/Nat/Base.agda | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Data/Nat/Base.agda b/src/Data/Nat/Base.agda index 9ab106194b..f2755c55fc 100644 --- a/src/Data/Nat/Base.agda +++ b/src/Data/Nat/Base.agda @@ -292,13 +292,10 @@ zero ! = 1 suc n ! = suc n * n ! ------------------------------------------------------------------------ --- Alternative definitions of _≤_/_<_ +-- Extensionally equivalent alternative definitions of _≤_/_<_ etc. ------------------------------------------------------------------------- --- An alternative definition of _≤_ - --- The following definition of _≤_ is more suitable for well-founded --- induction (see Data.Nat.Induction) +-- _≤′_: this definition is more suitable for well-founded induction +-- (see Data.Nat.Induction) infix 4 _≤′_ _<′_ _≥′_ _>′_ @@ -320,8 +317,9 @@ m ≥′ n = n ≤′ m _>′_ : Rel ℕ 0ℓ m >′ n = n <′ m ------------------------------------------------------------------------- --- Another alternative definition of _≤_ +-- _≤″_: this definition of _≤_ is used for proof-irrelevant ‵DivMod` +-- and is a specialised instance of a general algebraic construction + infix 4 _≤″_ _<″_ _≥″_ _>″_ _≤″_ : (m n : ℕ) → Set @@ -351,10 +349,7 @@ s≤″s⁻¹ (≤″-offset k) = ≤″-offset k s<″s⁻¹ : ∀ {m n} → suc m <″ suc n → m <″ n s<″s⁻¹ (<″-offset k) = <″-offset k ------------------------------------------------------------------------- --- Another alternative definition of _≤_ - --- Useful for induction when you have an upper bound. +-- _≤‴_: this definition is useful for induction with an upper bound. data _≤‴_ : ℕ → ℕ → Set where ≤‴-refl : ∀{m} → m ≤‴ m From 15b8f4196f393dbc6c9cdc33d601dd9cc3e9428f Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 6 Oct 2023 13:18:16 +0100 Subject: [PATCH 75/80] miscellaneous irrelevance simplifications, plus redundant parentheses --- src/Data/Fin/Properties.agda | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Data/Fin/Properties.agda b/src/Data/Fin/Properties.agda index 0714907907..ea7c43c90f 100644 --- a/src/Data/Fin/Properties.agda +++ b/src/Data/Fin/Properties.agda @@ -535,33 +535,33 @@ inject₁≡⇒lower₁≡ n≢j i≡j = inject₁-injective (trans (inject₁-l ------------------------------------------------------------------------ toℕ-inject≤ : ∀ i .(m≤n : m ℕ.≤ n) → toℕ (inject≤ i m≤n) ≡ toℕ i -toℕ-inject≤ {_} {suc n} zero _ = refl -toℕ-inject≤ {_} {suc n} (suc i) m≤n = cong suc (toℕ-inject≤ i (ℕ.s≤s⁻¹ m≤n)) +toℕ-inject≤ {_} {suc n} zero _ = refl +toℕ-inject≤ {_} {suc n} (suc i) _ = cong suc (toℕ-inject≤ i _) inject≤-refl : ∀ i .(n≤n : n ℕ.≤ n) → inject≤ i n≤n ≡ i inject≤-refl {suc n} zero _ = refl -inject≤-refl {suc n} (suc i) n≤n = cong suc (inject≤-refl i (ℕ.s≤s⁻¹ n≤n)) +inject≤-refl {suc n} (suc i) _ = cong suc (inject≤-refl i _) inject≤-idempotent : ∀ (i : Fin m) .(m≤n : m ℕ.≤ n) .(n≤o : n ℕ.≤ o) .(m≤o : m ℕ.≤ o) → inject≤ (inject≤ i m≤n) n≤o ≡ inject≤ i m≤o -inject≤-idempotent {_} {suc n} {suc o} zero _ _ _ = refl -inject≤-idempotent {_} {suc n} {suc o} (suc i) m≤n n≤o m≤o = - cong suc (inject≤-idempotent i (ℕ.s≤s⁻¹ m≤n) (ℕ.s≤s⁻¹ n≤o) (ℕ.s≤s⁻¹ m≤o)) +inject≤-idempotent {_} {suc n} {suc o} zero _ _ _ = refl +inject≤-idempotent {_} {suc n} {suc o} (suc i) _ _ _ = + cong suc (inject≤-idempotent i _ _ _) -inject≤-trans : ∀ (i : Fin m) (m≤n : m ℕ.≤ n) (n≤o : n ℕ.≤ o) → +inject≤-trans : ∀ (i : Fin m) .(m≤n : m ℕ.≤ n) .(n≤o : n ℕ.≤ o) → inject≤ (inject≤ i m≤n) n≤o ≡ inject≤ i (ℕₚ.≤-trans m≤n n≤o) -inject≤-trans i m≤n n≤o = inject≤-idempotent i m≤n n≤o _ +inject≤-trans i _ _ = inject≤-idempotent i _ _ _ inject≤-injective : ∀ .(m≤n m≤n′ : m ℕ.≤ n) i j → inject≤ i m≤n ≡ inject≤ j m≤n′ → i ≡ j -inject≤-injective {n = suc _} p q zero zero eq = refl -inject≤-injective {n = suc _} p q (suc i) (suc j) eq = - cong suc (inject≤-injective (ℕ.s≤s⁻¹ p) (ℕ.s≤s⁻¹ q) i j (suc-injective eq)) +inject≤-injective {n = suc _} _ _ zero zero eq = refl +inject≤-injective {n = suc _} _ _ (suc i) (suc j) eq = + cong suc (inject≤-injective _ _ i j (suc-injective eq)) -inject≤-irrelevant : ∀ (m≤n m≤n′ : m ℕ.≤ n) i → +inject≤-irrelevant : ∀ .(m≤n m≤n′ : m ℕ.≤ n) i → inject≤ i m≤n ≡ inject≤ i m≤n′ -inject≤-irrelevant m≤n m≤n′ i = refl +inject≤-irrelevant _ _ i = refl ------------------------------------------------------------------------ -- pred @@ -899,7 +899,7 @@ pinch-surjective (suc i) (suc j) = map suc (λ {f refl → cong suc (f refl)}) ( pinch-mono-≤ : ∀ (i : Fin n) → (pinch i) Preserves _≤_ ⟶ _≤_ pinch-mono-≤ 0F {0F} {k} 0≤n = z≤n -pinch-mono-≤ 0F {suc j} {suc k} j≤k = (ℕ.s≤s⁻¹ j≤k) +pinch-mono-≤ 0F {suc j} {suc k} j≤k = ℕ.s≤s⁻¹ j≤k pinch-mono-≤ (suc i) {0F} {k} 0≤n = z≤n pinch-mono-≤ (suc i) {suc j} {suc k} j≤k = s≤s (pinch-mono-≤ i (ℕ.s≤s⁻¹ j≤k)) From b29679dc015779752563ee9cc599cf547af547fe Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Fri, 6 Oct 2023 13:45:05 +0100 Subject: [PATCH 76/80] resolved the deprecation conundrum --- src/Data/Nat.agda | 4 ++-- src/Data/Nat/Properties.agda | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Data/Nat.agda b/src/Data/Nat.agda index 503e32bac8..8811565c11 100644 --- a/src/Data/Nat.agda +++ b/src/Data/Nat.agda @@ -44,6 +44,6 @@ open import Data.Nat.Properties public -- Version 2.0 --- solely for the sake of exposing the deprecation warnings for these two names +-- solely for the re-export of this name, formerly in `Data.Nat.Properties.Core` open import Data.Nat.Properties public - using (≤-pred; <-pred) + using (≤-pred) diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index bc17a94d3c..f5301ff1d3 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -253,6 +253,8 @@ _≥?_ = flip _≤?_ ------------------------------------------------------------------------ -- Other properties of _≤_ +≤-pred = s≤s⁻¹ + s≤s-injective : ∀ {m n} {p q : m ≤ n} → s≤s p ≡ s≤s q → p ≡ q s≤s-injective refl = refl @@ -279,6 +281,8 @@ n≤1⇒n≡0∨n≡1 (s≤s z≤n) = inj₂ refl -- Relationships between the various relations +<-pred = s Date: Fri, 6 Oct 2023 13:52:02 +0100 Subject: [PATCH 77/80] `lemma` is a terrible placeholder name; renamed --- src/Data/Nat/DivMod.agda | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Data/Nat/DivMod.agda b/src/Data/Nat/DivMod.agda index 29f65b837a..64b7bedd37 100644 --- a/src/Data/Nat/DivMod.agda +++ b/src/Data/Nat/DivMod.agda @@ -467,7 +467,7 @@ m mod n = fromℕ< (m%n Date: Fri, 6 Oct 2023 13:55:41 +0100 Subject: [PATCH 78/80] relocations --- src/Data/Nat/Properties.agda | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index f5301ff1d3..8a7201c6fe 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -253,11 +253,11 @@ _≥?_ = flip _≤?_ ------------------------------------------------------------------------ -- Other properties of _≤_ -≤-pred = s≤s⁻¹ - s≤s-injective : ∀ {m n} {p q : m ≤ n} → s≤s p ≡ s≤s q → p ≡ q s≤s-injective refl = refl +≤-pred = s≤s⁻¹ + m≤n⇒m≤1+n : ∀ {m n} → m ≤ n → m ≤ 1 + n m≤n⇒m≤1+n z≤n = z≤n m≤n⇒m≤1+n (s≤s m≤n) = s≤s (m≤n⇒m≤1+n m≤n) @@ -281,8 +281,6 @@ n≤1⇒n≡0∨n≡1 (s≤s z≤n) = inj₂ refl -- Relationships between the various relations -<-pred = s?_ = flip _ Date: Fri, 6 Oct 2023 14:38:57 +0100 Subject: [PATCH 79/80] deprecated `pred-mono` --- CHANGELOG.md | 3 +-- src/Data/Nat/Properties.agda | 14 ++++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bee4ed85a..4a5515b4dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1517,12 +1517,11 @@ Deprecated names * In `Data.Nat.Properties`: ``` suc[pred[n]]≡n ↦ suc-pred - ≤-pred ↦ Data.Nat.Base.s≤s⁻¹ - <-pred ↦ Data.Nat.Base.s Date: Fri, 6 Oct 2023 18:03:47 +0100 Subject: [PATCH 80/80] fixed deprecation error --- src/Data/Nat/Binary/Properties.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Nat/Binary/Properties.agda b/src/Data/Nat/Binary/Properties.agda index a479afdfa8..6109106b26 100644 --- a/src/Data/Nat/Binary/Properties.agda +++ b/src/Data/Nat/Binary/Properties.agda @@ -1459,7 +1459,7 @@ pred-mono-≤ : pred Preserves _≤_ ⟶ _≤_ pred-mono-≤ {x} {y} x≤y = begin pred x ≡⟨ cong pred (sym (fromℕ-toℕ x)) ⟩ pred (fromℕ m) ≡⟨ sym (fromℕ-pred m) ⟩ - fromℕ (ℕ.pred m) ≤⟨ fromℕ-mono-≤ (ℕₚ.pred-mono (toℕ-mono-≤ x≤y)) ⟩ + fromℕ (ℕ.pred m) ≤⟨ fromℕ-mono-≤ (ℕₚ.pred-mono-≤ (toℕ-mono-≤ x≤y)) ⟩ fromℕ (ℕ.pred n) ≡⟨ fromℕ-pred n ⟩ pred (fromℕ n) ≡⟨ cong pred (fromℕ-toℕ y) ⟩ pred y ∎