Skip to content

Commit b51548b

Browse files
committed
Make equality a record to help inference
1 parent aa4cfa1 commit b51548b

File tree

3 files changed

+46
-39
lines changed

3 files changed

+46
-39
lines changed

src/Data/Integer/IntConstruction.agda

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ record ℤ : Set where
2323

2424
infix 4 _≃_ _≤_ _≥_ _<_ _>_
2525

26-
_≃_ : Rel ℤ _
27-
(a ⊖ b) ≃ (c ⊖ d) = a ℕ.+ d ≡ c ℕ.+ b
26+
record _≃_ (i j : ℤ) : Set where
27+
constructor mk≃
28+
field
29+
eq : ℤ.minuend i ℕ.+ ℤ.subtrahend j ≡ ℤ.minuend j ℕ.+ ℤ.subtrahend i
2830

2931
_≤_ : Rel ℤ _
3032
(a ⊖ b) ≤ (c ⊖ d) = a ℕ.+ d ℕ.≤ c ℕ.+ b

src/Data/Integer/IntConstruction/IntProperties.agda

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
module Data.Integer.IntConstruction.IntProperties where
1010

1111
open import Data.Integer.Base
12-
open import Data.Integer.IntConstruction as INT using (_≃_)
12+
open import Data.Integer.IntConstruction as INT using (_≃_; mk≃)
1313
open import Data.Integer.IntConstruction.Tmp
1414
open import Data.Integer.Properties
1515
import Data.Nat.Base as ℕ
@@ -18,7 +18,7 @@ open import Function.Base
1818
open import Relation.Binary.PropositionalEquality
1919

2020
fromINT-cong : {i j} i ≃ j fromINT i ≡ fromINT j
21-
fromINT-cong {a INT.⊖ b} {c INT.⊖ d} a+d≡c+b = begin
21+
fromINT-cong {a INT.⊖ b} {c INT.⊖ d} (mk≃ a+d≡c+b) = begin
2222
a ⊖ b ≡⟨ m-n≡m⊖n a b ⟨
2323
+ a - + b ≡⟨ cong (_- + b) (+-identityʳ (+ a)) ⟨
2424
(+ a + 0ℤ) - + b ≡⟨ cong (λ z (+ a + z) - + b) (+-inverseʳ (+ d)) ⟨
@@ -34,7 +34,7 @@ fromINT-cong {a INT.⊖ b} {c INT.⊖ d} a+d≡c+b = begin
3434
where open ≡-Reasoning
3535

3636
fromINT-injective : {i j} fromINT i ≡ fromINT j i ≃ j
37-
fromINT-injective {a INT.⊖ b} {c INT.⊖ d} a⊖b≡c⊖d = +-injective $ begin
37+
fromINT-injective {a INT.⊖ b} {c INT.⊖ d} a⊖b≡c⊖d = mk≃ $ +-injective $ begin
3838
+ a + + d ≡⟨ cong (_+ + d) (+-identityʳ (+ a)) ⟨
3939
(+ a + 0ℤ) + + d ≡⟨ cong (λ z (+ a + z) + + d) (+-inverseˡ (+ b)) ⟨
4040
(+ a + (- + b + + b)) + + d ≡⟨ cong (_+ + d) (+-assoc (+ a) (- + b) (+ b)) ⟨
@@ -52,7 +52,7 @@ fromINT-injective {a INT.⊖ b} {c INT.⊖ d} a⊖b≡c⊖d = +-injective $ begi
5252

5353
fromINT-surjective : j ∃[ i ] {z} z ≃ i fromINT z ≡ j
5454
fromINT-surjective j .proj₁ = toINT j
55-
fromINT-surjective (+ n) .proj₂ {a INT.⊖ b} a+0≡n+b = begin
55+
fromINT-surjective (+ n) .proj₂ {a INT.⊖ b} (mk≃ a+0≡n+b) = begin
5656
a ⊖ b ≡⟨ m-n≡m⊖n a b ⟨
5757
+ a - + b ≡⟨ cong (_- + b) (+-identityʳ (+ a)) ⟨
5858
(+ a + 0ℤ) - + b ≡⟨ cong (λ z + z - + b) a+0≡n+b ⟩
@@ -61,7 +61,7 @@ fromINT-surjective (+ n) .proj₂ {a INT.⊖ b} a+0≡n+b = begin
6161
+ n + 0ℤ ≡⟨ +-identityʳ (+ n) ⟩
6262
+ n ∎
6363
where open ≡-Reasoning
64-
fromINT-surjective (-[1+ n ]) .proj₂ {a INT.⊖ b} a+sn≡b = begin
64+
fromINT-surjective (-[1+ n ]) .proj₂ {a INT.⊖ b} (mk≃ a+sn≡b) = begin
6565
a ⊖ b ≡⟨ m-n≡m⊖n a b ⟨
6666
+ a - + b ≡⟨ cong (λ z + a - + z) a+sn≡b ⟨
6767
+ a - (+ a + + ℕ.suc n) ≡⟨ cong (_+_ (+ a)) (neg-distrib-+ (+ a) (+ ℕ.suc n)) ⟩

