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 .

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. cstr
  2. cnx
  3. csts
  4. cslot
  5. cbs
  6. cress
  7. df-struct
  8. df-ndx
  9. df-slot
  10. sloteq
  11. df-base
  12. df-sets
  13. df-ress
  14. brstruct
  15. isstruct2
  16. structex
  17. structn0fun
  18. isstruct
  19. structcnvcnv
  20. structfung
  21. structfun
  22. structfn
  23. slotfn
  24. strfvnd
  25. basfn
  26. wunndx
  27. strfvn
  28. strfvss
  29. wunstr
  30. ndxarg
  31. ndxid
  32. strndxid
  33. reldmsets
  34. setsvalg
  35. setsval
  36. setsidvald
  37. fvsetsid
  38. fsets
  39. setsdm
  40. setsfun
  41. setsfun0
  42. setsn0fun
  43. setsstruct2
  44. setsexstruct2
  45. setsstruct
  46. wunsets
  47. setsres
  48. setsabs
  49. setscom
  50. strfvd
  51. strfv2d
  52. strfv2
  53. strfv
  54. strfv3
  55. strssd
  56. strss
  57. str0
  58. base0
  59. strfvi
  60. setsid
  61. setsnid
  62. sbcie2s
  63. sbcie3s
  64. baseval
  65. baseid
  66. elbasfv
  67. elbasov
  68. strov2rcl
  69. basendx
  70. basendxnn
  71. basprssdmsets
  72. reldmress
  73. ressval
  74. ressid2
  75. ressval2
  76. ressbas
  77. ressbas2
  78. ressbasss
  79. resslem
  80. ress0
  81. ressid
  82. ressinbas
  83. ressval3d
  84. ressress
  85. ressabs
  86. wunress