Quotient type explained

\equiv

on elements of the type - for example, we might say that two values of the type Person are equivalent if they have the same name; formally p1 == p2 if p1.name == p2.name. In type theories which allow quotient types, an additional requirement is made that all operations must respect the equivalence between elements. For example, if f is a function on values of type Person, it must be the case that for two Persons p1 and p2, if p1 == p2 then f(p1) == f(p2).

Quotient types are part of a general class of types known as algebraic data types. In the early 1980s, quotient types were defined and implemented as part of the Nuprl proof assistant, in work led by Robert L. Constable and others.[1] [2] Quotient types have been studied in the context of Martin-Löf type theory,[3] dependent type theory,[4] higher-order logic,[5] and homotopy type theory.[6]

Definition

To define a quotient type, one typically provides a data type together with an equivalence relation on that type, for example, Person // ==, where == is a user-defined equality relation. The elements of the quotient type are equivalence classes of elements of the original type.[3]

Quotient types can be used to define modular arithmetic. For example, if Integer is a data type of integers,

\equiv2

can be defined by saying that

x\equiv2y

if the difference

x-y

is even. We then form the type of integers modulo 2:[1]

Integer //

\equiv2

The operations on integers, +, - can be proven to be well-defined on the new quotient type.

Variations

In type theories that lack quotient types, setoids (sets explicitly equipped with an equivalence relation) are often used instead of quotient types. However, unlike with setoids, many type theories may require a formal proof that any functions defined on quotient types are well-defined.[7]

Properties

Quotient types are part of a general class of types known as algebraic data types. Just as product types and sum types are analogous to the cartesian product and disjoint union of abstract algebraic structures, quotient types reflect the concept of set-theoretic quotients, sets whose elements are partitioned into equivalence classes by a given equivalence relation on the set. Algebraic structures whose underlying set is a quotient are also termed quotients. Examples of such quotient structures include quotient sets, groups, rings, categories and, in topology, quotient spaces.[3]

See also

Notes and References

  1. Book: Constable, Robert L. . Implementing Mathematics with the Nuprl Proof Development System . 1986 . Prentice-Hall . 978-0-13-451832-9 . en.
  2. Book: Constable, R. L. . 1984 . Clarke . Edmund . Kozen . Dexter . Mathematics as programming . https://link.springer.com/chapter/10.1007/3-540-12896-4_359 . Logics of Programs . Lecture Notes in Computer Science . 164 . en . Berlin, Heidelberg . Springer . 116–128 . 10.1007/3-540-12896-4_359 . 978-3-540-38775-6. 1813/6405 . free .
  3. Web site: Li . Nuo . 2015-07-15 . Quotient types in type theory . 2023-09-13 . eprints.nottingham.ac.uk . en.
  4. Book: Hofmann, Martin . 1995 . A simple model for quotient types . https://link.springer.com/chapter/10.1007/BFb0014055 . Typed Lambda Calculi and Applications . Lecture Notes in Computer Science . 902 . en . Berlin, Heidelberg . Springer . 216–234 . 10.1007/BFb0014055 . 978-3-540-49178-1.
  5. Book: Homeier, Peter V. . 2005 . Hurd . Joe . Melham . Tom . A Design Structure for Higher Order Quotients . https://link.springer.com/chapter/10.1007/11541868_9 . Theorem Proving in Higher Order Logics . Lecture Notes in Computer Science . 3603 . en . Berlin, Heidelberg . Springer . 130–146 . 10.1007/11541868_9 . 978-3-540-31820-0.
  6. Web site: 2013-03-12 . The HoTT Book . 2023-09-13 . Homotopy Type Theory . en.
  7. Hofmann . Martin . 1997 . Extensional Constructs in Intensional Type Theory . SpringerLink . en . 10.1007/978-1-4471-0963-1. 978-1-4471-1243-3 .