Skip to content

Commit 4d72ed0

Browse files
committed
comment: extensively on NormalSubgroup (sic)
1 parent 3a75f5f commit 4d72ed0

File tree

2 files changed

+78
-22
lines changed

2 files changed

+78
-22
lines changed

src/Algebra/Construct/Sub/Group.agda

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,51 +36,52 @@ private
3636
record Subgroup c′ ℓ′ : Set (c ⊔ ℓ ⊔ suc (c′ ⊔ ℓ′)) where
3737
field
3838

39-
-- as above, this name is essentially arbitrary,
40-
-- exisitng solely to be mentioned in the third field below
39+
-- As above, the following name is essentially arbitrary, existing
40+
-- solely to be mentioned in the third field `ι-monomorphism` below.
4141

4242
domain : RawGroup c′ ℓ′
4343

44-
-- this function (obviously) needs a source and target:
45-
-- * the target, for the sake of the third field, needs to be
46-
-- `Carrier` subfield of the top-level `X` module parameter
44+
-- The next field, a function, (obviously) needs a source and target:
45+
-- * the target, again for the sake of the third field, needs to be
46+
-- `Carrier` subfield of the top-level `X` module parameter;
4747
-- * the source, however, really exists solely to give a type to `ι`
48-
-- and indeed, the typechecker can infer (from the third field)
49-
-- that this type *must* be the `Carrier` of the `RawX` `domain`
48+
-- and indeed, the typechecker can infer (again from the third field)
49+
-- that this type *must* be the `Carrier` of the `RawX` `domain`.
5050

5151
-- Taneb's design introduces a `private` module
5252
-- `private module H = RawGroup domain`
5353
-- for the sake of affording easy/easier named access to its
5454
-- `Carrier` field, and as preferable to the hideous explicit form
55-
-- `RawGroup.Carrier domain` which is the definiens of `H.Carrier`
55+
-- `RawGroup.Carrier domain` which is the definiens of `H.Carrier`.
5656

