Looking again at README.Design.Hierarchies, Algebra.{Module.}Structures and Algebra.{Module.}Bundles.Raw, I can't help wondering at the mismatch in indices vs. fieldnames to the various IsXs, with the correspondingRawX (although this may simply be an artefact of parametrisation of the Algebra.Structures module), but my main question is:
- why are the
IsX records not indexed over a single underlying RawX parameter? (this may be historical...)
- should they be? (ie. should we at least reconsider revisiting this design...) (UPDATED: see below)
Apologies if my ignorance of the history of, and discussion on, the associated issues/PRs obscures what otherwise may be glaringly obvious to those more expert than me!
E.g., to define IsMagmaR in this style, and show it gives rise to a 'usual' IsMagma (and Magma! because the existing hierarchy permits this... so a genuine replacement, rather than enhancement, of the existing hierarchy would still require IsX and X to be separated; but here the existing concrete Raw bundles in eg Data.Nat could be generated using this extension instead...) instance etc.:
open import Algebra.Bundles
open import Algebra.Bundles.Raw
import Algebra.Definitions as Definitions
import Algebra.Structures as Structures
open import Level using (Level; _⊔_)
open import Relation.Binary.Structures using (IsEquivalence)
module Algebra.Structures.RawIndexed where
private
variable
c ℓ : Level
record IsMagmaR (raw : RawMagma c ℓ) : Set (c ⊔ ℓ) where
open RawMagma raw
open Definitions _≈_
field
isEquivalence : IsEquivalence _≈_
∙-cong : Congruent₂ _∙_
isMagma : Structures.IsMagma _≈_ _∙_
isMagma = record { isEquivalence = isEquivalence ; ∙-cong = ∙-cong }
magma : Magma c ℓ
magma = record { isMagma = isMagma }
Is it because to define any instance of a hypothetical IsMagmaR rawMagma one first has to (already have) open RawMagma rawMagma to be able to define the fields? Is this such a high price to pay?
The above may be a con, but pro might be not having to redefine in RawX the manifest operation fields defined in IsX... cf. #2251
Moreover, redefining the bundle X takes on the satisfyingly generic X = Σ RawX IsX form:
open import Algebra.Bundles.Raw
open import Algebra.Structures.RawIndexed
open import Level using (Level; suc; _⊔_)
module Algebra.Bundles.RawIndexed where
private
variable
c ℓ : Level
record MagmaR c ℓ : Set (suc (c ⊔ ℓ)) where
field
rawMagma : RawMagma c ℓ
isMagmaR : IsMagmaR rawMagma
Looking again at
README.Design.Hierarchies,Algebra.{Module.}StructuresandAlgebra.{Module.}Bundles.Raw, I can't help wondering at the mismatch in indices vs. fieldnames to the variousIsXs, with the correspondingRawX(although this may simply be an artefact of parametrisation of theAlgebra.Structuresmodule), but my main question is:IsXrecords not indexed over a single underlyingRawXparameter? (this may be historical...)Apologies if my ignorance of the history of, and discussion on, the associated issues/PRs obscures what otherwise may be glaringly obvious to those more expert than me!
E.g., to define
IsMagmaRin this style, and show it gives rise to a 'usual'IsMagma(andMagma! because the existing hierarchy permits this... so a genuine replacement, rather than enhancement, of the existing hierarchy would still requireIsXandXto be separated; but here the existing concreteRawbundles in egData.Natcould be generated using this extension instead...) instance etc.:Is it because to define any instance of a hypothetical
IsMagmaR rawMagmaone first has to (already have)open RawMagma rawMagmato be able to define the fields? Is this such a high price to pay?The above may be a con, but pro might be not having to redefine in
RawXthe manifest operation fields defined inIsX... cf. #2251Moreover, redefining the bundle
Xtakes on the satisfyingly genericX = Σ RawX IsXform: