Skip to content

Commit 4900fde

Browse files
change definition of the Cancellative family to have all its arguments be explicit, as per #1436.
1 parent 6fb5774 commit 4900fde

File tree

10 files changed

+45
-45
lines changed

10 files changed

+45
-45
lines changed

src/Algebra/Consequences/Setoid.agda

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ open import Algebra.Consequences.Base public
3434
module _ {_•_ : Op₂ A} (comm : Commutative _•_) where
3535

3636
comm+cancelˡ⇒cancelʳ : LeftCancellative _•_ RightCancellative _•_
37-
comm+cancelˡ⇒cancelʳ cancelˡ {x} y z eq = cancelˡ x $ begin
37+
comm+cancelˡ⇒cancelʳ cancelˡ x y z eq = cancelˡ x y z $ begin
3838
x • y ≈⟨ comm x y ⟩
3939
y • x ≈⟨ eq ⟩
4040
z • x ≈⟨ comm z x ⟩
4141
x • z ∎
4242

4343
comm+cancelʳ⇒cancelˡ : RightCancellative _•_ LeftCancellative _•_
44-
comm+cancelʳ⇒cancelˡ cancelʳ x {y} {z} eq = cancelʳ y z $ begin
44+
comm+cancelʳ⇒cancelˡ cancelʳ x y z eq = cancelʳ x y z $ begin
4545
y • x ≈⟨ comm y x ⟩
4646
x • y ≈⟨ eq ⟩
4747
x • z ≈⟨ comm x z ⟩
@@ -90,17 +90,17 @@ module _ {_•_ : Op₂ A} (comm : Commutative _•_) {e : A} where
9090

9191
comm+almostCancelˡ⇒almostCancelʳ : AlmostLeftCancellative e _•_
9292
AlmostRightCancellative e _•_
93-
comm+almostCancelˡ⇒almostCancelʳ cancelˡ-nonZero {x} y z x≉e yx≈zx =
94-
cancelˡ-nonZero y z x≉e $ begin
93+
comm+almostCancelˡ⇒almostCancelʳ cancelˡ-nonZero x y z x≉e yx≈zx =
94+
cancelˡ-nonZero x y z x≉e $ begin
9595
x • y ≈⟨ comm x y ⟩
9696
y • x ≈⟨ yx≈zx ⟩
9797
z • x ≈⟨ comm z x ⟩
9898
x • z ∎
9999

100100
comm+almostCancelʳ⇒almostCancelˡ : AlmostRightCancellative e _•_
101101
AlmostLeftCancellative e _•_
102-
comm+almostCancelʳ⇒almostCancelˡ cancelʳ-nonZero {x} y z x≉e xy≈xz =
103-
cancelʳ-nonZero y z x≉e $ begin
102+
comm+almostCancelʳ⇒almostCancelˡ cancelʳ-nonZero x y z x≉e xy≈xz =
103+
cancelʳ-nonZero x y z x≉e $ begin
104104
y • x ≈⟨ comm y x ⟩
105105
x • y ≈⟨ xy≈xz ⟩
106106
x • z ≈⟨ comm x z ⟩

src/Algebra/Definitions.agda

+4-4
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,19 @@ Involutive : Op₁ A → Set _
124124
Involutive f = x f (f x) ≈ x
125125

126126
LeftCancellative : Op₂ A Set _
127-
LeftCancellative _•_ = x {y z} (x • y) ≈ (x • z) y ≈ z
127+
LeftCancellative _•_ = x y z (x • y) ≈ (x • z) y ≈ z
128128

129129
RightCancellative : Op₂ A Set _
130-
RightCancellative _•_ = {x} y z (y • x) ≈ (z • x) y ≈ z
130+
RightCancellative _•_ = x y z (y • x) ≈ (z • x) y ≈ z
131131

132132
Cancellative : Op₂ A Set _
133133
Cancellative _•_ = (LeftCancellative _•_) × (RightCancellative _•_)
134134

