@@ -34,7 +34,7 @@ private
3434-- ∙ Relation.Binary
3535-- ∙ Relation.Binary.Indexed
3636--
37- -- A given hierarchy `X` is always split into 4 seperate folders:
37+ -- A given hierarchy `X` is always split into 4 separate folders:
3838-- ∙ X.Core
3939-- ∙ X.Definitions
4040-- ∙ X.Structures
@@ -66,7 +66,7 @@ private
6666
6767-- The Core module contains the basic units of the hierarchy.
6868
69- -- For example for binary relations these are homoegeneous and
69+ -- For example, in the case of binary relations these are homogeneous and
7070-- heterogeneous binary relations:
7171
7272REL : Set a → Set b → (ℓ : Level) → Set (a ⊔ b ⊔ suc ℓ)
@@ -90,8 +90,7 @@ Op₂ A = A → A → A
9090-- The Definitions module defines the various properties that the
9191-- basic units of the hierarchy may have.
9292
93- -- For example in Relation.Binary this includes reflexivity,
94- -- transitivity etc.
93+ -- Examples in Relation.Binary include reflexivity, transitivity, etc.
9594
9695Reflexive : Rel A ℓ → Set _
9796Reflexive _∼_ = ∀ {x} → x ∼ x
@@ -105,7 +104,7 @@ Transitive _∼_ = ∀ {x y z} → x ∼ y → y ∼ z → x ∼ z
105104Total : Rel A ℓ → Set _
106105Total _∼_ = ∀ x y → x ∼ y ⊎ y ∼ x
107106
108- -- For example in Algebra these are associativity, commutativity.
107+ -- Examples in Algebra include associativity, commutativity.
109108-- Note that all definitions for Algebra are based on some notion of
110109-- underlying equality.
111110
@@ -124,17 +123,16 @@ RightIdentity _≈_ e _∙_ = ∀ x → (x ∙ e) ≈ x
124123-- Note that the types in `Definitions` modules are not meant to express
125124-- the full concept on their own. For example the `Associative` type does
126125-- 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.
131129
132130
133131------------------------------------------------------------------------
134132-- X.Structures
135133
136134-- 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
138136-- specify the properties of every concept in terms of a record
139137-- containing just properties, parameterised on the underlying
140138-- sets, relations and operations. For example:
@@ -148,8 +146,7 @@ record IsEquivalence {A : Set a}
148146 sym : Symmetric _≈_
149147 trans : Transitive _≈_
150148
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:
153150
154151record IsMagma {A : Set a} (≈ : Rel A ℓ) (∙ : Op₂ A) : Set (a ⊔ ℓ) where
155152 field
@@ -167,6 +164,7 @@ record IsSemigroup {A : Set a} (≈ : Rel A ℓ) (∙ : Op₂ A) : Set (a ⊔
167164-- fields of the `isMagma` record can be accessed directly; this
168165-- technique enables the user of an `IsSemigroup` record to use underlying
169166-- records without having to manually open an entire record hierarchy.
167+ --
170168-- This is not always possible, though. Consider the following definition
171169-- of preorders:
172170
@@ -236,17 +234,22 @@ record Semigroup : Set (suc (a ⊔ ℓ)) where
236234 magma : Magma a ℓ
237235 magma = record { isMagma = isMagma }
238236
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*.
242245
243246-- The above setup may seem a bit complicated, but it has been arrived
244247-- at after a lot of thought and is designed to both make the hierarchies
245248-- easy to work with whilst also providing enough flexibility for the
246249-- different applications of their concepts.
247250
248251-- 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
250253-- of little use.
251254
252255-------------------------
@@ -257,7 +260,7 @@ record Semigroup : Set (suc (a ⊔ ℓ)) where
257260-- sub-bundles can get a little tricky.
258261
259262-- 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)
261264-- but is also morally a refinement of bundles B and D.
262265
263266-- Structures Bundles
@@ -284,7 +287,7 @@ record Semigroup : Set (suc (a ⊔ ℓ)) where
284287-- 6. Construct `d : D` via the `isC` obtained in step 1.
285288
286289-- 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`.
288291
289292------------------------------------------------------------------------
290293-- Other hierarchy modules
@@ -336,7 +339,7 @@ idˡ∧comm⇒idʳ = {!!}
336339-- X.Construct
337340
338341-- 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,
340343
341344import Relation.Binary.Construct.Intersection
342345
@@ -346,21 +349,21 @@ import Relation.Binary.Construct.Intersection
346349
347350-- These files are layed out in four parts, mimicking the main modules
348351-- 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
350353-- bundles can be translated across to it.
351354
352355------------------------------------------------------------------------
353356-- X.Morphisms
354357
355358-- 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
357360-- structures and bundles in the hierarchy.
358361
359362------------------------------------------------------------------------
360363-- X.Properties
361364
362365-- 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
364367-- `Properties` file re-exports the contents of the `Properties` files
365368-- above it in the hierarchy. For example
366369-- `Algebra.Properties.AbelianGroup` re-exports the contents of
0 commit comments