Lynx is a project for proving properties of Erlang and Elixir programs with Lean. Developers state expected behavior as laws in familiar language, and Lynx translates the relevant code into a model of the Erlang runtime. Lean then checks proofs about that translated program, rather than about a separate specification or compiled output. This can provide guarantees beyond types and testing: a proof can cover every input that meets its stated assumptions, while property-based tests sample only finitely many cases. Lynx has been used to verify JSON roundtripping, check that Elixir Task functions leave no stray messages, and expose issues in Elixir’s type system. The example demonstrates proofs that a recursive sum returns zero for an empty list and distributes over list concatenation.
Laws can express totality, roundtrips, equivalence, idempotence, and algebraic properties. Their assumptions and conclusions must be chosen carefully: an overly narrow assumption can make a claim vacuous, while a weak or incomplete property can certify incorrect code. Lynx supports sequential and concurrent behavior, modeling process operations and checking concurrent outcomes across interleavings, with bounded execution steps and techniques to reduce the search. Its runtime model is incomplete, and proofs cannot cover external network or port I/O. The recommended workflow is for people to define and review what correctness means, while coding agents help write Lean proofs; Lean’s trusted kernel checks that those proofs are valid. Lynx complements, rather than replaces, tests, fuzzing, and code review.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.