135135
AlmostLeftCancellative : A Op₂ A Set _
136-
AlmostLeftCancellative e _•_ = {x} y z ¬ x ≈ e (x • y) ≈ (x • z) y ≈ z
136+
AlmostLeftCancellative e _•_ = x y z ¬ x ≈ e (x • y) ≈ (x • z) y ≈ z
137137

138138
AlmostRightCancellative : A Op₂ A Set _
139-
AlmostRightCancellative e _•_ = {x} y z ¬ x ≈ e (y • x) ≈ (z • x) y ≈ z
139+
AlmostRightCancellative e _•_ = x y z ¬ x ≈ e (y • x) ≈ (z • x) y ≈ z
140140

141141
AlmostCancellative : A Op₂ A Set _
142142
AlmostCancellative e _•_ = AlmostLeftCancellative e _•_ × AlmostRightCancellative e _•_

src/Algebra/Morphism/MagmaMonomorphism.agda

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ module _ (◦-isMagma : IsMagma _≈₂_ _◦_) where
7979
⟦ y ⟧ ∎))
8080

8181
cancelˡ : LeftCancellative _≈₂_ _◦_ LeftCancellative _≈₁_ _∙_
82-
cancelˡ cancelˡ x {y} {z} x∙y≈x∙z = injective (cancelˡ ⟦ x ⟧ (begin
82+
cancelˡ cancelˡ x y z x∙y≈x∙z = injective (cancelˡ ⟦ x ⟧ ⟦ y ⟧ ⟦ z ⟧ (begin
8383
⟦ x ⟧ ◦ ⟦ y ⟧ ≈˘⟨ homo x y ⟩
8484
⟦ x ∙ y ⟧ ≈⟨ ⟦⟧-cong x∙y≈x∙z ⟩
8585
⟦ x ∙ z ⟧ ≈⟨ homo x z ⟩
8686
⟦ x ⟧ ◦ ⟦ z ⟧ ∎))
8787

8888
cancelʳ : RightCancellative _≈₂_ _◦_ RightCancellative _≈₁_ _∙_
89-
cancelʳ cancelʳ {x} y z y∙x≈z∙x = injective (cancelʳ ⟦ y ⟧ ⟦ z ⟧ (begin
89+
cancelʳ cancelʳ x y z y∙x≈z∙x = injective (cancelʳ ⟦ x ⟧ ⟦ y ⟧ ⟦ z ⟧ (begin
9090
⟦ y ⟧ ◦ ⟦ x ⟧ ≈˘⟨ homo y x ⟩
9191
⟦ y ∙ x ⟧ ≈⟨ ⟦⟧-cong y∙x≈z∙x ⟩
9292
⟦ z ∙ x ⟧ ≈⟨ homo z x ⟩

src/Algebra/Properties/Group.agda

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ private
3939
x ⁻¹ ∙ (x ∙ y) ∎
4040

4141
∙-cancelˡ : LeftCancellative _∙_
42-
∙-cancelˡ x {y} {z} eq = begin
42+
∙-cancelˡ x y z eq = begin
4343
y ≈⟨ right-helper x y ⟩
4444
x ⁻¹ ∙ (x ∙ y) ≈⟨ ∙-congˡ eq ⟩
4545
x ⁻¹ ∙ (x ∙ z) ≈˘⟨ right-helper x z ⟩
4646
z ∎
4747

4848
∙-cancelʳ : RightCancellative _∙_
49-
∙-cancelʳ {x} y z eq = begin
49+
∙-cancelʳ x y z eq = begin
5050
y ≈⟨ left-helper y x ⟩
5151
y ∙ x ∙ x ⁻¹ ≈⟨ ∙-congʳ eq ⟩
5252
z ∙ x ∙ x ⁻¹ ≈˘⟨ left-helper z x ⟩
@@ -63,14 +63,14 @@ private
6363
x ∎
6464

6565
⁻¹-injective : {x y} x ⁻¹ ≈ y ⁻¹ x ≈ y
66-
⁻¹-injective {x} {y} eq = ∙-cancelʳ x y ( begin
66+
⁻¹-injective {x} {y} eq = ∙-cancelʳ _ _ _ ( begin
6767
x ∙ x ⁻¹ ≈⟨ inverseʳ x ⟩
6868
ε ≈˘⟨ inverseʳ y ⟩
6969
y ∙ y ⁻¹ ≈˘⟨ ∙-congˡ eq ⟩
7070
y ∙ x ⁻¹ ∎ )
7171

7272
⁻¹-anti-homo-∙ : x y (x ∙ y) ⁻¹ ≈ y ⁻¹ ∙ x ⁻¹
73-
⁻¹-anti-homo-∙ x y = ∙-cancelˡ _ ( begin
73+
⁻¹-anti-homo-∙ x y = ∙-cancelˡ _ _ _ ( begin
7474
x ∙ y ∙ (x ∙ y) ⁻¹ ≈⟨ inverseʳ _ ⟩
7575
ε ≈˘⟨ inverseʳ _ ⟩
7676
x ∙ x ⁻¹ ≈⟨ ∙-congʳ (left-helper x y) ⟩

src/Data/Fin/Properties.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ combine-injectiveˡ i j k l cᵢⱼ≡cₖₗ with <-cmp i k
654654
combine-injectiveʳ : (i : Fin m) (j : Fin n) (k : Fin m) (l : Fin n)
655655
combine i j ≡ combine k l j ≡ l
656656
combine-injectiveʳ {m} {n} i j k l cᵢⱼ≡cₖₗ with combine-injectiveˡ i j k l cᵢⱼ≡cₖₗ
657-
... | refl = toℕ-injective (ℕₚ.+-cancelˡ-≡ (n ℕ.* toℕ i) (begin
657+
... | refl = toℕ-injective (ℕₚ.+-cancelˡ-≡ (n ℕ.* toℕ i) _ _ (begin
658658
n ℕ.* toℕ i ℕ.+ toℕ j ≡˘⟨ toℕ-combine i j ⟩
659659
toℕ (combine i j) ≡⟨ cong toℕ cᵢⱼ≡cₖₗ ⟩
660660
toℕ (combine i l) ≡⟨ toℕ-combine i l ⟩

src/Data/Nat/Binary/Properties.agda

+4-4
Original file line numberDiff line numberDiff line change
@@ -302,17 +302,17 @@ toℕ-cancel-< : ∀ {x y} → toℕ x ℕ.< toℕ y → x < y
302302
toℕ-cancel-< {zero} {2[1+ y ]} x<y = 0<even
303303
toℕ-cancel-< {zero} {1+[2 y ]} x<y = 0<odd
304304
toℕ-cancel-< {2[1+ x ]} {2[1+ y ]} x<y =
305-
even<even (toℕ-cancel-< (ℕ.≤-pred (ℕₚ.*-cancelˡ-< 2 x<y)))
305+
even<even (toℕ-cancel-< (ℕ.≤-pred (ℕₚ.*-cancelˡ-< 2 _ _ x<y)))
306306
toℕ-cancel-< {2[1+ x ]} {1+[2 y ]} x<y
307307
rewrite ℕₚ.*-distribˡ-+ 2 1 (toℕ x) =
308-
even<odd (toℕ-cancel-< (ℕₚ.*-cancelˡ-< 2 (ℕₚ.≤-trans (s≤s (ℕₚ.n≤1+n _)) (ℕₚ.≤-pred x<y))))
308+
even<odd (toℕ-cancel-< (ℕₚ.*-cancelˡ-< 2 _ _ (ℕₚ.≤-trans (s≤s (ℕₚ.n≤1+n _)) (ℕₚ.≤-pred x<y))))
309309
toℕ-cancel-< {1+[2 x ]} {2[1+ y ]} x<y with toℕ x ℕₚ.≟ toℕ y
310310
... | yes x≡y = odd<even (inj₂ (toℕ-injective x≡y))
311311
... | no x≢y
312312
rewrite ℕₚ.+-suc (toℕ y) (toℕ y ℕ.+ 0) =
313-
odd<even (inj₁ (toℕ-cancel-< (ℕₚ.≤∧≢⇒< (ℕₚ.*-cancelˡ-≤ 2 (ℕₚ.+-cancelˡ-≤ 2 x<y)) x≢y)))
313+
odd<even (inj₁ (toℕ-cancel-< (ℕₚ.≤∧≢⇒< (ℕₚ.*-cancelˡ-≤ 2 (ℕₚ.+-cancelˡ-≤ 2 _ _ x<y)) x≢y)))
314314
toℕ-cancel-< {1+[2 x ]} {1+[2 y ]} x<y =
315-
odd<odd (toℕ-cancel-< (ℕₚ.*-cancelˡ-< 2 (ℕ.≤-pred x<y)))
315+
odd<odd (toℕ-cancel-< (ℕₚ.*-cancelˡ-< 2 _ _ (ℕ.≤-pred x<y)))
316316

317317
fromℕ-cancel-< : {x y} fromℕ x < fromℕ y x ℕ.< y
318318
fromℕ-cancel-< = subst₂ ℕ._<_ (toℕ-fromℕ _) (toℕ-fromℕ _) ∘ toℕ-mono-<

src/Data/Nat/DivMod.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ m/n≤m m n = *-cancelʳ-≤ (m / n) m n (begin
222222
m * n ∎)
223223

224224
m/n<m : m n .{{_ : NonZero m}} .{{_ : NonZero n}} n ≥ 2 m / n < m
225-
m/n<m m n n≥2 = *-cancelʳ-< (m / n) m (begin-strict
225+
m/n<m m n n≥2 = *-cancelʳ-< _ (m / n) m (begin-strict
226226
(m / n) * n ≤⟨ m/n*n≤m m n ⟩
227227
m <⟨ m<m*n m n n≥2 ⟩
228228
m * n ∎)

src/Data/Nat/DivMod/Core.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ a*n[divₕ]n≡a acc (suc a) n = begin-equality
244244
acc + divₕ 0 (k + j) n j ≡⟨ cong (acc +_) (divₕ-offsetEq _ n j _ (m≤n+m j k) ≤-refl case) ⟩
245245
acc + divₕ 0 (k + j) n (k + j) ∎
246246
where
247-
case = inj₂′ (refl , +-cancelˡ-≤ (suc k) leq , m≤n+m j k)
247+
case = inj₂′ (refl , +-cancelˡ-≤ (suc k) _ _ leq , m≤n+m j k)
248248

249249
divₕ-mono-≤ : {acc} k {m n o p} m ≤ n p ≤ o divₕ acc (k + o) m o ≤ divₕ acc (k + p) n p
250250
divₕ-mono-≤ {acc} k {0} {n} {_} {p} z≤n p≤o = acc≤divₕ[acc] (k + p) n p

src/Data/Nat/Properties.agda

+16-16
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,8 @@ open ≤-Reasoning
532532
n + suc m ∎
533533

534534
+-cancelˡ-≡ : LeftCancellative _≡_ _+_
535-
+-cancelˡ-≡ zero eq = eq
536-
+-cancelˡ-≡ (suc m) eq = +-cancelˡ-≡ m (cong pred eq)
535+
+-cancelˡ-≡ zero _ _ eq = eq
536+
+-cancelˡ-≡ (suc m) _ _ eq = +-cancelˡ-≡ m _ _ (cong pred eq)
537537

538538
+-cancelʳ-≡ : RightCancellative _≡_ _+_
539539
+-cancelʳ-≡ = comm+cancelˡ⇒cancelʳ +-comm +-cancelˡ-≡
@@ -650,21 +650,21 @@ m+n≡0⇒n≡0 m {n} m+n≡0 = m+n≡0⇒m≡0 n (trans (+-comm n m) (m+n≡0))
650650
-- Properties of _+_ and _≤_/_<_
651651

652652
+-cancelˡ-≤ : LeftCancellative _≤_ _+_
653-
+-cancelˡ-≤ zero le = le
654-
+-cancelˡ-≤ (suc m) (s≤s le) = +-cancelˡ-≤ m le
653+
+-cancelˡ-≤ zero _ _ le = le
654+
+-cancelˡ-≤ (suc m) _ _ (s≤s le) = +-cancelˡ-≤ m _ _ le
655655

656656
+-cancelʳ-≤ : RightCancellative _≤_ _+_
657-
+-cancelʳ-≤ {m} n o le =
658-
+-cancelˡ-≤ m (subst₂ _≤_ (+-comm n m) (+-comm o m) le)
657+
+-cancelʳ-≤ m n o le =
658+
+-cancelˡ-≤ m _ _ (subst₂ _≤_ (+-comm n m) (+-comm o m) le)
659659

660660
+-cancel-≤ : Cancellative _≤_ _+_
661661
+-cancel-≤ = +-cancelˡ-≤ , +-cancelʳ-≤
662662

663663
+-cancelˡ-< : LeftCancellative _<_ _+_
664-
+-cancelˡ-< m {n} {o} = +-cancelˡ-≤ m ∘ subst (_≤ m + o) (sym (+-suc m n))
664+
+-cancelˡ-< m n o = +-cancelˡ-≤ m (suc n) o ∘ subst (_≤ m + o) (sym (+-suc m n))
665665

666666
+-cancelʳ-< : RightCancellative _<_ _+_
667-
+-cancelʳ-< n o n+m<o+m = +-cancelʳ-≤ (suc n) o n+m<o+m
667+
+-cancelʳ-< m n o n+m<o+m = +-cancelʳ-≤ m (suc n) o n+m<o+m
668668

669669
+-cancel-< : Cancellative _<_ _+_
670670
+-cancel-< = +-cancelˡ-< , +-cancelʳ-<
@@ -915,7 +915,7 @@ m+n≮m m n = subst (_≮ m) (+-comm n m) (m+n≮n n m)
915915
*-cancelʳ-≡ : m n {o} .{{_ : NonZero o}} m * o ≡ n * o m ≡ n
916916
*-cancelʳ-≡ zero zero {suc o} eq = refl
917917
*-cancelʳ-≡ (suc m) (suc n) {suc o} eq =
918-
cong suc (*-cancelʳ-≡ m n (+-cancelˡ-≡ (suc o) eq))
918+
cong suc (*-cancelʳ-≡ m n (+-cancelˡ-≡ (suc o) (m * suc o) (n * suc o) eq))
919919

920920
*-cancelˡ-≡ : {m n} o .{{_ : NonZero o}} o * m ≡ o * n m ≡ n
921921
*-cancelˡ-≡ {m} {n} o rewrite *-comm o m | *-comm o n = *-cancelʳ-≡ m n
@@ -953,7 +953,7 @@ m*n≡1⇒n≡1 m n eq = m*n≡1⇒m≡1 n m (trans (*-comm n m) eq)
953953
*-cancelʳ-≤ : m n o .{{_ : NonZero o}} m * o ≤ n * o m ≤ n
954954
*-cancelʳ-≤ zero _ (suc o) _ = z≤n
955955
*-cancelʳ-≤ (suc m) (suc n) (suc o) le =
956-
s≤s (*-cancelʳ-≤ m n (suc o) (+-cancelˡ-≤ (suc o) le))
956+
s≤s (*-cancelʳ-≤ m n (suc o) (+-cancelˡ-≤ _ _ _ le))
957957

958958
*-cancelˡ-≤ : {m n} o .{{_ : NonZero o}} o * m ≤ o * n m ≤ n
959959
*-cancelˡ-≤ {m} {n} o rewrite *-comm o m | *-comm o n = *-cancelʳ-≤ m n o
@@ -1011,13 +1011,13 @@ m<n⇒m<o*n {m} {n} o m<n = begin-strict
10111011
o * n ∎
10121012

10131013
*-cancelʳ-< : RightCancellative _<_ _*_
1014-
*-cancelʳ-< {zero} zero (suc o) _ = 0<1+n
1015-
*-cancelʳ-< {suc m} zero (suc o) _ = 0<1+n
1016-
*-cancelʳ-< {m} (suc n) (suc o) nm<om =
1017-
s≤s (*-cancelʳ-< n o (+-cancelˡ-< m nm<om))
1014+
*-cancelʳ-< zero zero (suc o) _ = 0<1+n
1015+
*-cancelʳ-< (suc m) zero (suc o) _ = 0<1+n
1016+
*-cancelʳ-< m (suc n) (suc o) nm<om =
1017+
s≤s (*-cancelʳ-< m n o (+-cancelˡ-< m _ _ nm<om))
10181018

10191019
*-cancelˡ-< : LeftCancellative _<_ _*_
1020-
*-cancelˡ-< x {y} {z} rewrite *-comm x y | *-comm x z = *-cancelʳ-< y z
1020+
*-cancelˡ-< x y z rewrite *-comm x y | *-comm x z = *-cancelʳ-< x y z
10211021

10221022
*-cancel-< : Cancellative _<_ _*_
10231023
*-cancel-< = *-cancelˡ-< , *-cancelʳ-<
@@ -2071,7 +2071,7 @@ _>″?_ = flip _<″?_
20712071
≤″-irrelevant : Irrelevant _≤″_
20722072
≤″-irrelevant {m} (less-than-or-equal eq₁)
20732073
(less-than-or-equal eq₂)
2074-
with +-cancelˡ-≡ m (trans eq₁ (sym eq₂))
2074+
with +-cancelˡ-≡ m _ _ (trans eq₁ (sym eq₂))
20752075
... | refl = cong less-than-or-equal (≡-irrelevant eq₁ eq₂)
20762076

20772077
<″-irrelevant : Irrelevant _<″_

src/Data/Sign/Properties.agda

+6-6
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ s*s≡+ - = refl
8282
*-assoc - - - = refl
8383

8484
*-cancelʳ-≡ : RightCancellative _*_
85-
*-cancelʳ-≡ - - _ = refl
86-
*-cancelʳ-≡ - + eq = ⊥-elim (s≢opposite[s] _ $ sym eq)
87-
*-cancelʳ-≡ + - eq = ⊥-elim (s≢opposite[s] _ eq)
88-
*-cancelʳ-≡ + + _ = refl
85+
*-cancelʳ-≡ _ - - _ = refl
86+
*-cancelʳ-≡ _ - + eq = ⊥-elim (s≢opposite[s] _ $ sym eq)
87+
*-cancelʳ-≡ _ + - eq = ⊥-elim (s≢opposite[s] _ eq)
88+
*-cancelʳ-≡ _ + + _ = refl
8989

9090
*-cancelˡ-≡ : LeftCancellative _*_
91-
*-cancelˡ-≡ - eq = opposite-injective eq
92-
*-cancelˡ-≡ + eq = eq
91+
*-cancelˡ-≡ - _ _ eq = opposite-injective eq
92+
*-cancelˡ-≡ + _ _ eq = eq
9393

9494
*-cancel-≡ : Cancellative _*_
9595
*-cancel-≡ = *-cancelˡ-≡ , *-cancelʳ-≡

0 commit comments

Comments
 (0)