Metamath Proof Explorer


Table of Contents - 7.1.1. Basic definitions

An "extensible structure" (or "structure" in short, at least in this section) is used to define a specific group, ring, poset, and so on. An extensible structure can contain many components. For example, a group will have at least two components (base set and operation), although it can be further specialized by adding other components such as a multiplicative operation for rings (and still remain a group per our definition). Thus, every ring is also a group. This extensible structure approach allows theorems from more general structures (such as groups) to be reused for more specialized structures (such as rings) without having to reprove anything. Structures are common in mathematics, but in informal (natural language) proofs the details are assumed in ways that we must make explicit.

An extensible structure is implemented as a function (a set of ordered pairs) on a finite (and not necessarily sequential) subset of . The function's argument is the index of a structure component (such as for the base set of a group), and its value is the component (such as the base set). By convention, we normally avoid direct reference to the hard-coded numeric index and instead use structure component extractors such as ndxid and strfv. Using extractors makes it easier to change numeric indices and also makes the components' purpose clearer. For example, as noted in ndxid, we can refer to a specific poset with base set and order relation using the extensible structure rather than . See the comment of basendx for more details on numeric indices versus the structure component extractors.

There are many other possible ways to handle structures. We chose this extensible structure approach because this approach (1) results in simpler notation than other approaches we are aware of, and (2) is easier to do proofs with. We cannot use an approach that uses "hidden" arguments; Metamath does not support hidden arguments, and in any case we want nothing hidden. It would be possible to use a categorical approach (e.g., something vaguely similar to Lean's mathlib). However, instances (the chain of proofs that an is a via a bunch of forgetful functors) can cause serious performance problems for automated tooling, and the resulting proofs would be painful to look at directly (in the case of Lean, they are long past the level where people would find it acceptable to look at them directly). Metamath is working under much stricter conditions than this, and it has still managed to achieve about the same level of flexibility through this "extensible structure" approach.

To create a substructure of a given extensible structure, you can simply use the multifunction restriction operator for extensible structures as defined in df-ress. This can be used to turn statements about rings into statements about subrings, modules into submodules, etc. This definition knows nothing about individual structures and merely truncates the set while leaving operators alone. Individual kinds of structures will need to handle this behavior by ignoring operators' values outside the range (like ), defining a function using the base set and applying that (like ), or explicitly truncating the slot before use (like ). For example, the unital ring of integers is defined in df-zring as simply . This can be similarly done for all other subsets of , which has all the structure we can show applies to it, and this all comes "for free". Should we come up with some new structure in the future that we wish to inherit, then we change the definition of , reprove all the slot extraction theorems, add a new one, and that's it. None of the other downstream theorems have to change.

Note that the construct of df-prds addresses a different situation. It is not possible to have SubGroup and SubRing be the same thing because they produce different outputs on the same input. The subgroups of an extensible structure treated as a group are not the same as the subrings of that same structure. With df-prds it can actually reasonably perform the task, that is, being the product group given a family of groups, while also being the product ring given a family of rings. There is no contradiction here because the group part of a product ring is a product group.

There is also a general theory of "substructure algebras", in the form of df-mre and df-acs. SubGroup is a Moore collection, as is SubRing, SubRng and many other substructure collections. But it is not useful for picking out a particular collection of interest; SubRing and SubGroup still need to be defined and they are distinct --- nothing is going to select these definitions for us.

Extensible structures only work well when they represent concrete categories, where there is a "base set", morphisms are functions, and subobjects are subsets with induced operations. In short, they primarily work well for "sets with (some) extra structure". Extensible structures may not suffice for more complicated situations. For example, in manifolds, would not work. That said, extensible structures are sufficient for many of the structures that set.mm currently considers, and offer a good compromise for a goal-oriented formalization.

  1. Extensible structures as structures with components
    1. cstr
    2. df-struct
    3. brstruct
    4. isstruct2
    5. structex
    6. structn0fun
    7. isstruct
    8. structcnvcnv
    9. structfung
    10. structfun
    11. structfn
    12. strleun
    13. strle1
    14. strle2
    15. strle3
    16. sbcie2s
    17. sbcie3s
  2. Substitution of components
    1. csts
    2. df-sets
    3. reldmsets
    4. setsvalg
    5. setsval
    6. fvsetsid
    7. fsets
    8. setsdm
    9. setsfun
    10. setsfun0
    11. setsn0fun
    12. setsstruct2
    13. setsexstruct2
    14. setsstruct
    15. wunsets
    16. setsres
    17. setsabs
    18. setscom
  3. Slots
    1. cslot
    2. df-slot
    3. sloteq
    4. slotfn
    5. strfvnd
    6. strfvn
    7. strfvss
    8. wunstr
    9. str0
    10. strfvi
    11. fveqprc
    12. oveqprc
  4. Structure component indices
    1. cnx
    2. df-ndx
    3. wunndx
    4. ndxarg
    5. ndxid
    6. strndxid
    7. setsidvald
    8. setsidvaldOLD
    9. strfvd
    10. strfv2d
    11. strfv2
    12. strfv
    13. strfv3
    14. strssd
    15. strss
    16. setsid
    17. setsnid
    18. setsnidOLD
  5. Base sets
    1. cbs
    2. df-base
    3. baseval
    4. baseid
    5. basfn
    6. base0
    7. elbasfv
    8. elbasov
    9. strov2rcl
    10. basendx
    11. basendxnn
    12. basendxnnOLD
    13. basndxelwund
    14. basprssdmsets
    15. opelstrbas
    16. 1strstr
    17. 1strstr1
    18. 1strbas
    19. 1strbasOLD
    20. 1strwunbndx
    21. 1strwun
    22. 1strwunOLD
    23. 2strstr
    24. 2strbas
    25. 2strop
    26. 2strstr1
    27. 2strstr1OLD
    28. 2strbas1
    29. 2strop1
  6. Base set restrictions
    1. cress
    2. df-ress
    3. reldmress
    4. ressval
    5. ressid2
    6. ressval2
    7. ressbas
    8. ressbasOLD
    9. ressbas2
    10. ressbasss
    11. resseqnbas
    12. resslemOLD
    13. ress0
    14. ressid
    15. ressinbas
    16. ressval3d
    17. ressval3dOLD
    18. ressress
    19. ressabs
    20. wunress
    21. wunressOLD