From 3b0c5f6bc08c3a3dda71580af63b79d20495e547 Mon Sep 17 00:00:00 2001 From: jamesmckinna Date: Thu, 14 Dec 2023 12:40:53 +0000 Subject: [PATCH 1/3] `breaking` changes to the analysis of `NonZero` arguments left over from #2182 --- src/Data/Nat/DivMod.agda | 59 +++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/src/Data/Nat/DivMod.agda b/src/Data/Nat/DivMod.agda index 5ff23e4c72..1abb4ab2ef 100644 --- a/src/Data/Nat/DivMod.agda +++ b/src/Data/Nat/DivMod.agda @@ -203,12 +203,13 @@ m/n≤m m n = *-cancelʳ-≤ (m / n) m n (begin m ≤⟨ m≤m*n m n ⟩ m * n ∎) -m/n1 n) ⟩ m * n ∎ + where instance _ = nonTrivial⇒nonZero n /-mono-≤ : .{{_ : NonZero o}} .{{_ : NonZero p}} → m ≤ n → o ≥ p → m / o ≤ n / p @@ -245,7 +246,7 @@ m/n≡0⇒m-nonZero (m≥n⇒m/n>0 n≤m) m/n≢0⇒n≤m : ∀ {m n} .{{_ : NonZero n}} → m / n ≢ 0 → n ≤ m -m/n≢0⇒n≤m {m} {n@(suc _)} m/n≢0 with <-≤-connex m n +m/n≢0⇒n≤m {m} {n} m/n≢0 with <-≤-connex m n ... | inj₁ m0 (≢-nonZero⁻¹ o)) n≥o -m*n/o*n≡m/o : ∀ m n o .{{_ : NonZero o}} .{{_ : NonZero (o * n)}} → +m*n/o*n≡m/o : ∀ m n o .{{_ : NonZero n}} .{{_ : NonZero o}} → + let instance _ = m*n≢0 o n in m * n / (o * n) ≡ m / o m*n/o*n≡m/o m n o = begin-equality - m * n / (o * n) ≡⟨ /-congˡ (*-comm m n) ⟩ + m * n / (o * n) ≡⟨ /-congˡ {{o*n≢0}} (*-comm m n) ⟩ n * m / (o * n) ≡⟨ /-congʳ (*-comm o n) ⟩ n * m / (n * o) ≡⟨ m*n/m*o≡n/o n m o ⟩ m / o ∎ where instance - _ : NonZero n - _ = m*n≢0⇒n≢0 o - _ : NonZero (n * o) + o*n≢0 : NonZero (o * n) + o*n≢0 = m*n≢0 o n _ = m*n≢0 n o m Date: Thu, 14 Dec 2023 13:21:28 +0000 Subject: [PATCH 2/3] knock-on viscosity --- src/Data/Digit.agda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Digit.agda b/src/Data/Digit.agda index 207b0280b7..b0aa6bc9fa 100644 --- a/src/Data/Digit.agda +++ b/src/Data/Digit.agda @@ -56,7 +56,7 @@ toNatDigits base@(suc (suc _)) n = aux (<-wellFounded-fast n) [] aux {zero} _ xs = (0 ∷ xs) aux {n@(suc _)} (acc wf) xs with does (0 Date: Thu, 14 Dec 2023 13:23:51 +0000 Subject: [PATCH 3/3] tweaks --- src/Data/Nat/DivMod.agda | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Nat/DivMod.agda b/src/Data/Nat/DivMod.agda index 1abb4ab2ef..bf4aabde75 100644 --- a/src/Data/Nat/DivMod.agda +++ b/src/Data/Nat/DivMod.agda @@ -205,7 +205,7 @@ m/n≤m m n = *-cancelʳ-≤ (m / n) m n (begin m/n1 n) ⟩ m * n ∎ @@ -240,7 +240,7 @@ m≥n⇒m/n>0 {m@(suc _)} {n@(suc _)} m≥n = begin m / n ∎ m/n≡0⇒m-nonZero (m≥n⇒m/n>0 n≤m)