src/Data/Integer/IntConstruction/Properties.agda

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,18 @@ private
4646
-- Properties of _≃_
4747

4848
≃-refl : Reflexive _≃_
49-
≃-refl = refl
49+
≃-refl = mk≃ refl
5050

5151
≃-sym : Symmetric _≃_
52-
≃-sym = sym
52+
≃-sym (mk≃ eq) = mk≃ (sym eq)
5353

5454
≃-trans : Transitive _≃_
55-
≃-trans {a ⊖ b} {c ⊖ d} {e ⊖ f} i≃j j≃k = ℕ.+-cancelʳ-≡ (d ℕ.+ c) (a ℕ.+ f) (e ℕ.+ b) $ trans-helper _≡_ a b c d e f (cong₂ ℕ._+_ i≃j j≃k)
55+
≃-trans {a ⊖ b} {c ⊖ d} {e ⊖ f} (mk≃ i≃j) (mk≃ j≃k) = mk≃ (ℕ.+-cancelʳ-≡ (d ℕ.+ c) (a ℕ.+ f) (e ℕ.+ b) $ trans-helper _≡_ a b c d e f (cong₂ ℕ._+_ i≃j j≃k))
5656

5757
_≃?_ : Decidable _≃_
58-
(a ⊖ b) ≃? (c ⊖ d) = a ℕ.+ d ℕ.≟ c ℕ.+ b
58+
(a ⊖ b) ≃? (c ⊖ d) with a ℕ.+ d ℕ.≟ c ℕ.+ b
59+
... | no a+d≢c+b = no λ (mk≃ a+d≡c+b) a+d≢c+b a+d≡c+b
60+
... | yes a+d≡c+b = yes (mk≃ a+d≡c+b)
5961

6062
------------------------------------------------------------------------
6163
-- Properties of _≤_
@@ -64,13 +66,13 @@ _≃?_ : Decidable _≃_
6466
≤-refl = ℕ.≤-refl
6567

6668
≤-reflexive : _≃_ ⇒ _≤_
67-
≤-reflexive = ℕ.≤-reflexive
69+
≤-reflexive (mk≃ eq) = ℕ.≤-reflexive eq
6870

6971
≤-trans : Transitive _≤_
7072
≤-trans {a ⊖ b} {c ⊖ d} {e ⊖ f} i≤j j≤k = ℕ.+-cancelʳ-≤ (d ℕ.+ c) (a ℕ.+ f) (e ℕ.+ b) $ trans-helper ℕ._≤_ a b c d e f (ℕ.+-mono-≤ i≤j j≤k)
7173

7274
≤-antisym : Antisymmetric _≃_ _≤_
73-
≤-antisym i≤j j≤i = ℕ.≤-antisym i≤j j≤i
75+
≤-antisym i≤j j≤i = mk≃ (ℕ.≤-antisym i≤j j≤i)
7476

7577
≤-total : Total _≤_
7678
≤-total (a ⊖ b) (c ⊖ d) = ℕ.≤-total (a ℕ.+ d) (c ℕ.+ b)
@@ -82,28 +84,31 @@ _≤?_ : Decidable _≤_
8284
-- Properties of _<_
8385

8486
<-irrefl : Irreflexive _≃_ _<_
85-
<-irrefl = ℕ.<-irrefl
87+
<-irrefl (mk≃ eq) = ℕ.<-irrefl eq
8688

8789
<-trans : Transitive _<_
8890
<-trans {a ⊖ b} {c ⊖ d} {e ⊖ f} i<j j<k = ℕ.+-cancelʳ-< (d ℕ.+ c) (a ℕ.+ f) (e ℕ.+ b) $ trans-helper ℕ._<_ a b c d e f (ℕ.+-mono-< i<j j<k)
8991

