This article explores how to implement infinite lists in Lean theorem prover without using unsafe or partial functions, addressing common misconceptions about Lean's recursion limitations. The author demonstrates using coinductive types and the Coinductive library to create safe infinite streams while maintaining Lean's proof guarantees. The implementation shows practical techniques for working with lazy infinite data structures in a theorem proving environment.
Background
Lean is a theorem prover and functional programming language that enforces termination checking to prevent logical inconsistencies. Infinite data structures require special handling in such systems to maintain soundness while allowing useful programming patterns.
- Source
- Lobsters
- Published
- Mar 22, 2026 at 01:40 AM
- Score
- 6.0 / 10