57-
-- Neither is necessary, but can be, and is, reconstructed by the
58-
-- typechecker by offering instead a placeholder, in exactly the same way
57+
-- Neither is necessary, but instead can be, and is here, reconstructed by
58+
-- the typechecker by offering instead a placeholder, in exactly the same way
5959
-- that `domain` exists as a named field solely to express the dependency
6060
-- in the type of `ι-monomorphism`. In that sense, it is an ephemeral form
61-
-- derived from `domain`, which moreover will never play a role in client
62-
-- uses of this module, except as a typing constraint on any application
63-
-- of `ι`, a constraint which is already inherited (by definitional equality!)
64-
-- from the type of the `⟦_⟧` parameter to `IsXHomomorphism`...
61+
-- derived from `domain`, which moreover will *never* play a role in client
62+
-- uses of this module (eg exemplarily in `Algebra.Construct.Sub.Group.Normal),
63+
-- except as a typing constraint on any application of `ι`, a constraint
64+
-- which is already inherited (by definitional equality!) from the type of
65+
-- the `⟦_⟧` parameter to `IsXHomomorphism`...
6566

6667
ι : _ G.Carrier -- where _ = RawGroup.Carrier domain
6768

68-
-- now all the pieces are in place, we can define what we *really* want
69+
-- Now all the pieces are in place, we can define what we *really* want:
6970

7071
ι-monomorphism : IsGroupMonomorphism domain G.rawGroup ι
7172

72-
-- this is 'admin': any client module of `Subgroup` will likely want to
73-
-- refer to primitive *and* manifest subfields of `IsXMonmorphism`, so
74-
-- this is automatically made available to clients, but not `open`ed,
75-
-- so that such affordance is client-definable, as usual.
73+
-- The next manifest field is an 'admin' decision: any client module of
74+
-- `Subgroup` will likely want to refer to primitive *and* manifest subfields
75+
-- of `IsXMonomorphism`, so this is automatically made available to clients,
76+
-- but not `open`ed, so that such affordance is client-definable, as usual.
7677

7778
module ι = IsGroupMonomorphism ι-monomorphism
7879

7980
-- Similarly, but mathematically motivated: any client module of `Subgroup`
8081
-- will want access to *the `X` defined as the domain of the `IsXMonomorphism`*.
8182
-- But here, it is both automatically made available to clients, as above,
8283
-- *and* also `open`ed, so that its affordances are offered to any client
83-
-- via the 'canonical' names associated with the `X`/`IsX` bundle/structure
84+
-- via the 'canonical' names associated with the `X`/`IsX` bundle/structure.
8485

8586
-- Taneb's design does this in two steps:
8687
-- * first, create the `IsX` structure, with name `isX`

src/Algebra/Construct/Sub/Group/Normal.agda

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,86 @@
22
-- The Agda standard library
33
--
44
-- Definition of normal subgroups
5+
--
6+
-- Based on Nathan van Doorn (Taneb)'s original PR
7+
-- https://github.com/agda/agda-stdlib/pull/2852
58
------------------------------------------------------------------------
69

710
{-# OPTIONS --safe --cubical-compatible #-}
811

912
open import Algebra.Bundles using (Group)
1013

14+
-- This module relocates Taneb's original `Algebra.NormalSubgroup`
15+
-- to a level one *below* that of `Algebra.Construct.Sub.Group`,
16+
-- for the 'obvious' inheritance hierarchy 'reason' that a
17+
-- `NormalSubgroup` is a specialisation of the notion of `Subgroup`.
18+
19+
-- `Normal` as a root name avoids recapitulation of the parent name
20+
-- `Subgroup`, but also permits/does not frustrate development of a
21+
-- companion `Construct` sub-hierarchy (intersections etc.) below
22+
-- `Algebra/Construct/Sub/Group/Normal` as a sub-directory.
23+
1124
module Algebra.Construct.Sub.Group.Normal {c ℓ} (G : Group c ℓ) where
1225

1326
open import Algebra.Construct.Sub.Group G using (Subgroup)
27+
open import Function.Base using (typeOf)
1428
open import Level using (suc; _⊔_)
1529

1630
private
1731
module G = Group G
1832

19-
-- every element of the subgroup commutes in G
33+
------------------------------------------------------------------------
34+
-- Definition
35+
--
36+
-- IsNormal: every element of the given subgroup commutes in the parent.
37+
--
38+
-- This defined as a `record`, as usual in order to improve type inference,
39+
-- specifically that a `NormalSubgroup` below may (usually) be definable
40+
-- solely by supplying its `isNormal` field.
41+
2042
record IsNormal {c′ ℓ′} (subgroup : Subgroup c′ ℓ′) : Set (c ⊔ ℓ ⊔ c′) where
43+
44+
-- A design question here is how much of the `Subgroup` structure should/must
45+
-- be exposed in the course of defining the fields here.
46+
47+
-- Surely we need the name of the function which witnesses 'subX'-ness,
48+
-- but not the property `ι-isXMonomorphism`.
49+
2150
open Subgroup subgroup using (ι)
51+
2252
field
23-
conjugate : n g _
53+
54+
-- But it's not obvious that we need the (name of) `Carrier` of the `domain`
55+
-- of the `Subgroup`, viz. the source of `ι`, except as the type of variables
56+
-- quantifed here as `n` (as generic name for 'element's of the normal subgroup).
57+
58+
-- As with `Subgroup` itself, this domain `Carrier` type is canonically inferrable
59+
-- by the typechecker, as in the inline comment. But perhaps this use of `_` might
60+
-- also be usefully documented as `Function.Base.typeOf n`?
61+
62+
conjugate : n g _ -- where _ = RawGroup.Carrier (Subgroup.domain subgroup)
63+
64+
-- The main field of interest only requires that the `conjugate` field be
65+
-- of type 'source of `ι`'; but we don't need that type here, otherwise the
66+
-- `∀ n` quantifier would need an explicit type label, and such inferrability
67+
-- reinforces the decision nowhere to name this type.
68+
2469
normal : n g ι (conjugate n g) G.∙ g G.≈ g G.∙ ι n
2570

71+
-- NormalSubgroup: a Subgroup which IsNormal (sic)
72+
2673
record NormalSubgroup c′ ℓ′ : Set (c ⊔ ℓ ⊔ suc (c′ ⊔ ℓ′)) where
2774
field
2875
subgroup : Subgroup c′ ℓ′
2976
isNormal : IsNormal subgroup
3077

78+
-- But again, and for generic `library-design` reasons, we publicaly export
79+
-- all the subfields of each field, in order to afford a standardised vocabulary
80+
-- for all the structure intended to be in scope when using a `NormalSubgroup`.
81+
82+
-- Locally, we have used only name `ι` in the definition of `IsNormal`,
83+
-- but clients may also want access ot the full signature (eg. esp. the
84+
-- `ι-isGroupMonomorphism` field which characterises being a subgroup).
85+
3186
open Subgroup subgroup public
3287
open IsNormal isNormal public

0 commit comments

Comments
 (0)