9092
<-respˡ-≃ : _<_ Respectsˡ _≃_
91-
<-respˡ-≃ {a ⊖ b} {c ⊖ d} {e ⊖ f} j≃k i>j = ℕ.+-cancelʳ-< (d ℕ.+ c) (e ℕ.+ b) (a ℕ.+ f) $ trans-helper ℕ._>_ a b c d e f (ℕ.+-mono-<-≤ i>j (ℕ.≤-reflexive (sym j≃k)))
93+
<-respˡ-≃ {a ⊖ b} {c ⊖ d} {e ⊖ f} (mk≃ j≃k) i>j = ℕ.+-cancelʳ-< (d ℕ.+ c) (e ℕ.+ b) (a ℕ.+ f) $ trans-helper ℕ._>_ a b c d e f (ℕ.+-mono-<-≤ i>j (ℕ.≤-reflexive (sym j≃k)))
9294

9395
<-respʳ-≃ : _<_ Respectsʳ _≃_
94-
<-respʳ-≃ {a ⊖ b} {c ⊖ d} {e ⊖ f} j≃k i<j = ℕ.+-cancelʳ-< (d ℕ.+ c) (a ℕ.+ f) (e ℕ.+ b) $ trans-helper ℕ._<_ a b c d e f (ℕ.+-mono-<-≤ i<j (ℕ.≤-reflexive j≃k))
96+
<-respʳ-≃ {a ⊖ b} {c ⊖ d} {e ⊖ f} (mk≃ j≃k) i<j = ℕ.+-cancelʳ-< (d ℕ.+ c) (a ℕ.+ f) (e ℕ.+ b) $ trans-helper ℕ._<_ a b c d e f (ℕ.+-mono-<-≤ i<j (ℕ.≤-reflexive j≃k))
9597

9698
_<?_ : Decidable _<_
9799
(a ⊖ b) <? (c ⊖ d) = a ℕ.+ d ℕ.<? c ℕ.+ b
98100

99101
<-cmp : Trichotomous _≃_ _<_
100-
<-cmp (a ⊖ b) (c ⊖ d) = ℕ.<-cmp (a ℕ.+ d) (c ℕ.+ b)
102+
<-cmp (a ⊖ b) (c ⊖ d) with ℕ.<-cmp (a ℕ.+ d) (c ℕ.+ b)
103+
... | tri< a+d<c+b a+d≢c+d a+d≯c+d = tri< a+d<c+b (a+d≢c+d ∘ _≃_.eq) a+d≯c+d
104+
... | tri≈ a+d≮c+b a+d≡c+d a+d≯c+d = tri≈ a+d≮c+b (mk≃ a+d≡c+d) a+d≯c+d
105+
... | tri> a+d≮c+b a+d≢c+d a+d>c+d = tri> a+d≮c+b (a+d≢c+d ∘ _≃_.eq) a+d>c+d
101106

102107
------------------------------------------------------------------------
103108
-- Algebraic properties of _+_
104109

105110
+-cong : Congruent₂ _+_
106-
+-cong {a ⊖ b} {c ⊖ d} {e ⊖ f} {g ⊖ h} a+d≡c+b e+h≡g+f = begin
111+
+-cong {a ⊖ b} {c ⊖ d} {e ⊖ f} {g ⊖ h} (mk≃ a+d≡c+b) (mk≃ e+h≡g+f) = mk≃ $ begin
107112
(a ℕ.+ e) ℕ.+ (d ℕ.+ h) ≡⟨ medial a e d h ⟩
108113
(a ℕ.+ d) ℕ.+ (e ℕ.+ h) ≡⟨ cong₂ ℕ._+_ a+d≡c+b e+h≡g+f ⟩
109114
(c ℕ.+ b) ℕ.+ (g ℕ.+ f) ≡⟨ medial c b g f ⟩
@@ -113,16 +118,16 @@ _<?_ : Decidable _<_
113118
open CommSemigroupProps ℕ.+-commutativeSemigroup
114119

115120
+-assoc : Associative _+_
116-
+-assoc (a ⊖ b) (c ⊖ d) (e ⊖ f) = cong₂ ℕ._+_ (ℕ.+-assoc a c e) (sym (ℕ.+-assoc b d f))
121+
+-assoc (a ⊖ b) (c ⊖ d) (e ⊖ f) = mk≃ $ cong₂ ℕ._+_ (ℕ.+-assoc a c e) (sym (ℕ.+-assoc b d f))
117122

