Well, in type theory, we know how to differentiate nice (i.e. polynomial functor) maps from $\rset^n \to \rset$. Can we do something with that intuition? Are there exotic objects that look like multiple copies of $\rset^n$ patched together, in the same way that manifolds are like copies of $\R^n$ patched together, or how schemes are affine schemes patched together?
First I'm going to review how we can talk about manifolds, tangent spaces, etc. in some easy warm-up cases so that the notation is already a familiar melody when I come to talk about types.
We define a tangent vector $v$ at a point $m \in \R^2$ to be a derivation, a thing that eats up a scalar function $\R^2 \to \R$ and outputs a scalar, and which behaves like a directional derivative. That is, we have \[v : C \to \R\] and we require that $v$ is linear, (e.g. $v(f + g) = v(f) + v(g)$ for all $f,g \in C$) and satisfies a product rule, namely \[v(f\cdot g) = f(m) v(g) + v(f) g(m)\] for all $f, g \in C$. This product rule is a critical piece of information that captures what it means for $v$ to "behave like a directional derivative".
It turns out that any $v$ satisfying these properties is of the form \[f \mapsto c_1 {\partial f\over \partial x_1}(m) + c_2 {\partial f\over \partial x_2}(m)\] for some parameters $c_1, c_2 \in \R$, where $x_1, x_2$ are the coordinates of the plane. That is, every $v$ is a linear combination of directional derivatives evaluated at the point $m$.
We define a tangent vector $v$ at a point $m \in S^2$ to be a derivation, a map \[v : C \to \R\] and we require that is linear, and satisfies the same product rule, \[v(f\cdot g) = f(m) v(g) + v(f) g(m)\] for all $f, g \in C$.
Now for any point $m$, there do exist two tangent vectors $D_1, D_2$ such that every tangent vector at $m$ is uniquely of the form \[f \mapsto c_1 (D_1 f) + c_2 (D_2 f) \] for some parameters $c_1, c_2 \in \R$, but there is no longer a canonical choice of $D_1, D_2$! The possible choices vary from point to point, and there's no globally coherent way of choosing a basis of the tangent space for every point on the sphere.
That is: the sphere is an interesting, nontrivial manifold, as opposed to just being a boring, trivial euclidean manifold like the plane is.
We define a tangent vector $v$ at a point $m \in M$ to be a derivation, a map \[v : C \to \rset\] such that $v$ is linear, and it satisfies \[v(f\x g) \cong f(m) \x v(g) + v(f) \x g(m)\] for any $f, g \in C$, and \[v(f) = 0\] if there exists $K : \rset$ such that $f(m') = K$ for all $m' \in M$, i.e. the derivative of a constant function must be zero.
Let's take a moment to confirm that these requirements actually make sense. Both $C$ and $\rset$ are semirings, so $v$ being linear is a sensible thing to ask for. The argument $f\x g$ of $v$ is sensible: we take product types pointwise, for $f$ and $g$ being "nice" functions in $C \subseteq M \to \rset$. Since $C$ is a subsemiring, it's still the case that $f \x g$ is in $C$, so we can apply $v$ to it, yielding a type. This type is required to be isomorphic to the sum of two product types $f(m) \x v(g) + v(f) \x g(m)$.
Lemma: For any $m\in M$, if $v$ is a tangent vector at $m$, then there exist
coefficients $c_1, \ldots, c_n : \rset$ such that
\[v = \sum_{i=1}^n c_i D_{m,i}\]
Proof: Set $c_i = v(x_i)$. To show two tangent vectors $v, w$ are equal, it suffices
to show $v(0) = w(0)$, $v(1) = w(1)$, $v(x_i) = w(x_i)$ for all $i$, and that equality is preserved under
sums and products. We proceed to prove the required isomorphism by resorting to these cases:
Question: We've defined a trivial type manifold, but are there interesting nontrivial examples?I suspect that if these exist, they might be constructed by gluing together copies of $\N^n$ as above, but I haven't been able to make a construction work yet. I'd be really interested if you could get something working where $M = \Z^n$, or with the carrier being some kind of one-dimensional circle that loops back on itself somehow.