After looking at Can a computer determine whether a mathematical statement is true or not? for a while, I worry we may be into incompleteness/halting problem territory with this question, so an answer on that front, while disappointing, would also be acceptable
I've been interested by ADT equations since I read the linked post, and I've started thinking about them in the context of Coq's inductive types (which essentially permit the usual sum, product, and unitary type constructors).
In particular, I've been considering the correspondence between type definitions and the number of elements inhabiting the type. In particular, solving the type's equation yields the number of elements inhabiting the type, and it seems reasonable to me that, for any so-definded type, this number is at most $\aleph_0$. That is, for any ADT or inductively defined type, the number of inhabitants is at most countably infinite. I'm thinking about how to formulate or prove such a statement in Coq, and in the meantime had some questions. (It seems further natural that such types and numbers are in one-to-one correspondence up to isomorphism between types of the same cardinality, but that might be a step too far).
It seems easy enough to show a type definition containing exactly $n$ elements for any natural $n$, so that gives one direction of a theorem connecting the two. Going the other way, though, seems more difficult, and in either case it woudl be natural to me to rely on a function $C$ from types $\tau$ to numbers (what class of numbers?) $n$ where $C(\tau) = n$ means there are $n$ elements inhabiting the type.
The trouble is, this function doesn't seem computable. If we take the naturals as
Inductive nat: Type :=
| S: nat -> nat.
such a function would be required to produce an infinity (namely $\aleph_0$), and thus I don't think Coq could accept such a definition. (Worse, how would the definition know when to return 0?)
So I've come back around to equations. I wondered if I could formulate this idea by constructing for each type $\tau$ (possibly parameterized on other types $\alpha, \beta, \dots$) a polynomial (is this the right term, since it may really be a recurrence?) in the same class of numbers $\tau(\alpha, \beta, \dots) = P(\tau, \alpha, \beta, \dots)$ and proving that all such equations have a unique solution (and herein lies my concern above: would this even be provable?).
This brings me to my main question: I believe that the above statement is true in the absence of mutually recursive types. But mutually recursive types suggest systems of equations, rather than a single equation, and it is well-known that systems do not always have a solution.
But these systems would have some (possibly unique) properties:
- they would be polynomial in this class of numbers
- each would have the form $\tau_i = P(\tau_1, \dots, \tau_n)$
- there would be exactly $n$ equations for $n$ mutually recursive types
Is it possible to prove (or already proven) that such systems are always uniquely solvable in the naturals? I suspect it might be easier to formulate in Linear algebra, but I'm a bit rusty on what it takes to do that here.