118123
+-identityˡ : LeftIdentity 0ℤ _+_
119-
+-identityˡ (a ⊖ b) = refl
124+
+-identityˡ (a ⊖ b) = mk≃ refl
120125

121126
+-identityʳ : RightIdentity 0ℤ _+_
122-
+-identityʳ (a ⊖ b) = cong₂ ℕ._+_ (ℕ.+-identityʳ a) (sym (ℕ.+-identityʳ b))
127+
+-identityʳ (a ⊖ b) = mk≃ $ cong₂ ℕ._+_ (ℕ.+-identityʳ a) (sym (ℕ.+-identityʳ b))
123128

124129
+-comm : Commutative _+_
125-
+-comm (a ⊖ b) (c ⊖ d) = cong₂ ℕ._+_ (ℕ.+-comm a c) (ℕ.+-comm d b)
130+
+-comm (a ⊖ b) (c ⊖ d) = mk≃ $ cong₂ ℕ._+_ (ℕ.+-comm a c) (ℕ.+-comm d b)
126131

127132
------------------------------------------------------------------------
128133
-- Properties of _+_ and _≤_
@@ -141,18 +146,18 @@ _<?_ : Decidable _<_
141146
-- Algebraic properties of -_
142147

143148
-‿cong : Congruent₁ -_
144-
-‿cong {a ⊖ b} {c ⊖ d} a+d≡c+b = begin
149+
-‿cong {a ⊖ b} {c ⊖ d} (mk≃ a+d≡c+b) = mk≃ $ begin
145150
b ℕ.+ c ≡⟨ ℕ.+-comm b c ⟩
146151
c ℕ.+ b ≡⟨ a+d≡c+b ⟨
147152
a ℕ.+ d ≡⟨ ℕ.+-comm a d ⟩
148153
d ℕ.+ a ∎
149154
where open ≡-Reasoning
150155

151156
+-inverseˡ : LeftInverse 0ℤ -_ _+_
152-
+-inverseˡ (a ⊖ b) = trans (ℕ.+-identityʳ (b ℕ.+ a)) (ℕ.+-comm b a)
157+
+-inverseˡ (a ⊖ b) = mk≃ $ trans (ℕ.+-identityʳ (b ℕ.+ a)) (ℕ.+-comm b a)
153158

154159
+-inverseʳ : RightInverse 0ℤ -_ _+_
155-
+-inverseʳ (a ⊖ b) = trans (ℕ.+-identityʳ (a ℕ.+ b)) (ℕ.+-comm a b)
160+
+-inverseʳ (a ⊖ b) = mk≃ $ trans (ℕ.+-identityʳ (a ℕ.+ b)) (ℕ.+-comm a b)
156161

157162
------------------------------------------------------------------------
158163
-- Properties of -_ and _≤_
@@ -169,7 +174,7 @@ _<?_ : Decidable _<_
169174
-- Algebraic properties of _*_
170175

171176
*-cong : Congruent₂ _*_
172-
*-cong {a ⊖ b} {c ⊖ d} {e ⊖ f} {g ⊖ h} a+d≡c+b e+h≡g+f = ℕ.+-cancelʳ-≡ (d ℕ.* e) _ _ $ begin
177+
*-cong {a ⊖ b} {c ⊖ d} {e ⊖ f} {g ⊖ h} (mk≃ a+d≡c+b) (mk≃ e+h≡g+f) = mk≃ $ ℕ.+-cancelʳ-≡ (d ℕ.* e) _ _ $ begin
173178
((a ℕ.* e ℕ.+ b ℕ.* f) ℕ.+ (c ℕ.* h ℕ.+ d ℕ.* g)) ℕ.+ d ℕ.* e ≡⟨ ℕ.+-assoc (a ℕ.* e ℕ.+ b ℕ.* f) (c ℕ.* h ℕ.+ d ℕ.* g) (d ℕ.* e) ⟩
174179
(a ℕ.* e ℕ.+ b ℕ.* f) ℕ.+ ((c ℕ.* h ℕ.+ d ℕ.* g) ℕ.+ d ℕ.* e) ≡⟨ cong (a ℕ.* e ℕ.+ b ℕ.* f ℕ.+_) (ℕ.+-comm (c ℕ.* h ℕ.+ d ℕ.* g) (d ℕ.* e)) ⟩
175180
(a ℕ.* e ℕ.+ b ℕ.* f) ℕ.+ (d ℕ.* e ℕ.+ (c ℕ.* h ℕ.+ d ℕ.* g)) ≡⟨ medial (a ℕ.* e) (b ℕ.* f) (d ℕ.* e) (c ℕ.* h ℕ.+ d ℕ.* g) ⟩
@@ -197,7 +202,7 @@ _<?_ : Decidable _<_
197202
open CommSemigroupProps ℕ.+-commutativeSemigroup
198203

