The nLab has a lot of nice things to say about how you can use the internal logic of various kinds of categories to prove interesting statements using more or less ordinary mathematical reasoning. However, I can't find a single example on the nLab of what such a proof actually looks like. (The nLab has a frustrating lack of examples in general.)
Can anyone supply me with some examples? I'd be particularly interested in the following kinds of examples:
I've heard in a topos one can internalize the real numbers and, in the topos $\text{Sh}(X)$ of sheaves on a topological space, this reproduces the sheaf of continuous real-valued functions $X \to \mathbb{R}$. Moreover, one can internalize "finitely generated projective $\mathbb{R}$-module" and in $\text{Sh}(X)$ this reproduces real vector bundles on $X$. What can you prove about vector bundles this way?
I'd also like to see examples of what you can do in the internal logic of Cartesian closed categories.
This MO question is related but it doesn't really satisfy my curiosity.
Here is an arbitrary example from algebraic geometry. We'll prove the following well-known statement about $\mathcal{O}_X$-modules on reduced schemes $X$ by reducing to constructive linear algebra interpreted in the topos $\mathrm{Sh}(X)$ of sheaves on $X$:
We can translate this statement into the internal language of $\mathrm{Sh}(X)$ by the following dictionary:
So the statement follows if we can give a constructive proof of the following linear algebra fact:
The direction "$\Rightarrow$" is clear. For the direction "$\Leftarrow$", consider a minimal generating family $x_1,\ldots,x_n$ of $M$ (which exists by assumption). This family is linearly independent (and therefore a basis): Let $\sum_i \lambda_i x_i = 0$. If any $\lambda_i$ were invertible, the family $x_1,\ldots,x_{i-1},x_{i+1},\ldots,x_n$ would too generate $M$, contradicting the minimality. So each $\lambda_i$ is not invertible and thus zero (by assumption on $A$).