← Latest papers
💻 computer science

Event-B Agent: Towards LLM Agent for Formal Model Synthesis and Repair

The paper introduces Event-B Agent, a novel framework that leverages large language models to iteratively synthesize and repair Event-B formal models through interleaved refinement and verification, thereby significantly improving the end-to-end generation of correct-by-construction software from natural language requirements.

Original authors: Hongshu Wang, Xinyue Zuo, Yuhan Sun, Qin Li, Yamine Ait Ameur, Jin Song Dong

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

Original authors: Hongshu Wang, Xinyue Zuo, Yuhan Sun, Qin Li, Yamine Ait Ameur, Jin Song Dong

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 trying to build a skyscraper, but instead of using blueprints and construction crews, you are asking a very smart, well-read, but occasionally confused architect (an AI) to design the entire building from a simple verbal description.

The problem is that this AI architect is great at writing words, but terrible at math and logic. If you ask it to design a bridge, it might write a beautiful description, but the math behind the supports might be wrong. In the real world, if you build a bridge with wrong math, it collapses. In software, if the math is wrong, the system crashes or behaves unpredictably.

This is the challenge of Formal Methods: a way of building software using strict mathematical rules to prove it works before you ever run it. But it's so hard and requires so much math expertise that very few people use it.

Enter "Event-B Agent."

The paper introduces a new system called Event-B Agent. Think of it not just as a writer, but as a collaborative construction team that includes the AI architect, a strict building inspector, and a repair crew, all working together in a loop.

Here is how it works, broken down into simple steps:

1. The "Step-by-Step" Strategy (Refinement)

If you ask the AI to build the whole skyscraper at once, it will get overwhelmed and make mistakes.

  • The Analogy: Imagine building a house. You don't try to design the roof, the plumbing, the electrical wiring, and the foundation all in one giant paragraph. You do it in layers. First, you draw a rough sketch of the shape. Then, you add walls. Then, you add windows.
  • What the Agent does: It breaks the big, scary requirement ("Build a system that finds the lowest number") into small, manageable chunks. It builds a simple "abstract" version first, proves that version works, and then adds more details to it. This is called Refinement. It's like peeling an onion; you handle one layer at a time, ensuring each layer is solid before moving to the next.

2. The "Strict Inspector" (Formal Verification)

Once the AI draws a layer of the building, it doesn't just assume it's good.

  • The Analogy: Imagine a super-strict building inspector who doesn't just look at the blueprints; they run a simulation. They check: "If it rains, will the roof leak?" "If the elevator goes down, will the cables snap?"
  • What the Agent does: It uses two types of inspectors:
    1. The Model Checker: This checks the design against specific scenarios (like testing a car in a wind tunnel). It finds bugs quickly but only within a limited range.
    2. The Theorem Prover: This is the ultimate logician. It tries to prove mathematically that the design is perfect for every possible scenario, forever.
      If either inspector finds a problem, the building isn't approved.

3. The "Repair Crew" (Model & Proof Repair)

This is the magic part. In the past, if the inspector found a mistake, the AI would just get stuck or give up.

  • The Analogy: Imagine the inspector says, "Your door frame is too weak." A normal AI might just say, "Oh, okay," and stop. But Event-B Agent has a Repair Crew. The crew looks at the inspector's report, figures out why the door is weak, and suggests specific fixes: "Let's add a steel beam here," or "Let's change the wood to metal."
  • What the Agent does: When the math fails, the Agent doesn't just guess. It looks at the specific error message (the "Proof Obligation"). It has a library of "repair rules" (like a mechanic's manual). It might say, "The math says this variable could be zero, which causes a division error. Let's add a rule that says 'This variable must be greater than zero'."
    It then updates the design and the proof simultaneously. It keeps doing this loop—Design, Check, Fix, Check, Fix—until the inspector gives a thumbs up.

Why is this a big deal?

The paper tested this on 27 different complex systems (like algorithms for searching data or managing traffic lights). They compared Event-B Agent to other AI tools that just try to write code or check it once.

  • The Result: Event-B Agent was much better at building systems that were actually correct. It successfully proved that its designs worked about 98% of the time, whereas other methods struggled with complex math and often left errors behind.
  • The Efficiency: It didn't take forever. It could fix a complex system in about an hour and a quarter, which is incredibly fast compared to a human expert who might take days or weeks to do the same math.

The Bottom Line

Event-B Agent is a tool that teaches AI how to build software that is "correct by construction." It does this by:

  1. Breaking big problems into small, easy steps.
  2. Using strict math inspectors to find every single error.
  3. Having a smart repair crew that fixes the design and the math proof together until everything is perfect.

It's like giving a robot a blueprint, a calculator, and a hammer, and telling it: "Don't stop until you can prove mathematically that this building will never fall down." The paper shows that this approach works much better than just asking the robot to "write some code."

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 →