199204
*-assoc : Associative _*_
200-
*-assoc (a ⊖ b) (c ⊖ d) (e ⊖ f) = cong₂ ℕ._+_ (lemma a b c d e f) (sym (lemma a b c d f e))
205+
*-assoc (a ⊖ b) (c ⊖ d) (e ⊖ f) = mk≃ $ cong₂ ℕ._+_ (lemma a b c d e f) (sym (lemma a b c d f e))
201206
where
202207
open ≡-Reasoning
203208
open CommSemigroupProps ℕ.+-commutativeSemigroup
@@ -212,27 +217,27 @@ _<?_ : Decidable _<_
212217
u ℕ.* (w ℕ.* y ℕ.+ x ℕ.* z) ℕ.+ v ℕ.* (w ℕ.* z ℕ.+ x ℕ.* y) ∎
213218

214219
*-zeroˡ : LeftZero 0ℤ _*_
215-
*-zeroˡ _ = refl
220+
*-zeroˡ _ = mk≃ refl
216221

217222
*-zeroʳ : RightZero 0ℤ _*_
218-
*-zeroʳ _ = ℕ.+-identityʳ _
223+
*-zeroʳ _ = mk≃ $ ℕ.+-identityʳ _
219224

220225
*-identityˡ : LeftIdentity 1ℤ _*_
221-
*-identityˡ (a ⊖ b) = cong₂ ℕ._+_ (lemma a) (sym (lemma b))
226+
*-identityˡ (a ⊖ b) = mk≃ $ cong₂ ℕ._+_ (lemma a) (sym (lemma b))
222227
where
223228
lemma : n n ℕ.+ 0 ℕ.+ 0 ≡ n
224229
lemma n = trans (ℕ.+-identityʳ (n ℕ.+ 0)) (ℕ.+-identityʳ n)
225230

226231
*-identityʳ : RightIdentity 1ℤ _*_
227-
*-identityʳ (a ⊖ b) = cong₂ ℕ._+_ l (sym r)
232+
*-identityʳ (a ⊖ b) = mk≃ $ cong₂ ℕ._+_ l (sym r)
228233
where
229234
l : a ℕ.* 1 ℕ.+ b ℕ.* 0 ≡ a
230235
l = trans (cong₂ ℕ._+_ (ℕ.*-identityʳ a) (ℕ.*-zeroʳ b)) (ℕ.+-identityʳ a)
231236
r : a ℕ.* 0 ℕ.+ b ℕ.* 1 ≡ b
232237
r = trans (cong₂ ℕ._+_ (ℕ.*-zeroʳ a) (ℕ.*-identityʳ b)) (ℕ.+-identityˡ b)
233238

234239
*-distribˡ-+ : _*_ DistributesOverˡ _+_
235-
*-distribˡ-+ (a ⊖ b) (c ⊖ d) (e ⊖ f) = cong₂ ℕ._+_ (lemma a b c d e f) (sym (lemma a b d c f e))
240+
*-distribˡ-+ (a ⊖ b) (c ⊖ d) (e ⊖ f) = mk≃ $ cong₂ ℕ._+_ (lemma a b c d e f) (sym (lemma a b d c f e))
236241
where
237242
open ≡-Reasoning
238243
open CommSemigroupProps ℕ.+-commutativeSemigroup
@@ -244,7 +249,7 @@ _<?_ : Decidable _<_
244249
(u ℕ.* w ℕ.+ v ℕ.* x) ℕ.+ (u ℕ.* y ℕ.+ v ℕ.* z) ∎
245250

