From my understanding, most descriptions of higher order logic have a clear "phase distinction":
- We first describe the types, which are usually syntactically simple trees. For concreteness, let's say there are product types $A \times B$ and power types $\mathcal P (A)$, and base types $\mathbb N, \Omega, \bf 1$ for natural numbers, propositions and the unit type.
- Next, we describe the terms in these types. We have syntax for pairs $(a,b)$, set comprehension $\{x :A \mid \varphi(x)\}$, $0, \mathsf{succ}$ for natural numbers, $*$ for the unit type, and we have all the required proposition formers in the proposition type. These come equipped with the natural notion of free variables and substitution.
- Finally, we describe a judgement like $p \vdash_{\Gamma} q$, where $p,q$ are terms of type $\Omega$ in the context $\Gamma$, formalizing the notion of proofs. These may come with the expected metatheorems, like cut elimination, stability under substitution etc.
It is this distinction between these three layers that separate higher order logic (aka simple type theory) from dependently typed proof systems. However, this is quite tedious to use. For example, this presentation doesn't have a function type, and they should be encoded by a particular subset of $\mathcal P(A \times B)$. So every time we need a function, we actually take an element $f :\mathcal P(A \times B)$ with a proof of $\vdash \textrm{isFunctional}(f)$. Similarly, a group cannot be considered as a single object, but rather a carrier type $A$, a subset of that type $S : \mathcal P(A)$ (since we rarely care about group structures which happen to be on one of the built-in types), an operation $\times$, and a bunch of proofs of the required axioms.
I'm wondering about how practical HOL users overcome this issue. The first idea that I have is to use some syntactic sugar to bundle these data together, and Isabelle locales and records seems to be roughly along this line. And indeed I found the group theory formalization to follow this. However for quotients, the rat
and real
type in Isabelle/HOL seems to break the phase distinction, by allowing the generation of a quotient type, dependent on a type and a term. HOL light also seems to have similar primitive type formers coming from new_basic_type_definition
.
This raises several closely related questions:
- If types can now depend on terms, what separates HOL from dependent type theory?
- Still, there is no Curry–Howard correspondence, but dependent type theory can refrain from using CH too.
- I noticed that the new types are declared a new name, and declaring the same type twice under different names will result in different types. Is there a name for this?
- What are some other ways to overcome the issue above in practice, if not letting types depend on terms?