🤖 AI Summary
This work addresses the challenge of integrating the industrial-scale B-Method tool Atelier B with the Lean proof assistant by introducing BARReL, a library implemented in Lean 4 that enables users to carry out the entire development process—from formal specification to machine refinement—using standard B syntax within Lean. The key innovation lies in leveraging Lean’s dependent type system to explicitly encode well-definedness conditions for partial B operators, thereby ensuring that all proof obligations are free from ill-formed instances. Furthermore, metaprogramming is employed to automatically generate well-definedness constraints and basic automation tactics. The approach has been validated on representative case studies, laying the foundation for a highly reliable and extensible, Lean-native toolchain for the B Method.
📝 Abstract
BARReL is a Lean 4 library bridging Atelier B, an industrial tool for the B method, and the Lean proof assistant by enabling users to conduct their formal B developments -- up to machine refinement and implementation -- interactively inside Lean, while retaining standard B syntax. B partial operators are carefully encoded by generating explicit well-definedness conditions, leveraging Lean's dependent types to enforce a well-definedness discipline by construction. That is, proof obligations and proof steps cannot silently rely on ill-typed or ill-defined instantiations. BARReL also features basic automation to try to discharge such well-definedness conditions automatically. The implementation is written entirely using Lean meta-programming and is designed to be modular: extending the supported B fragment typically requires only adding new syntax and encoding clauses. We illustrate the approach on a small but representative case study, and argue that BARReL can act as a stepping stone towards a strongly reliable Atelier B toolchain grounded in the Lean proof assistant.