Is there a theory of typing proof objects or proof trees?
Partially inspired by this question and answer, I was wondering about separating type checking into two phases: the first phase infers a full proof tree and the second phase checks if the proof tree is well formed and conclusions follow from premises.
Potentially, this sort of separation allows a smaller kernel. Also the kernel can be written as a total function within a prover of similar power without extra axioms. I think it's the driver which infers the proof trees which would require extra axioms.
What I mean is you can provide explicit witnesses for typing judgements.
For the STLC, something like this:
$$\frac{\begin{split} q_0 \colon [ \Gamma \vdash e_0 \colon \tau_0 \rightarrow \tau_1 ] \\ q_1 \colon [ \Gamma \vdash e_1 \colon \tau_0 ] \end{split}}{ q_0 q_1 \colon [ \Gamma \vdash e_0 e_1 \colon \tau_1 ] } $$
$$\frac{q \colon [ \Gamma , x \colon \tau_0 \vdash e \colon \tau_1 ]}{ \lambda x \colon \tau_0. q \colon [ \Gamma \vdash \lambda x \colon \tau_0 . e \colon \tau_0 \rightarrow \tau_1 ] } $$
$$\frac{x \colon \tau \in \Gamma}{ x \colon \tau \in \Gamma \colon [ \Gamma \vdash x \colon \tau ] } $$
The meat and potatoes is when you have more complicated features like dependent types. You'd want explicit witnesses for judgemental equalities something like:
$$ \frac{\begin{split}q \colon [ \Gamma , x \colon \tau \vdash e \colon \tau' ] \\ q' \colon [ \Gamma \vdash \colon e' \colon \tau ]\end{split}}{\beta(x \colon \tau \mathrel{:=} q' , q) \colon [ \Gamma \vdash (\lambda x\colon \tau. e) e' \triangleright_\beta [x \mathrel{:=} e'] e ]} $$
$$ \frac{\begin{split} q \colon [\Gamma \vdash \tau \equiv \tau'] \\ q' \colon [\Gamma \vdash e \colon \tau] \end{split} }{ \textbf{J}(q, q') \colon [ \Gamma \vdash e \colon \tau' ]} $$
Anyhow, it quickly gets very redundant, confusing and unreadable.
I'm confused about several aspects of this.
You want proof trees to be trivial to check but you also want them to not be redundant. What should it mean for it to be "trivial" to infer a property of the root of the proof tree like the environment or type?
It's really confusing to notate proof trees. Is there a better way of writing this silliness?
Are there existing references or work in this direction?
It's hard to come up with a reasonable meaning for proof trees. I guess you can see them as terms annotated with explicit environments and types?