Skip to content

Commit 67ff824

Browse files
jamesmckinnaandreasabel
authored andcommitted
[fixes #2178] regularise and specify/systematise, the conventions for symbol usage (#2185)
* regularise and specify/systematise, the conventions for symbol usage * typos/revisions
1 parent d8cd956 commit 67ff824

File tree

4 files changed

+216
-178
lines changed

4 files changed

+216
-178
lines changed

CHANGELOG.md

+27-27
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,21 @@ Non-backwards compatible changes
112112
always true and cannot be assumed in user's code.
113113

114114
* Therefore the definitions have been changed as follows to make all their arguments explicit:
115-
- `LeftCancellative __`
116-
- From: `∀ x {y z} → (x y) ≈ (x z) → y ≈ z`
117-
- To: `∀ x y z → (x y) ≈ (x z) → y ≈ z`
115+
- `LeftCancellative __`
116+
- From: `∀ x {y z} → (x y) ≈ (x z) → y ≈ z`
117+
- To: `∀ x y z → (x y) ≈ (x z) → y ≈ z`
118118

119-
- `RightCancellative __`
120-
- From: `∀ {x} y z → (y x) ≈ (z x) → y ≈ z`
121-
- To: `∀ x y z → (y x) ≈ (z x) → y ≈ z`
119+
- `RightCancellative __`
120+
- From: `∀ {x} y z → (y x) ≈ (z x) → y ≈ z`
121+
- To: `∀ x y z → (y x) ≈ (z x) → y ≈ z`
122122

123-
- `AlmostLeftCancellative e __`
124-
- From: `∀ {x} y z → ¬ x ≈ e → (x y) ≈ (x z) → y ≈ z`
125-
- To: `∀ x y z → ¬ x ≈ e → (x y) ≈ (x z) → y ≈ z`
123+
- `AlmostLeftCancellative e __`
124+
- From: `∀ {x} y z → ¬ x ≈ e → (x y) ≈ (x z) → y ≈ z`
125+
- To: `∀ x y z → ¬ x ≈ e → (x y) ≈ (x z) → y ≈ z`
126126

127-
- `AlmostRightCancellative e __`
128-
- From: `∀ {x} y z → ¬ x ≈ e → (y x) ≈ (z x) → y ≈ z`
129-
- To: `∀ x y z → ¬ x ≈ e → (y x) ≈ (z x) → y ≈ z`
127+
- `AlmostRightCancellative e __`
128+
- From: `∀ {x} y z → ¬ x ≈ e → (y x) ≈ (z x) → y ≈ z`
129+
- To: `∀ x y z → ¬ x ≈ e → (y x) ≈ (z x) → y ≈ z`
130130

131131
* Correspondingly some proofs of the above types will need additional arguments passed explicitly.
132132
Instances can easily be fixed by adding additional underscores, e.g.
@@ -2152,16 +2152,16 @@ Additions to existing modules
21522152

21532153
* Added new proofs to `Algebra.Consequences.Propositional`:
21542154
```agda
2155-
comm+assoc⇒middleFour : Commutative __ → Associative __ → __ MiddleFourExchange __
2156-
identity+middleFour⇒assoc : Identity e __ → __ MiddleFourExchange __ → Associative __
2157-
identity+middleFour⇒comm : Identity e _+_ → __ MiddleFourExchange _+_ → Commutative __
2155+
comm+assoc⇒middleFour : Commutative __ → Associative __ → __ MiddleFourExchange __
2156+
identity+middleFour⇒assoc : Identity e __ → __ MiddleFourExchange __ → Associative __
2157+
identity+middleFour⇒comm : Identity e _+_ → __ MiddleFourExchange _+_ → Commutative __
21582158
```
21592159

21602160
* Added new proofs to `Algebra.Consequences.Setoid`:
21612161
```agda
2162-
comm+assoc⇒middleFour : Congruent₂ __ → Commutative __ → Associative __ → __ MiddleFourExchange __
2163-
identity+middleFour⇒assoc : Congruent₂ __ → Identity e __ → __ MiddleFourExchange __ → Associative __
2164-
identity+middleFour⇒comm : Congruent₂ __ → Identity e _+_ → __ MiddleFourExchange _+_ → Commutative __
2162+
comm+assoc⇒middleFour : Congruent₂ __ → Commutative __ → Associative __ → __ MiddleFourExchange __
2163+
identity+middleFour⇒assoc : Congruent₂ __ → Identity e __ → __ MiddleFourExchange __ → Associative __
2164+
identity+middleFour⇒comm : Congruent₂ __ → Identity e _+_ → __ MiddleFourExchange _+_ → Commutative __
21652165
21662166
involutive⇒surjective : Involutive f → Surjective f
21672167
selfInverse⇒involutive : SelfInverse f → Involutive f
@@ -2171,15 +2171,15 @@ Additions to existing modules
21712171
selfInverse⇒injective : SelfInverse f → Injective f
21722172
selfInverse⇒bijective : SelfInverse f → Bijective f
21732173
2174-
comm+idˡ⇒id : Commutative __ → LeftIdentity e __ → Identity e __
2175-
comm+idʳ⇒id : Commutative __ → RightIdentity e __ → Identity e __
2176-
comm+zeˡ⇒ze : Commutative __ → LeftZero e __ → Zero e __
2177-
comm+zeʳ⇒ze : Commutative __ → RightZero e __ → Zero e __
2178-
comm+invˡ⇒inv : Commutative __ → LeftInverse e _⁻¹ __ → Inverse e _⁻¹ __
2179-
comm+invʳ⇒inv : Commutative __ → RightInverse e _⁻¹ __ → Inverse e _⁻¹ __
2180-
comm+distrˡ⇒distr : Commutative __ → __ DistributesOverˡ _◦_ → __ DistributesOver _◦_
2181-
comm+distrʳ⇒distr : Commutative __ → __ DistributesOverʳ _◦_ → __ DistributesOver _◦_
2182-
distrib+absorbs⇒distribˡ : Associative __ → Commutative _◦_ → __ Absorbs _◦_ → _◦_ Absorbs __ → _◦_ DistributesOver __ → __ DistributesOverˡ _◦_
2174+
comm+idˡ⇒id : Commutative __ → LeftIdentity e __ → Identity e __
2175+
comm+idʳ⇒id : Commutative __ → RightIdentity e __ → Identity e __
2176+
comm+zeˡ⇒ze : Commutative __ → LeftZero e __ → Zero e __
2177+
comm+zeʳ⇒ze : Commutative __ → RightZero e __ → Zero e __
2178+
comm+invˡ⇒inv : Commutative __ → LeftInverse e _⁻¹ __ → Inverse e _⁻¹ __
2179+
comm+invʳ⇒inv : Commutative __ → RightInverse e _⁻¹ __ → Inverse e _⁻¹ __
2180+
comm+distrˡ⇒distr : Commutative __ → __ DistributesOverˡ _◦_ → __ DistributesOver _◦_
2181+
comm+distrʳ⇒distr : Commutative __ → __ DistributesOverʳ _◦_ → __ DistributesOver _◦_
2182+
distrib+absorbs⇒distribˡ : Associative __ → Commutative _◦_ → __ Absorbs _◦_ → _◦_ Absorbs __ → _◦_ DistributesOver __ → __ DistributesOverˡ _◦_
21832183
```
21842184

21852185
* Added new functions to `Algebra.Construct.DirectProduct`:

notes/style-guide.md

+41-3
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,12 @@ line of code, indented by two spaces.
347347

348348
#### Variables
349349

350-
* `Level` and `Set`s can always be generalized using the keyword `variable`.
350+
* `Level` and `Set`s can always be generalised using the keyword `variable`.
351351

352352
* A file may only declare variables of other types if those types are used
353353
in the definition of the main type that the file concerns itself with.
354-
At the moment the policy is *not* to generalize over any other types to
355-
minimize the amount of information that users have to keep in their head
354+
At the moment the policy is *not* to generalise over any other types to
355+
minimise the amount of information that users have to keep in their head
356356
concurrently.
357357

358358
* Example 1: the main type in `Data.List.Properties` is `List A` where `A : Set a`.
@@ -443,6 +443,44 @@ word within a compound word is capitalized except for the first word.
443443
relations should be used over the `¬` symbol (e.g. `m+n≮n` should be
444444
used instead of `¬m+n<n`).
445445

446+
#### Symbols for operators and relations
447+
448+
* The stdlib aims to use a consistent set of notations, governed by a
449+
consistent set of conventions, but sometimes, different
450+
Unicode/emacs-input-method symbols nevertheless can be rendered by
451+
identical-*seeming* symbols, so this is an attempt to document these.
452+
453+
* The typical binary operator in the `Algebra` hierarchy, inheriting
454+
from the root `Structure`/`Bundle` `isMagma`/`Magma`, is written as
455+
infix ``, obtained as `\.`, NOT as `\bu2`. Nevertheless, there is
456+
also a 'generic' operator, written as infix `·`, obtained as
457+
`\cdot`. Do NOT attempt to use related, but typographically
458+
indistinguishable, symbols.
459+
460+
* Similarly, 'primed' names and symbols, used to standardise names
461+
apart, or to provide (more) simply-typed versions of
462+
dependently-typed operations, should be written using `\'`, NOT the
463+
unmarked `'` character.
464+
465+
* Likewise, standard infix symbols for eg, divisibility on numeric
466+
datatypes/algebraic structure, should be written `\|`, NOT the
467+
unmarked `|` character. An exception to this is the *strict*
468+
ordering relation, written using `<`, NOT `\<` as might be expected.
469+
470+
* Since v2.0, the `Algebra` hierarchy systematically introduces
471+
consistent symbolic notation for the negated versions of the usual
472+
binary predicates for equality, ordering etc. These are obtained
473+
from the corresponding input sequence by adding `n` to the symbol
474+
name, so that ``, obtained as `\le`, becomes `` obtained as
475+
`\len`, etc.
476+
477+
* Correspondingly, the flipped symbols (and their negations) for the
478+
converse relations are systematically introduced, eg `` as `\ge`
479+
and `` as `\gen`.
480+
481+
* Any exceptions to these conventions should be flagged on the GitHub
482+
`agda-stdlib` issue tracker in the usual way.
483+
446484
#### Functions and relations over specific datatypes
447485

448486
* When defining a new relation `P` over a datatype `X` in a `Data.X.Relation` module,

src/Algebra/Consequences/Propositional.agda

+27-27
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ open Base public
4444
------------------------------------------------------------------------
4545
-- Group-like structures
4646

47-
module _ {__ _⁻¹ ε} where
47+
module _ {__ _⁻¹ ε} where
4848

49-
assoc+id+invʳ⇒invˡ-unique : Associative __ Identity ε __
50-
RightInverse ε _⁻¹ __
51-
x y (x y) ≡ ε x ≡ (y ⁻¹)
49+
assoc+id+invʳ⇒invˡ-unique : Associative __ Identity ε __
50+
RightInverse ε _⁻¹ __
51+
x y (x y) ≡ ε x ≡ (y ⁻¹)
5252
assoc+id+invʳ⇒invˡ-unique = Base.assoc+id+invʳ⇒invˡ-unique (cong₂ _)
5353

54-
assoc+id+invˡ⇒invʳ-unique : Associative __ Identity ε __
55-
LeftInverse ε _⁻¹ __
56-
x y (x y) ≡ ε y ≡ (x ⁻¹)
54+
assoc+id+invˡ⇒invʳ-unique : Associative __ Identity ε __
55+
LeftInverse ε _⁻¹ __
56+
x y (x y) ≡ ε y ≡ (x ⁻¹)
5757
assoc+id+invˡ⇒invʳ-unique = Base.assoc+id+invˡ⇒invʳ-unique (cong₂ _)
5858

5959
------------------------------------------------------------------------
@@ -76,43 +76,43 @@ module _ {_+_ _*_ -_ 0#} where
7676
------------------------------------------------------------------------
7777
-- Bisemigroup-like structures
7878

79-
module _ {__ _◦_ : Op₂ A} (-comm : Commutative __) where
79+
module _ {__ _◦_ : Op₂ A} (-comm : Commutative __) where
8080

81-
comm+distrˡ⇒distrʳ : __ DistributesOverˡ _◦_ __ DistributesOverʳ _◦_
82-
comm+distrˡ⇒distrʳ = Base.comm+distrˡ⇒distrʳ (cong₂ _) -comm
81+
comm+distrˡ⇒distrʳ : __ DistributesOverˡ _◦_ __ DistributesOverʳ _◦_
82+
comm+distrˡ⇒distrʳ = Base.comm+distrˡ⇒distrʳ (cong₂ _) -comm
8383

84-
comm+distrʳ⇒distrˡ : __ DistributesOverʳ _◦_ __ DistributesOverˡ _◦_
85-
comm+distrʳ⇒distrˡ = Base.comm+distrʳ⇒distrˡ (cong₂ _) -comm
84+
comm+distrʳ⇒distrˡ : __ DistributesOverʳ _◦_ __ DistributesOverˡ _◦_
85+
comm+distrʳ⇒distrˡ = Base.comm+distrʳ⇒distrˡ (cong₂ _) -comm
8686

87-
comm⇒sym[distribˡ] : x Symmetric (λ y z (x ◦ (y z)) ≡ ((x ◦ y) (x ◦ z)))
88-
comm⇒sym[distribˡ] = Base.comm⇒sym[distribˡ] (cong₂ _◦_) -comm
87+
comm⇒sym[distribˡ] : x Symmetric (λ y z (x ◦ (y z)) ≡ ((x ◦ y) (x ◦ z)))
88+
comm⇒sym[distribˡ] = Base.comm⇒sym[distribˡ] (cong₂ _◦_) -comm
8989

9090
------------------------------------------------------------------------
9191
-- Selectivity
9292

93-
module _ {__ : Op₂ A} where
93+
module _ {__ : Op₂ A} where
9494

95-
sel⇒idem : Selective __ Idempotent __
95+
sel⇒idem : Selective __ Idempotent __
9696
sel⇒idem = Base.sel⇒idem _≡_
9797

9898
------------------------------------------------------------------------
9999
-- Middle-Four Exchange
100100

101-
module _ {__ : Op₂ A} where
101+
module _ {__ : Op₂ A} where
102102

103-
comm+assoc⇒middleFour : Commutative __ Associative __
104-
__ MiddleFourExchange __
105-
comm+assoc⇒middleFour = Base.comm+assoc⇒middleFour (cong₂ __)
103+
comm+assoc⇒middleFour : Commutative __ Associative __
104+
__ MiddleFourExchange __
105+
comm+assoc⇒middleFour = Base.comm+assoc⇒middleFour (cong₂ __)
106106

107-
identity+middleFour⇒assoc : {e : A} Identity e __
108-
__ MiddleFourExchange __
109-
Associative __
110-
identity+middleFour⇒assoc = Base.identity+middleFour⇒assoc (cong₂ __)
107+
identity+middleFour⇒assoc : {e : A} Identity e __
108+
__ MiddleFourExchange __
109+
Associative __
110+
identity+middleFour⇒assoc = Base.identity+middleFour⇒assoc (cong₂ __)
111111

112112
identity+middleFour⇒comm : {_+_ : Op₂ A} {e : A} Identity e _+_
113-
__ MiddleFourExchange _+_
114-
Commutative __
115-
identity+middleFour⇒comm = Base.identity+middleFour⇒comm (cong₂ __)
113+
__ MiddleFourExchange _+_
114+
Commutative __
115+
identity+middleFour⇒comm = Base.identity+middleFour⇒comm (cong₂ __)
116116

117117
------------------------------------------------------------------------
118118
-- Without Loss of Generality

0 commit comments

Comments
 (0)