← All papers
BARReL: a modern backend for Atelier B in Lean
cs.LO
Jun 18, 2026 · v1
TL;DR
Implements BARReL, a Lean 4 library embedding Atelier B's B method with well-definedness conditions enforced through dependent types.
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.
Problem
Formal developments in the B method rely on Atelier B; bridging them into an interactive proof assistant could give a more reliable toolchain.
Approach
BARReL is a Lean 4 library that lets users conduct B developments, up to refinement and implementation, interactively in Lean while keeping standard B syntax. Partial B operators are encoded by generating explicit well-definedness conditions, using Lean's dependent types to enforce a well-definedness discipline by construction, with basic automation to discharge those conditions. The implementation is written entirely in Lean metaprogramming and is modular.
Results
A small case study illustrates the approach, positioning BARReL as a step toward an Atelier B toolchain grounded in Lean.
