Skip to content

Commit e4a715f

Browse files
authored
[ new ] add _<_ for chars and deprecate non-propositional equality (#1343)
1 parent dbcdacb commit e4a715f

File tree

9 files changed

+286
-90
lines changed

9 files changed

+286
-90
lines changed

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ Non-backwards compatible changes
3737
* The module `Algebra.Construct.Zero` and `Algebra.Module.Construct.Zero`
3838
are now level-polymorphic, each taking two implicit level parameters.
3939

40+
* The orders on strings are now using propositional equality as the notion
41+
of equivalence on characters rather than the equivalent but less inference-friendly
42+
variant defined by conversion of characters to natural numbers.
43+
This is in line with our effort to deprecate this badly-behaved equivalence
44+
relation on characters.
45+
4046
* Previously `_⊖_` in `Data.Integer.Base` was defined inductively as:
4147
```agda
4248
_⊖_ : ℕ → ℕ → ℤ
@@ -112,6 +118,10 @@ Deprecated names
112118
Plus′ ↦ TransClosure
113119
```
114120

121+
* In `Data.Char.Properties`, deprecated all of the `_≈_`-related content: this
122+
relation is equivalent to propositional equality but has worse inference. So
123+
we are moving towards not using it anymore.
124+
115125
* In `Data.List.Relation.Binary.Subset.Propositional.Properties`:
116126
```agda
117127
mono ↦ Any-resp-⊆
@@ -371,6 +381,33 @@ Other minor additions
371381
+-*-commutativeSemiring : CommutativeSemiring 0ℓ 0ℓ
372382
```
373383

384+
* Added new definition to `Data.Char.Base`:
385+
```agda
386+
_≉_ : Rel Char zero
387+
_≤_ : Rel Char zero
388+
```
389+
390+
* Added proofs to `Data.Char.Properties`:
391+
```agda
392+
≉⇒≢ : _≉_ → x ≢ y
393+
394+
<-trans : Transitive _<_
395+
<-asym : Asymmetric _<_
396+
<-cmp : Trichotomous _≡_ _<_
397+
398+
_≤?_ : Decidable _≤_
399+
≤-reflexive : _≡_ ⇒ _≤_
400+
≤-trans : Transitive _≤_
401+
≤-antisym : Antisymmetric _≡_ _≤_
402+
≤-isPreorder : IsPreorder _≡_ _≤_
403+
≤-isPartialOrder : IsPartialOrder _≡_ _≤_
404+
≤-isDecPartialOrder : IsDecPartialOrder _≡_ _≤_
405+
406+
≤-preorder : Preorder _ _ _
407+
≤-poset : Poset _ _ _
408+
≤-decPoset : DecPoset _ _ _
409+
```
410+
374411
* Added infix declarations to `Data.Product.∃-syntax` and `Data.Product.∄-syntax`.
375412

376413
* Added new function to `Data.List.Base`:

README/Data/Trie/NonDependent.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ open import Relation.Nary
6565
open import Relation.Binary using (Rel)
6666
open import Relation.Nullary.Negation using (¬?)
6767

68-
open import Data.Trie Char.<-strictTotalOrder-≈
68+
open import Data.Trie Char.<-strictTotalOrder
6969
open import Data.Tree.AVL.Value
7070

7171
------------------------------------------------------------------------

src/Data/Char.agda

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ module Data.Char where
1212
-- Re-export base definitions and decidability of equality
1313

1414
open import Data.Char.Base public
15-
open import Data.Char.Properties using (_≈?_; _≟_; _<?_; _==_) public
15+
open import Data.Char.Properties
16+
using (_≈?_; _≟_; _<?_; _≤?_; _==_) public

src/Data/Char/Base.agda

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Data.Nat.Base as ℕ
1313
open import Function
1414
open import Relation.Binary using (Rel)
1515
open import Relation.Binary.PropositionalEquality
16+
open import Relation.Binary.Construct.Closure.Reflexive
1617

1718
------------------------------------------------------------------------
1819
-- Re-export the type, and renamed primitives
@@ -39,14 +40,21 @@ open import Agda.Builtin.Char public using ( Char )
3940
open import Agda.Builtin.String public using ()
4041
renaming ( primShowChar to show )
4142

42-
infix 4 _≈_
43+
infix 4 _≈_ _≉_
4344
_≈_ : Rel Char zero
4445
_≈_ = _≡_ on toℕ
4546

47+
_≉_ : Rel Char zero
48+
_≉_ = _≢_ on toℕ
49+
4650
infix 4 _<_
4751
_<_ : Rel Char zero
4852
_<_ = ℕ._<_ on toℕ
4953

54+
infix 4 _≤_
55+
_≤_ : Rel Char zero
56+
_≤_ = ReflClosure _<_
57+
5058
------------------------------------------------------------------------
5159
-- DEPRECATED NAMES
5260
------------------------------------------------------------------------

src/Data/Char/Instances.agda

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
module Data.Char.Instances where
1010

1111
open import Data.Char.Properties
12-
open import Relation.Binary.PropositionalEquality.Properties
13-
using (isDecEquivalence)
1412

1513
instance
16-
Char-≡-isDecEquivalence = isDecEquivalence _≟_
14+
Char-≡-isDecEquivalence = isDecEquivalence

0 commit comments

Comments
 (0)