🤖 AI Summary
This work addresses the challenges of formalizing set theory in dependently typed proof assistants, where boilerplate code is often excessive and integration with typed libraries is difficult. Building upon Lean 4’s Mathlib, the authors develop a set-theoretic framework over a model of ZFC that incorporates relational calculus, lightweight automation with predictable behavior, and standard set constructions. Crucially, it enables seamless interoperability between ZFC objects and Lean’s native types for the first time, supporting hybrid set/type reasoning. The framework substantially reduces boilerplate in scalable set-theoretic proofs while remaining fully compatible with Mathlib. Its expressiveness and practicality are demonstrated through complete formalizations of Boolean values, natural numbers, integers, and the Curry isomorphism theorem.
📝 Abstract
We present ZFLean, a Lean 4 library for doing core mathematics inside a model of ZFC with the ergonomics expected of typed Mathlib developments. Building on Mathlib's ZFC model, we contribute a relational calculus for sets with rewriting hints and small predictable tactics, canonical set-theoretic constructions -- Booleans, naturals, integers, sums/option -- and bridges between ZFC objects and Lean's native types enabling mixed set-level/typed proofs. The layer reduces boilerplate for extensional reasoning while remaining compatible with vanilla Mathlib. We discuss library organization and usage patterns that lower the friction of set-theoretic formalization in a dependently typed assistant. We demonstrate typical use of the framework with a case study exercising our constructions and relational calculus through a proof of an isomorphism theorem on curried functions.