[ discussion ] alternative design for Algebra.Structures.IsX
and Algebra.Properties.X
#2762
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an alternative design for the
Structures
andProperties
hierarchies underAlgebra
, as an experiment following on from my(currently!) failedattempts to find a suitable solution to #2704 ...The main idea can be seen as:
Algebra.Structures
(which now re-exports from each of its sub-modules, now embodying the previous singlerecord
entries for eachIsX
structure, but with a slightly different grouping of 'cognate' such things;breaking
) ofAlgebra.Properties.IsX
, which can now be interleaved with those underStructures
, so that successively richer structures can inherit not just properties of their vanilla substructures, but their properties as well; cf. Add new operations (cf.RawQuasigroup
) toIsGroup
#2251 for adding new derived operations as well...Algebra.Consequences
, as the relevant structural elements would then be available sur place for proving equational properties;Properties
modules are now further able to define otherIsZ
substructural fields (eg.Properties.IsSemigroup
can now package theFlexible
andAlternative
properties into fully fledgedIsFlexibleMagma
andIsAlternatveMagma
substructures for subsequent re-export if so desired (previously, trying to do so would have led to a dependency cycle, I think; or at least, have not been considered as 'standard' admissible extensions toIsSemigroup
...)isY : IsY
substructures defined in eachAlgebra.Structures.IsX
, but eg.IsGroup
shows what was not previously possible (except viaAlgebra.Group.Properties
), namely to haveisQuasigroup
andisLoop
fields defined, and hence the possibility ofIsGroup
also inheriting/re-exporting theirProperties
;Algebra.Bundles
andAlgebra.Properties.X
for re-packaging and export of the correspondingIsX
data.It's WIP/
DRAFT
, because I stopped once I had got toIsGroup
, and with it the decision about how 'wide' to make that API...Discussion welcome!
IsX
to be as wide as possible, but currently that's only inIsGroup
; a spectrum of possible choices are availableNB Outstanding issues:
Algebra.Structures
means that_≈_
needs to be supplied explicitly a bit too often on re-export (I hope that can easily be fixed, but later...): in particular, the build fails at the moment for this reason;RawX
bundle, is neither here nor there, but this design would certainly fit well with [DRY] Reconciling the indices ofIsX
with those of the correspondingRawX
#2252 , which would moreover have the advantage that the fixities could be declared in theRawX
bundle, and hence inherited onopen
ing in theIsX
structure, which would make the subsequent statement of additional properties less painful wrt precedence/parsing than at present...Structures
, we could simply make each individualIsX
module put together both definition and properties (but that maybe goes against accepted wisdom)Related: instead of parametrising
Reasoning
modules onSetoid
, in favour ofIsEquivalence
, we could remove the anomaloussetoid
field inherited fromIsMagma
onwards precisely to facilitate manifest field definition of new equational properties cf. bootstrapping #2692 from #2688 etc.