datahike

whilo 2026-04-03T08:00:28.736329Z

Announcing Ansatz https://github.com/replikativ/ansatz is a new Clojure library for verified programming based on the Calculus of Inductive Constructions, with a Lean 4-compatible kernel and similar syntactic abstractions. The idea is: write programs and proofs in Clojure s-expressions, type-check them against a CIC kernel implemented in Java, and then run verified functions as ordinary JVM/Clojure code. Ansatz can also work against imported Lean 4 libraries, including Mathlib and CSLib, so in principle you can use a large body of existing formalized mathematics and verified algorithms from Clojure. It uses the same persistent memory model as Datahike which makes the proof state git-like, something that Lean4 cannot do. Current focus: • verified functions, theorems, inductives, structures • tactic-based proofs in Clojure syntax • import/export around Lean 4 / Mathlib • a JVM-native path for building larger systems on top This is the first release, but not a weekend hack. A lot of work already went into getting Mathlib checking/import paths and the core machinery working. I’m exploring this direction seriously because I want to build AI infrastructure on top of it (e.g. #simmis). That said, this is still an early starting point, not stable software. I expect dragons: - tactic implementations still have rough edges - there are probably still gaps in the kernel - the overall workflow and ergonomics need iteration So this is both a release and an invitation: if verified programming from Clojure, Lean interop, or proof-aware AI infrastructure sounds interesting, I’d be glad if people kick the tires, look at the design, and explore where this could go.

👀 2
whilo 2026-04-05T07:56:11.124849Z

Different testing/verification techniques have different reach. If you can prove a property inside of a system then consistency is guaranteed. Generative tests don't do that. Concretely, I have used generative testing extensively against the https://github.com/replikativ/persistent-sorted-set that many of the replikativ libraries now use to spot errors, but one that was in there already from the beginning only showed up by chance in one run and I am still not sure my fix fully covered it. If you compare this to the verification of the RBTree in the README https://github.com/replikativ/ansatz, then there you can be sure the tree is always balanced for instance. Now, your assessment is right that often proving is too much effort and you have to make idealistic assumptions, e.g. have no caching, IO, side effects, use no standard Clojure functions etc. But even then there are cases where I would say it is actually instructive to try to prove a property you care about, let's say consistency of a statistical estimator, even if the proof does not fully apply to your code. It will help you to improve your implementation and understanding. And importantly most frontier LLMs are now very good at using Lean and mathlib and you can let them chew a bit on something you care about while learning from it. Does this make sense?

grounded_sage 2026-04-05T07:59:05.188569Z

Would you say then you would keep testing?

whilo 2026-04-05T07:59:08.137469Z

I would say that this is also the reason to gradually type your programs. If you know the types and the type system captures consistency you care about, then it is worth it.

whilo 2026-04-05T08:00:06.672139Z

For sure, I am not saying you should prioritize Ansatz. But you can try to apply it to formal bits of your code that are mathematically or formally well specified. Such as data structures, algorithms, stats estimators, etc.

👍 1
whilo 2026-04-05T08:01:05.521269Z

This is why I put this here for instance https://github.com/replikativ/ansatz/blob/main/examples/gradient_descent.clj, it is something you would prove in a grad class on optimization/machine learning (we had this here), and you can prove it directly on your running code.

whilo 2026-04-05T08:02:05.060019Z

If anything it is a great learning opportunity to bridge the gap from programming to constructive maths, which can make it a lot easier to learn it without going to a university.

whilo 2026-04-05T08:09:36.492789Z

I think Clojure should have a gradual/optional type system like typedclojure and libraries should provide optional type annotations. It is weird that Python and JavaScript have been able to do this, but somehow Clojure decided it is not worth it. Python got so much nicer to work with since it has type annotations.

whilo 2026-04-05T08:20:37.537689Z

In general you want to make use of the fact that you have access to non-opinionated prodigy programmers and let them apply the sharpest tools to a problem, even if you don't understand it yet or it is a speculative experiment. The cost of verification has dropped by many orders of magnitude now and Ansatz itself makes it much easier to just pull it in in a REPL and play around.

grounded_sage 2026-04-05T03:26:29.544229Z

When I ask Claude how this can help me it's only to reduce probability from property based tests and use mathematical proof as opposed to a brute force verification process. Lines of code difference in an existing codebase would not change that much. What use cases exist for this outside of that?

whilo 2026-04-03T05:08:44.136149Z

Btw. I have iterated on superficie, it has now a much cleaner, and more sound parsing approach and syntax, and you can also it in its own SCI based REPL https://replikativ.github.io/superficie/examples/playground.html. I think this could be viable scripting interface to Clojure apps in general.

🤔 2