@@ -20,6 +20,62 @@ Non-backwards compatible changes
20
20
Definitions that are sensitive to the behaviour of these lemmas, rather than
21
21
just their existence, may need to be revised.
22
22
23
+ * The following record definitions in ` Algebra.Structures ` have been changed.
24
+
25
+ - ` IsCommutativeMonoid `
26
+ - ` IsCommutativeSemiring `
27
+ - ` IsRing `
28
+
29
+ In all of these cases, the change has been to give each of these structures
30
+ access to * all* of the fields of structures below (weaker) in the hierarchy.
31
+ For example, consider ` IsCommutativeMonoid ` . The old definition effectively
32
+ required the following fields.
33
+
34
+ - Associativity
35
+ - Left identity
36
+ - Commutativity
37
+
38
+ The new definition also requires:
39
+
40
+ - Right identity.
41
+
42
+ The justification for not including a right identity proof was that, given
43
+ left identity and commutativity, right identity can be proven. However,
44
+ omitting the right identity proof caused problems:
45
+
46
+ 1 . It made the definition longer and more complex, as less code was reused.
47
+ 2 . The forgetful map turning a commutative monoid into a monoid was not a
48
+ retraction of all maps which augment a monoid with commutativity. To see
49
+ that the forgetful map was not a retraction, notice that the augmentation
50
+ must have discarded the right identity proof as there was no field for it
51
+ in ` IsCommutativeMonoid ` .
52
+ 3 . There was no easy way to give only the right identity proof, and have
53
+ the left identity proof be generically derived.
54
+
55
+ Point 2, and in particular the fact that it did not hold definitionally,
56
+ caused problems when indexing over monoids and commutative monoids and
57
+ requiring some compatibility between the two indexings.
58
+
59
+ With the new definition, we address point 3 and recover the convenience of
60
+ the old definition simultaneously. We do this by introducing * biased*
61
+ structures, found in ` Algebra.Structures.Biased ` . In particular, one can
62
+ generally convert old instances of ` IsCommutativeMonoid ` to new instances
63
+ using the ` IsCommutativeMonoidˡ ` biased structure. This is introduced by
64
+ the function ` isCommutativeMonoidˡ ` , so old instances can be converted as
65
+ follows.
66
+
67
+ ``` agda
68
+ -- Add this part: ↓----↓----↓----↓----↓
69
+ isCommutativeMonoid = isCommutativeMonoidˡ record
70
+ { isSemigroup = ... -- Everything
71
+ ; identityˡ = ... -- else is
72
+ ; comm = ... -- the same.
73
+ }
74
+ ```
75
+
76
+ For ` IsCommutativeSemiring ` , we have ` IsCommutativeSemiringˡ ` , and for
77
+ ` IsRing ` , we have ` IsRingWithoutAnnihilatingZero ` .
78
+
23
79
Other major additions
24
80
---------------------
25
81
0 commit comments