r/ProgrammingLanguages • u/theScottyJam • Apr 18 '26
Looking for extremely minimal proof-assistant programming languages
I love how lambda calculus (and turing machines) have very few rules to them, and yet you're able to express any program you want using them. These aren't technically programming languages (though it's not too hard to make runtimes for them), but there do exist esoteric programming languages with real runtimes that follow similar principles, the most widely known being brainf***.
Is there anything equivalent for proof assistents? A language with extremely minimal syntax/semantics that's capable of letting you both write code, and perform arbitrary proofs about that code? Of course writing proofs in such a language wouldn't be fun, just like people don't tend to write programs in Lambda Calculus, but still, I'd be interested to know if such a thing exists.
Some background that's causing me to ask this question:
I've been interested in learning about proof assistances, and maybe even building one myself. A major reason for me asking this question is because I'd like to get a better understanding of what kind of "primitive proof operations" could be used to build up a proof. I could then use them as inspiration in my own design and/or build up more complicated operations from the simpler ones, who knows, depends on what I learn from them. It's also just something I'm generally curious about, even if I don't end up using what I learn for any personal projects.
So far I've played around with the Agda language, a dependently typed language. And the idea of dependent types are pretty cool - it feels clean the way you can express your desired behavior in type signatures, then write your proofs in the function bodies, but I feel like a lot of black-magic complexity is getting hidden under their unification algorithm - it's not extremely clear how it decides if two types are actually the same or not - and for higher-level languages, perhaps that's fine - you don't need to know all the details, you just need to know if the tool accepts your proof, or if you still need to break it up into smaller steps.
But for this question, I'm hoping to find something that required the programmer to be more explicit when they write their proofs, even if it makes the language extremely annoying to use. I'm imagining it would be some kind of "I want to substitute at this location in the expression using that axiom, then I want to ..." type of thing.
Anyways, maybe such a thing doesn't exist, but any thoughts on the subject would be appreciated.
Thanks.
21
u/oa74 Apr 18 '26
I think that Andras Kovacs's "elaboration zoo" and "smalltt" are good to study:
https://github.com/AndrasKovacs/elaboration-zoo https://github.com/AndrasKovacs/smalltt
There's also Andrej Bauer's introductory tutorial: https://math.andrej.com/2012/11/08/how-to-implement-dependent-type-theory-i/
(Take note of parts II and III as well)
David Thrane Christiansen's tutorials are also great; here is one wherein he implements a dependent type checker with normalization by evaluation: https://davidchristiansen.dk/tutorials/implementing-types-hs.pdf
At least, those are the resources I'm using in my journey as a fellow "would-be-theorem-prover-implementer."
As for production languages, I know Agda, Idris, Lean, and Coq are the most talked about, but Isabelle/HOL and HOL4 are also worth mentioning.
If you want your proofs to really mean anything, I would suggest the opposite is true: it is essential that you understand how the verifier works. When you write a proof, you're not proving anything in some cosmically or divinely authoritative sense: you're proving it with respect to that particular kernel. And if the kernel has a soundness bug, your proof is not reliable. So we want kernels to be as small and auditable as possible. For similar reasons, Lean was designed so that third parties could re-implement the kernel: having multiple implementations of the kernel increases the likelihood that results both agree on are valid.
from what I understand, this is generally achieved by normalization. You establish a canonical normalized spelling for each unique inhabitant of each type, including U (the type of types). If two terms have the same canonical form, they are equal.
Theorem provers do this already, though? I haven't done any proof writing in a long time, so I'm quite rusty on it... but there are tactics to e.g. expand function definitions, replace
awithbif you already haveEq a bon hand, etc.3
u/jcastroarnaud Apr 18 '26
Metamath starts with only a substitution rule.
2
u/Pzzlrr Apr 18 '26 edited Apr 18 '26
Richard O'Keefe once said "Prolog is an efficient programming language because it is a very stupid theorem prover." but I'd be remiss if I didn't mention it:
4
u/dougcurrie Apr 18 '26
You might like miniKanren. Several implementations are available, some are listed at Wikipedia.
3
u/ScottBurson Apr 18 '26
Have a look at ACL2. Seems to fit your description pretty well.
2
u/schoelle Apr 18 '26
Abrial's B Method has been the a brain-twisting way of programming that gained quite a bit of good tool support in the 2000-2010s, though I am not sure how much is still going on. The Rodin web page seems to be dead at least. It is doing abstract refinement of axiomatic ZF set theory, with the end result being a running program.
1
u/FlamingBudder Apr 18 '26 edited Apr 18 '26
I’m not too familiar with the dependently typed ecosystem, but the lambda calculus is one of a family of programming languages that are as minimal as you can make them while still being highly expressive. Usually this involves the function type and as little else as possible as the function is a very special type in intuitionistic theory.
Lambda calculus System F System F omega Dependent lambda calculus Dependent system F Godel’s T (unlike others this uses functions and naturals)
You could also make a PL that is minimal dependent intuitionistic. To do a solid amount of things in it you would need Pi types, sigma types, W types, (M types optional), Dependent enum types (combine with pi and sigma to get products and sums). However I do believe the dependent lambda calculus or dependent system F would be equally as expressive as the language with all the minimal base types. Except you’d have to encode everything else in some ways
1
u/TartOk3387 Apr 18 '26
Maybe Cur? https://docs.racket-lang.org/cur/index.html
1
u/Randozart Apr 19 '26 edited Apr 19 '26
Oooh! This is my time to shine! (Maybe)
I've been working on almost exactly that. With the added benefit it can compile to web, native and even embedded systems. I'm currently strengthening the FFI so that it integrates with just about any other language's library. Initial tests have been promising.
Of course, it's not entirely mature yet, but I would personally appreciate any opinions on it.
https://github.com/Randozart/brief-lang
Realistically though, use this at your discretion. I have been building stuff with it, but it may help to have another pair of eyes on it.
It's also indirectly based on formal verification I noticed in specialised languages, but also Dialog (as a language based on Prolog) and some features of Rust I really liked, like the borrow checker to avoid there ever being race condition.
1
u/Honest_Eye1869 Apr 19 '26
Metamath is exactly what you are describing: the assembly language of mathematical proofs.
Here is how it works and why it fits your search for something like Brainf*** or Lambda Calculus for proofs:
It is the lowest, most explicit, and primitive level possible for working with formal proofs on a computer.
1
u/xamid Jul 01 '26 edited Jul 01 '26
I suppose you are looking for something like D-proofs — condensed detachment proofs in D-notation. They can be used for even smaller proof representations. [example ; The second command under “Exemplary transform” is free of theorems and encodes the proof collection in just 374 characters (all ASCII), whereas the corresponding Hilbert-style proofs printed in a rather compact manner — by the
--parsecommands — are 18299 characters (24873 bytes as UTF-8).]1
u/Sad-Grocery-1570 Apr 18 '26
Check out Dafny or F*. Dafny is simple and intuitive, while F* is a bit more complex but also more powerful. Both rely on SMT solvers for automated theorem proving, encoding a program’s runtime behavior into a logical system via predefined semantic rules. While they don’t have the general-purpose theorem-proving capabilities of Coq/Agda/Lean, they’re more than good enough for program verification.
If you want general-purpose theorem proving and simplicity, you’re out of luck. Theorem proving is inherently complex, and system complexity never just disappears; it only gets shifted around between components. HOL-style provers might be simpler to design and implement than Coq/Agda, but actually writing proofs in them is no less complex.
Of course, these days there’s another option: just offload the complex stuff to AI. I’ve been doing some work in Lean lately, and my workflow is basically to sketch out a simple, straightforward spec, let an LLM generate the proof script, and let Lean check it. I don’t have to waste time wrestling with the complex bits of Lean proofs, which frees me up to focus on the actually important problems.
1
u/rook_of_approval Apr 18 '26
idris or lean or fstar. you can be more explicit about proofs but it's not a requirement.