@@ -34,7 +34,7 @@ private
34
34
-- ∙ Relation.Binary
35
35
-- ∙ Relation.Binary.Indexed
36
36
--
37
- -- A given hierarchy `X` is always split into 4 seperate folders:
37
+ -- A given hierarchy `X` is always split into 4 separate folders:
38
38
-- ∙ X.Core
39
39
-- ∙ X.Definitions
40
40
-- ∙ X.Structures
@@ -66,7 +66,7 @@ private
66
66
67
67
-- The Core module contains the basic units of the hierarchy.
68
68
69
- -- For example for binary relations these are homoegeneous and
69
+ -- For example, in the case of binary relations these are homogeneous and
70
70
-- heterogeneous binary relations:
71
71
72
72
REL : Set a → Set b → (ℓ : Level) → Set (a ⊔ b ⊔ suc ℓ)
@@ -90,8 +90,7 @@ Op₂ A = A → A → A
90
90
-- The Definitions module defines the various properties that the
91
91
-- basic units of the hierarchy may have.
92
92
93
- -- For example in Relation.Binary this includes reflexivity,
94
- -- transitivity etc.
93
+ -- Examples in Relation.Binary include reflexivity, transitivity, etc.
95
94
96
95
Reflexive : Rel A ℓ → Set _
97
96
Reflexive _∼_ = ∀ {x} → x ∼ x
@@ -105,7 +104,7 @@ Transitive _∼_ = ∀ {x y z} → x ∼ y → y ∼ z → x ∼ z
105
104
Total : Rel A ℓ → Set _
106
105
Total _∼_ = ∀ x y → x ∼ y ⊎ y ∼ x
107
106
108
- -- For example in Algebra these are associativity, commutativity.
107
+ -- Examples in Algebra include associativity, commutativity.
109
108
-- Note that all definitions for Algebra are based on some notion of
110
109
-- underlying equality.
111
110
@@ -124,17 +123,16 @@ RightIdentity _≈_ e _∙_ = ∀ x → (x ∙ e) ≈ x
124
123
-- Note that the types in `Definitions` modules are not meant to express
125
124
-- the full concept on their own. For example the `Associative` type does
126
125
-- not require the underlying relation to be an equivalence relation.
127
- -- Instead they are designed to aid the modular reuse of the core
128
- -- concepts. The complete concepts are captured in various
129
- -- structures/bundles where the definitions are correctly used in
130
- -- context.
126
+ -- Instead they are designed to aid modular reuse of the core concepts.
127
+ -- The complete concepts are captured in various structures/bundles
128
+ -- where the definitions are correctly used in context.
131
129
132
130
133
131
------------------------------------------------------------------------
134
132
-- X.Structures
135
133
136
134
-- When an abstract hierarchy of some sort (for instance semigroup →
137
- -- monoid → group) is included in the library the basic approach is to
135
+ -- monoid → group) is included in the library, the basic approach is to
138
136
-- specify the properties of every concept in terms of a record
139
137
-- containing just properties, parameterised on the underlying
140
138
-- sets, relations and operations. For example:
@@ -148,8 +146,7 @@ record IsEquivalence {A : Set a}
148
146
sym : Symmetric _≈_
149
147
trans : Transitive _≈_
150
148
151
- -- More specific concepts are then specified in terms of the simpler
152
- -- ones:
149
+ -- More specific concepts are then specified in terms of simpler ones:
153
150
154
151
record IsMagma {A : Set a} (≈ : Rel A ℓ) (∙ : Op₂ A) : Set (a ⊔ ℓ) where
155
152
field
@@ -167,6 +164,7 @@ record IsSemigroup {A : Set a} (≈ : Rel A ℓ) (∙ : Op₂ A) : Set (a ⊔
167
164
-- fields of the `isMagma` record can be accessed directly; this
168
165
-- technique enables the user of an `IsSemigroup` record to use underlying
169
166
-- records without having to manually open an entire record hierarchy.
167
+ --
170
168
-- This is not always possible, though. Consider the following definition
171
169
-- of preorders:
172
170
@@ -236,17 +234,22 @@ record Semigroup : Set (suc (a ⊔ ℓ)) where
236
234
magma : Magma a ℓ
237
235
magma = record { isMagma = isMagma }
238
236
239
- -- Note that the Semigroup record does not include a Magma field.
240
- -- Instead the Semigroup record includes a "repackaging function"
241
- -- semigroup which converts a Magma to a Semigroup.
237
+ -- Note that the `Semigroup` record does not include a (primitive;
238
+ -- definitional) `Magma` field, by contrast with the `IsSemigroup`
239
+ -- structure which *does* include an `isMagma` field as primitive.
240
+ -- Instead, the `Semigroup` record includes an additional declaration
241
+ -- (a 'manifest field' of the `record`) defining a `Magma` bundle, in
242
+ -- terms of that exported `isMagma` field. In this way, 'inheritance'
243
+ -- is *automatic* for the `IsX` sub*structures* of a given bundle,
244
+ -- while supporting the *optional* export of inherited sub*bundles*.
242
245
243
246
-- The above setup may seem a bit complicated, but it has been arrived
244
247
-- at after a lot of thought and is designed to both make the hierarchies
245
248
-- easy to work with whilst also providing enough flexibility for the
246
249
-- different applications of their concepts.
247
250
248
251
-- NOTE: bundles for the function hierarchy are designed a little
249
- -- differently, as a function with an unknown domain an codomain is
252
+ -- differently, as a function with an unknown domain and codomain is
250
253
-- of little use.
251
254
252
255
-------------------------
@@ -257,7 +260,7 @@ record Semigroup : Set (suc (a ⊔ ℓ)) where
257
260
-- sub-bundles can get a little tricky.
258
261
259
262
-- Imagine we have the following general scenario where bundle A is a
260
- -- direct refinement of bundle C (i.e. the record `IsA` has a `IsC` field)
263
+ -- direct refinement of bundle C (i.e. the record `IsA` has an `IsC` field)
261
264
-- but is also morally a refinement of bundles B and D.
262
265
263
266
-- Structures Bundles
@@ -284,7 +287,7 @@ record Semigroup : Set (suc (a ⊔ ℓ)) where
284
287
-- 6. Construct `d : D` via the `isC` obtained in step 1.
285
288
286
289
-- 7. `open D d public using (P)` where `P` is everything exported
287
- -- by `D` but not exported by `IsA`
290
+ -- by `D` but not exported by `IsA`.
288
291
289
292
------------------------------------------------------------------------
290
293
-- Other hierarchy modules
@@ -336,7 +339,7 @@ idˡ∧comm⇒idʳ = {!!}
336
339
-- X.Construct
337
340
338
341
-- The "construct" folder contains various generic ways of constructing
339
- -- new instances of the hierarchy. For example
342
+ -- new instances of the hierarchy. For example,
340
343
341
344
import Relation.Binary.Construct.Intersection
342
345
@@ -346,21 +349,21 @@ import Relation.Binary.Construct.Intersection
346
349
347
350
-- These files are layed out in four parts, mimicking the main modules
348
351
-- of the hierarchy itself. First they define the new relation, then
349
- -- subsequently how the definitions, then structures and finally
352
+ -- subsequently the definitions, then structures and finally
350
353
-- bundles can be translated across to it.
351
354
352
355
------------------------------------------------------------------------
353
356
-- X.Morphisms
354
357
355
358
-- The `Morphisms` folder is a sub-hierarchy containing relationships
356
- -- such homomorphisms, monomorphisms and isomorphisms between the
359
+ -- such as homomorphisms, monomorphisms and isomorphisms between the
357
360
-- structures and bundles in the hierarchy.
358
361
359
362
------------------------------------------------------------------------
360
363
-- X.Properties
361
364
362
365
-- The `Properties` folder contains additional proofs about the theory
363
- -- of each bundle. They are usually designed so as a bundle's
366
+ -- of each bundle. They are usually designed so that a bundle's
364
367
-- `Properties` file re-exports the contents of the `Properties` files
365
368
-- above it in the hierarchy. For example
366
369
-- `Algebra.Properties.AbelianGroup` re-exports the contents of
0 commit comments