Formalising real numbers in homotopy type theory
暂无分享,去创建一个
Cauchy reals can be defined as a quotient of Cauchy sequences of rationals. In this case, the limit of a Cauchy sequence of Cauchy reals is defined through lifting it to a sequence of Cauchy sequences of rationals. This lifting requires the axiom of countable choice or excluded middle, neither of which is available in homotopy type theory. To address this, the Univalent Foundations Program uses a higher inductive-inductive type to define the Cauchy reals as the free Cauchy complete metric space generated by the rationals. We generalize this construction to define the free Cauchy complete metric space generated by an arbitrary metric space. This forms a monad in the category of metric spaces with Lipschitz functions. When applied to the rationals it defines the Cauchy reals. Finally, we can use Altenkirch and Danielson (2016)'s partiality monad to define a semi-decision procedure comparing a real number and a rational number. The entire construction has been formalized in the Coq proof assistant. It is available at https://github.com/SkySkimmer/HoTTClasses/tree/CPP2017 .
[1] Bas Spitters,et al. Type classes for mathematics in type theory† , 2011, Mathematical Structures in Computer Science.
[2] Russell O'Connor. A monadic, functional implementation of real numbers , 2007, Math. Struct. Comput. Sci..
[3] Thorsten Altenkirch,et al. Partiality, Revisited: The Partiality Monad as a Quotient Inductive-Inductive Type , 2017, FoSSaCS.