← Latest papers
💻 computer science

BARReL: a modern backend for Atelier B in Lean

BARReL is a modular Lean 4 library that bridges the industrial Atelier B tool with the Lean proof assistant by encoding B's partial operators with explicit well-definedness conditions, thereby enabling interactive, syntax-preserving formal development and verification of machine refinements within a strongly reliable framework.

Original authors: Ghilain Bergeron, Vincent Trélat

Published 2026-06-19
📖 5 min read🧠 Deep dive

Original authors: Ghilain Bergeron, Vincent Trélat

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are building a skyscraper using a very old, specialized blueprint system called Atelier B. This system is famous in the construction industry because it's incredibly strict: it checks every beam and bolt to ensure the building won't collapse. However, the tools to check these blueprints are a bit like a rigid, old-fashioned calculator. They do the job, but they can't "think" creatively, and if you make a tiny mistake in how you define a part, the calculator might just ignore it or give you a confusing error message.

Now, imagine a new, super-smart construction assistant called Lean. Lean is like a genius architect who can not only check blueprints but also write complex proofs, solve puzzles, and learn from a massive library of math knowledge. But Lean speaks a different language and doesn't understand the old Atelier B blueprints directly.

BARReL is the translator and bridge built by Ghilain Bergeron and Vincent Trélat to connect these two worlds. Here is how it works, using simple analogies:

1. The "Translator" Role

Think of BARReL as a universal translator that sits between the old blueprint system (Atelier B) and the smart assistant (Lean).

  • When you feed an Atelier B blueprint to BARReL, it doesn't just copy-paste the text. It reads the blueprint, understands the rules, and rewrites the "proof obligations" (the tasks that need to be checked) into a language Lean understands.
  • Crucially, it keeps the original look and feel of the B language so that the original engineers don't get lost. It's like translating a book into a new language but keeping the original font and layout.

2. The "Safety Guard" for Missing Pieces

The biggest challenge in the old system is partial operators. Imagine a tool in your toolbox that only works if you have a specific type of screw. If you try to use it on a nail, the old system might just say "Okay" and hope for the best, or it might generate a separate, tiny note saying "By the way, make sure you have a screw."

In the old Atelier B system, these "safety notes" (called Well-Definedness conditions) could sometimes get separated from the main task. If a builder forgot to check the note, the building could theoretically be unsafe, but the system wouldn't catch it until much later.

BARReL changes the rules:

  • It treats these safety notes as mandatory parts of the main task.
  • Using Lean's "dependent types" (a fancy way of saying "smart rules"), BARReL forces the builder to prove they have the "screw" before they are even allowed to use the tool.
  • Analogy: It's like a video game where you cannot pick up a key unless you have already proven you have the lock. You can't even try to use the key if the lock doesn't exist. This prevents "silent" mistakes where the system assumes something is true when it isn't.

3. The "Auto-Checker"

While BARReL forces you to prove the hard safety rules, it also has a smart auto-checker.

  • Many of the "safety notes" are very simple (e.g., "This set of numbers is not empty").
  • BARReL has a built-in robot that automatically checks these simple notes for you. In the case study they tested, this robot handled 146 out of 190 safety checks automatically.
  • This leaves the human engineer to focus only on the complex, creative parts of the proof that the robot can't solve yet.

4. The "Refinement" Journey

The paper tested BARReL on a project to find the minimum number in a list. They started with a simple idea and slowly refined it into a complex, step-by-step computer program.

  • Level 1: A simple idea.
  • Level 2: A slightly more detailed plan.
  • Level 3: A specific, step-by-step recipe using a table.
  • Result: BARReL successfully translated every step of this journey into Lean. It generated hundreds of proof tasks, automatically solved the boring safety checks, and let the human prove the logic. It showed that you can take a complex industrial design and verify it inside the smart Lean environment without losing the original design's structure.

Why This Matters

The authors argue that BARReL is a stepping stone.

  • Currently, the "translator" (BARReL) relies on the old Atelier B machine to generate the initial list of tasks.
  • The goal is to eventually build a version where the entire process happens inside the smart Lean environment, removing the need for the old machine entirely. This would create a "fully verified" chain where every single step, from the first blueprint to the final code, is checked by the smart assistant.

In summary: BARReL is a modern, safety-first bridge that lets engineers use the powerful, smart tools of the Lean proof assistant to verify their industrial designs, ensuring that no "missing screws" (undefined operations) are ever ignored.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →