Skip to content

Commit 33cb598

Browse files
jamesmckinnaandreasabel
authored andcommitted
Rectifies the negated equality symbol in Data.Rational.Unnormalised.* (#2118)
1 parent a8916ba commit 33cb598

File tree

5 files changed

+54
-45
lines changed

5 files changed

+54
-45
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ Non-backwards compatible changes
892892
(issue #1437) to conform with the defined setoid equality `_≃_` on `Rational`s:
893893
```agda
894894
step-≈ ↦ step-≃
895-
step-˘ ↦ step-≃˘
895+
step-˘ ↦ step-≃˘
896896
```
897897
with corresponding associated syntax:
898898
```agda
@@ -1399,6 +1399,13 @@ Deprecated names
13991399
<-step ↦ m<n⇒m<1+n
14001400
```
14011401
1402+
* In `Data.Rational.Unnormalised.Base`:
1403+
```
1404+
_≠_ ↦ _≄_
1405+
+-rawMonoid ↦ +-0-rawMonoid
1406+
*-rawMonoid ↦ *-1-rawMonoid
1407+
```
1408+
14021409
* In `Data.Rational.Unnormalised.Properties`:
14031410
```
14041411
[p/q]≡p ↦ ↥[n/d]≡n

src/Data/Rational/Base.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ open import Data.Rational.Unnormalised.Base as ℚᵘ using (ℚᵘ; mkℚᵘ)
1919
open import Data.Sum.Base using (inj₂)
2020
open import Function.Base using (id)
2121
open import Level using (0ℓ)
22-
open import Relation.Nullary using (¬_; recompute)
23-
open import Relation.Nullary.Negation using (contradiction)
22+
open import Relation.Nullary.Decidable.Core using (recompute)
23+
open import Relation.Nullary.Negation.Core using (¬_; contradiction)
2424
open import Relation.Unary using (Pred)
2525
open import Relation.Binary.Core using (Rel)
2626
open import Relation.Binary.PropositionalEquality.Core

src/Data/Rational/Properties.agda

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ open import Relation.Binary.Definitions
5959
open import Relation.Binary.PropositionalEquality
6060
open import Relation.Binary.Morphism.Structures
6161
import Relation.Binary.Morphism.OrderMonomorphism as OrderMonomorphisms
62-
open import Relation.Nullary.Decidable as Dec
63-
using (True; False; fromWitness; fromWitnessFalse; toWitnessFalse; yes; no; recompute; map′; _×-dec_)
64-
open import Relation.Nullary.Negation using (¬_; contradiction; contraposition)
62+
open import Relation.Nullary.Decidable.Core as Dec
63+
using (yes; no; recompute; map′; _×-dec_)
64+
open import Relation.Nullary.Negation.Core using (¬_; contradiction)
6565

6666
open import Algebra.Definitions {A = ℚ} _≡_
6767
open import Algebra.Structures {A = ℚ} _≡_

src/Data/Rational/Unnormalised/Base.agda

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ open import Data.Integer.Base as ℤ
1414
using (ℤ; +_; +0; +[1+_]; -[1+_]; +<+; +≤+)
1515
open import Data.Nat.Base as ℕ using (ℕ; zero; suc)
1616
open import Level using (0ℓ)
17-
open import Relation.Nullary.Negation using (¬_)
18-
open import Relation.Nullary.Negation using (contradiction)
17+
open import Relation.Nullary.Negation.Core using (¬_; contradiction)
1918
open import Relation.Unary using (Pred)
2019
open import Relation.Binary.Core using (Rel)
2120
open import Relation.Binary.PropositionalEquality.Core
@@ -66,8 +65,8 @@ infix 4 _≃_ _≠_
6665
data _≃_ : Rel ℚᵘ 0ℓ where
6766
*≡* : {p q} (↥ p ℤ.* ↧ q) ≡ (↥ q ℤ.* ↧ p) p ≃ q
6867

69-
__ : Rel ℚᵘ 0ℓ
70-
p q = ¬ (p ≃ q)
68+
__ : Rel ℚᵘ 0ℓ
69+
p q = ¬ (p ≃ q)
7170

7271
------------------------------------------------------------------------
7372
-- Ordering of rationals
@@ -156,7 +155,7 @@ NonNegative p = ℤ.NonNegative (↥ p)
156155
-- from ℤ but it requires importing `Data.Integer.Properties` which
157156
-- we would like to avoid doing.
158157

159-
≢-nonZero : {p} p 0ℚᵘ NonZero p
158+
≢-nonZero : {p} p 0ℚᵘ NonZero p
160159
≢-nonZero {mkℚᵘ -[1+ _ ] _ } _ = _
161160
≢-nonZero {mkℚᵘ +[1+ _ ] _ } _ = _
162161
≢-nonZero {mkℚᵘ +0 zero } p≢0 = contradiction (*≡* refl) p≢0
@@ -378,3 +377,8 @@ Please use +-0-rawMonoid instead."
378377
"Warning: *-rawMonoid was deprecated in v2.0
379378
Please use *-1-rawMonoid instead."
380379
#-}
380+
_≠_ = _≄_
381+
{-# WARNING_ON_USAGE _≠_
382+
"Warning: _≠_ was deprecated in v2.0
383+
Please use _≄_ instead."
384+
#-}

src/Data/Rational/Unnormalised/Properties.agda

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ open import Data.Sum.Base using (_⊎_; [_,_]′; inj₁; inj₂)
3030
import Data.Sign as Sign
3131
open import Function.Base using (_on_; _$_; _∘_; flip)
3232
open import Level using (0ℓ)
33-
open import Relation.Nullary using (¬_; yes; no)
34-
import Relation.Nullary.Decidable as Dec
35-
open import Relation.Nullary.Negation using (contradiction; contraposition)
33+
open import Relation.Nullary.Decidable.Core as Dec using (yes; no)
34+
open import Relation.Nullary.Negation.Core using (¬_; contradiction)
3635
open import Relation.Binary.Core using (_⇒_; _Preserves_⟶_; _Preserves₂_⟶_⟶_)
3736
open import Relation.Binary.Bundles
3837
using (Setoid; DecSetoid; Preorder; TotalPreorder; Poset; TotalOrder; DecTotalOrder; StrictPartialOrder; StrictTotalOrder; DenseLinearOrder)
@@ -43,7 +42,6 @@ open import Relation.Binary.Definitions
4342
import Relation.Binary.Consequences as BC
4443
open import Relation.Binary.PropositionalEquality
4544
import Relation.Binary.Properties.Poset as PosetProperties
46-
open import Relation.Nullary using (yes; no)
4745
import Relation.Binary.Reasoning.Setoid as SetoidReasoning
4846

4947
open import Algebra.Properties.CommutativeSemigroup ℤ.*-commutativeSemigroup
@@ -105,20 +103,20 @@ infix 4 _≃?_
105103
_≃?_ : Decidable _≃_
106104
p ≃? q = Dec.map′ *≡* drop-*≡* (↥ p ℤ.* ↧ q ℤ.≟ ↥ q ℤ.* ↧ p)
107105

108-
01 : 0ℚᵘ 1ℚᵘ
109-
01 = Dec.from-no (0ℚᵘ ≃? 1ℚᵘ)
106+
01 : 0ℚᵘ 1ℚᵘ
107+
01 = Dec.from-no (0ℚᵘ ≃? 1ℚᵘ)
110108

111-
≃--irreflexive : Irreflexive _≃_ __
112-
≃--irreflexive x≃y xy = xy x≃y
109+
≃--irreflexive : Irreflexive _≃_ __
110+
≃--irreflexive x≃y xy = xy x≃y
113111

114-
-symmetric : Symmetric __
115-
-symmetric xy y≃x = xy (≃-sym y≃x)
112+
-symmetric : Symmetric __
113+
-symmetric xy y≃x = xy (≃-sym y≃x)
116114

117-
-cotransitive : Cotransitive __
118-
-cotransitive {x} {y} xy z with x ≃? z | z ≃? y
119-
... | no xz | _ = inj₁ xz
120-
... | yes _ | no zy = inj₂ zy
121-
... | yes x≃z | yes z≃y = contradiction (≃-trans x≃z z≃y) xy
115+
-cotransitive : Cotransitive __
116+
-cotransitive {x} {y} xy z with x ≃? z | z ≃? y
117+
... | no xz | _ = inj₁ xz
118+
... | yes _ | no zy = inj₂ zy
119+
... | yes x≃z | yes z≃y = contradiction (≃-trans x≃z z≃y) xy
122120

123121
≃-isEquivalence : IsEquivalence _≃_
124122
≃-isEquivalence = record
@@ -133,16 +131,16 @@ p ≃? q = Dec.map′ *≡* drop-*≡* (↥ p ℤ.* ↧ q ℤ.≟ ↥ q ℤ.*
133131
; _≟_ = _≃?_
134132
}
135133

136-
-isApartnessRelation : IsApartnessRelation _≃_ __
137-
-isApartnessRelation = record
138-
{ irrefl = ≃--irreflexive
139-
; sym = -symmetric
140-
; cotrans = -cotransitive
134+
-isApartnessRelation : IsApartnessRelation _≃_ __
135+
-isApartnessRelation = record
136+
{ irrefl = ≃--irreflexive
137+
; sym = -symmetric
138+
; cotrans = -cotransitive
141139
}
142140

143-
-tight : Tight _≃_ __
144-
proj₁ (-tight p q) ¬pq = Dec.decidable-stable (p ≃? q) ¬pq
145-
proj₂ (-tight p q) p≃q pq = pq p≃q
141+
-tight : Tight _≃_ __
142+
proj₁ (-tight p q) ¬pq = Dec.decidable-stable (p ≃? q) ¬pq
143+
proj₂ (-tight p q) p≃q pq = pq p≃q
146144

147145
≃-setoid : Setoid 0ℓ 0ℓ
148146
≃-setoid = record
@@ -1127,11 +1125,11 @@ p≤q⇒0≤q-p {p} {q} p≤q = begin
11271125
*-inverseʳ : p .{{_ : NonZero p}} p * 1/ p ≃ 1ℚᵘ
11281126
*-inverseʳ p = ≃-trans (*-comm p (1/ p)) (*-inverseˡ p)
11291127

1130-
⇒invertible : p q Invertible _≃_ 1ℚᵘ _*_ (p - q)
1131-
⇒invertible {p} {q} pq = _ , *-inverseˡ (p - q) , *-inverseʳ (p - q)
1128+
⇒invertible : p q Invertible _≃_ 1ℚᵘ _*_ (p - q)
1129+
⇒invertible {p} {q} pq = _ , *-inverseˡ (p - q) , *-inverseʳ (p - q)
11321130
where instance
11331131
_ : NonZero (p - q)
1134-
_ = ≢-nonZero (pq ∘ p-q≃0⇒p≃q p q)
1132+
_ = ≢-nonZero (pq ∘ p-q≃0⇒p≃q p q)
11351133

11361134
*-zeroˡ : LeftZero _≃_ 0ℚᵘ _*_
11371135
*-zeroˡ p@record{} = *≡* refl
@@ -1142,8 +1140,8 @@ p≤q⇒0≤q-p {p} {q} p≤q = begin
11421140
*-zero : Zero _≃_ 0ℚᵘ _*_
11431141
*-zero = *-zeroˡ , *-zeroʳ
11441142

1145-
invertible⇒ : Invertible _≃_ 1ℚᵘ _*_ (p - q) p q
1146-
invertible⇒ {p} {q} (1/p-q , 1/x*x≃1 , x*1/x≃1) p≃q = 01 (begin
1143+
invertible⇒ : Invertible _≃_ 1ℚᵘ _*_ (p - q) p q
1144+
invertible⇒ {p} {q} (1/p-q , 1/x*x≃1 , x*1/x≃1) p≃q = 01 (begin
11471145
0ℚᵘ ≈˘⟨ *-zeroˡ 1/p-q ⟩
11481146
0ℚᵘ * 1/p-q ≈˘⟨ *-congʳ (p≃q⇒p-q≃0 p q p≃q) ⟩
11491147
(p - q) * 1/p-q ≈⟨ x*1/x≃1 ⟩
@@ -1390,18 +1388,18 @@ nonNeg*nonNeg⇒nonNeg p q = nonNegative
13901388
; *-comm = *-comm
13911389
}
13921390

1393-
+-*-isHeytingCommutativeRing : IsHeytingCommutativeRing _≃_ __ _+_ _*_ -_ 0ℚᵘ 1ℚᵘ
1391+
+-*-isHeytingCommutativeRing : IsHeytingCommutativeRing _≃_ __ _+_ _*_ -_ 0ℚᵘ 1ℚᵘ
13941392
+-*-isHeytingCommutativeRing = record
13951393
{ isCommutativeRing = +-*-isCommutativeRing
1396-
; isApartnessRelation = -isApartnessRelation
1397-
; #⇒invertible = ⇒invertible
1398-
; invertible⇒# = invertible⇒
1394+
; isApartnessRelation = -isApartnessRelation
1395+
; #⇒invertible = ⇒invertible
1396+
; invertible⇒# = invertible⇒
13991397
}
14001398

1401-
+-*-isHeytingField : IsHeytingField _≃_ __ _+_ _*_ -_ 0ℚᵘ 1ℚᵘ
1399+
+-*-isHeytingField : IsHeytingField _≃_ __ _+_ _*_ -_ 0ℚᵘ 1ℚᵘ
14021400
+-*-isHeytingField = record
14031401
{ isHeytingCommutativeRing = +-*-isHeytingCommutativeRing
1404-
; tight = -tight
1402+
; tight = -tight
14051403
}
14061404

14071405
------------------------------------------------------------------------

0 commit comments

Comments
 (0)