— web clipping, 519 words — published 2026-11-14
Post by @zyansheep on X
On the topic of type theories, conceptually they are basically just (ideally terminating) functions of type \`Term x Type -> Bool\` right? And if you partially apply whatever your encoding of Type is to this, you get out that types themselves are just computable predicates on terms (\`Term -> Bool\`). e.g. Bool is just \`{v} => v == true || v == false\`, and Nat is just similar but via structural recursion. (Note: this works best in the tree calculus where there is no separate encoding needed for programs to introspect on themselves). The complexity comes when you have function types. Lets say you want to write a predicate that checks if a program/term satisfies \`A -> B\`. (i.e. if you pass it something that satisfies predicate A, you get back something that satisfies predicate B). You can define (in the tree calculus) such a predicate pretty naively by enumerating over all terms, filtering to ones which satisfy A, running the function, and then ensuring that all calls to the function with all the elements of A return something that satisfies the B predicate. The downside here is that this predicate doesn't actually terminate. You can make it terminate by restricting \`A\` to only be predicates that check membership of a finite list, in which case you can check any function is for example \`Bool -> Bool\`. A more general way is if you can have a system that can evaluate under some abstract variable which has an "approved" way to destruct the variable (i.e. for nat, this would be a special construct that wraps the triage rule and allows you to define a restricted \`nat\_rec\` on trees). Such a system could be thought of as an "optimization" on the original naive try-all-the-cases function type definition. My hypothesis with disp is that you can have like a potentially constructively defined "space of all type theories" as just various kinds of optimizations on the fundamental "stream type". (As an aside, naive linear typing would just be a matter of simulating the program and checking that each state transition for all inputs held the linear property—and appropriately all linear type theories would be corresponding provable optimizations of this.) And the soundness of a given type theory defined this way is just a matter of proving that the optimization is sound. If this is true, it could allow easily implementing arbitrary type theories in one unified theory, potentially even allowing easy transport from more specific theories to more general theories, i.e. automatic transpilation!
JustWrite Nov 12-14, 423 words
---
##### Comments
> **east coast anna @east\_coast\_anna** · [2026-11-15](https://x.com/east_coast_anna/status/2121813525974962181)
>
> look into tree transducers if u haven't
>
> > **Zyan🔸 @zyansheep** · [2026-11-15](https://x.com/zyansheep/status/2121814218207117410)
> >
> > will do 👀
> **David Young @roboguy20** · [2026-11-15](https://x.com/roboguy20/status/2121825867047325937)
>
> If you haven't seen it already, you might like "seemingly impossible functional programs": https://math.andrej.com/2007/09/28/seemingly-impossible-functional-programs/…
>
> This also reminds me a bit of logical relations (although that's more about metatheory than implementation), between that partial application you use (which is sort
> **Dragon's Egg @DreggNet** · [2026-11-15](https://x.com/DreggNet/status/2121836312449949744)
>
> QIITs allow for this.