246251
*-distribʳ-+ : _*_ DistributesOverʳ _+_
247-
*-distribʳ-+ (a ⊖ b) (c ⊖ d) (e ⊖ f) = cong₂ ℕ._+_ (lemma a b c d e f) (sym (lemma b a c d e f))
252+
*-distribʳ-+ (a ⊖ b) (c ⊖ d) (e ⊖ f) = mk≃ $ cong₂ ℕ._+_ (lemma a b c d e f) (sym (lemma b a c d e f))
248253
where
249254
open ≡-Reasoning
250255
open CommSemigroupProps ℕ.+-commutativeSemigroup
@@ -256,16 +261,16 @@ _<?_ : Decidable _<_
256261
(w ℕ.* u ℕ.+ x ℕ.* v) ℕ.+ (y ℕ.* u ℕ.+ z ℕ.* v) ∎
257262

258263
*-comm : Commutative _*_
259-
*-comm (a ⊖ b) (c ⊖ d) = cong₂ ℕ._+_ (cong₂ ℕ._+_ (ℕ.*-comm a c) (ℕ.*-comm b d)) (trans (ℕ.+-comm (c ℕ.* b) (d ℕ.* a)) (cong₂ ℕ._+_ (ℕ.*-comm d a) (ℕ.*-comm c b)))
264+
*-comm (a ⊖ b) (c ⊖ d) = mk≃ $ cong₂ ℕ._+_ (cong₂ ℕ._+_ (ℕ.*-comm a c) (ℕ.*-comm b d)) (trans (ℕ.+-comm (c ℕ.* b) (d ℕ.* a)) (cong₂ ℕ._+_ (ℕ.*-comm d a) (ℕ.*-comm c b)))
260265

261266
------------------------------------------------------------------------
262267
-- Properties of ⁺_
263268

264269
⁺-cong : {m n} m ≡ n ⁺ m ≃ ⁺ n
265-
⁺-cong refl = refl
270+
⁺-cong refl = mk≃ refl
266271

267272
⁺-injective : {m n} ⁺ m ≃ ⁺ n m ≡ n
268-
⁺-injective {m} {n} m+0≡n+0 = begin
273+
⁺-injective {m} {n} (mk≃ m+0≡n+0) = begin
269274
m ≡⟨ ℕ.+-identityʳ m ⟨
270275
m ℕ.+ 0 ≡⟨ m+0≡n+0 ⟩
271276
n ℕ.+ 0 ≡⟨ ℕ.+-identityʳ n ⟩
@@ -279,13 +284,13 @@ _<?_ : Decidable _<_
279284
⁺-mono-< = ℕ.+-monoˡ-< 0
280285

281286
⁺-+-homo : m n ⁺ (m ℕ.+ n) ≃ ⁺ m + ⁺ n
282-
⁺-+-homo m n = refl
287+
⁺-+-homo m n = mk≃ refl
283288

284289
⁺-0-homo :0 ≡ 0ℤ
285290
⁺-0-homo = refl
286291

287292
⁺-*-homo : m n ⁺ (m ℕ.* n) ≃ ⁺ m * ⁺ n
288-
⁺-*-homo m n = begin
293+
⁺-*-homo m n = mk≃ $ begin
289294
m ℕ.* n ℕ.+ (m ℕ.* 0 ℕ.+ 0) ≡⟨ cong (m ℕ.* n ℕ.+_) (ℕ.+-identityʳ (m ℕ.* 0)) ⟩
290295
m ℕ.* n ℕ.+ m ℕ.* 0 ≡⟨ cong (m ℕ.* n ℕ.+_) (ℕ.*-zeroʳ m) ⟩
291296
m ℕ.* n ℕ.+ 0 ≡⟨ ℕ.+-identityʳ (m ℕ.* n ℕ.+ 0) ⟨
@@ -296,7 +301,7 @@ _<?_ : Decidable _<_
296301
-- Properties of ∣_∣
297302

298303
∣∣-cong : {i j} i ≃ j ∣ i ∣ ≡ ∣ j ∣
299-
∣∣-cong {a ⊖ b} {c ⊖ d} a+d≡c+b = begin
304+
∣∣-cong {a ⊖ b} {c ⊖ d} (mk≃ a+d≡c+b) = begin
300305
ℕ.∣ a - b ∣′ ≡⟨ ℕ.∣-∣≡∣-∣′ a b ⟨
301306
ℕ.∣ a - b ∣ ≡⟨ ℕ.∣m+o-n+o∣≡∣m-n∣ a b d ⟨
302307
ℕ.∣ a ℕ.+ d - b ℕ.+ d ∣ ≡⟨ cong ℕ.∣_- b ℕ.+ d ∣ a+d≡c+b ⟩

0 commit comments

Comments
 (0)