← Latest papers
💻 computer science

Formal Verification of Minimax Algorithms

This paper presents a formal verification of minimax search algorithms with alpha-beta pruning and transposition tables using the Dafny system, introducing a witness-based correctness criterion that successfully proves one practical variant while exposing a correctness violation in another.

Original authors: Wieger Wesselink, Kees Huizing, Huub van de Wetering

Published 2026-04-23
📖 4 min read☕ Coffee break read

Original authors: Wieger Wesselink, Kees Huizing, Huub van de Wetering

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 playing a complex board game like Chess or Checkers against a super-smart computer. To decide its next move, the computer doesn't just guess; it builds a giant "tree" of possibilities in its mind. It asks, "If I go here, you'll go there, then I'll go there..." and so on, trying to predict the best outcome. This is called a Minimax algorithm.

However, building this entire tree for a game like Chess is impossible because it's too huge. So, computers use tricks to speed things up:

  1. Alpha-Beta Pruning: Like a detective ignoring dead-end alleys, the computer stops looking down paths that are clearly bad.
  2. Transposition Tables: This is a "sticky note" system. If the computer has already calculated a specific board position before, it just looks up the answer on the sticky note instead of re-calculating it.

The Problem:
These tricks are incredibly clever, but they are also messy. Because the computer skips steps and reuses old notes, it's very hard to prove mathematically that the final answer is actually correct. Sometimes, the computer might skip a path that would have led to a win, just because an old sticky note told it to stop looking.

The Solution (The Paper's Mission):
The authors of this paper wanted to use a "mathematical proof machine" (a tool called Dafny) to check if these game-playing algorithms are actually telling the truth. They didn't just run tests (which might miss rare errors); they tried to prove the code is perfect.

The Big Idea: The "Witness"

The hardest part was dealing with the "sticky notes" (Transposition Tables). When a computer reuses an old answer, it's like looking at a map of a city you visited last year. But what if the city has changed? Or what if you only looked at part of the city last time?

The authors invented a new way to check correctness called a "Witness."

  • The Analogy: Imagine the computer claims, "I know the best move is to go Left."
  • The Old Way: "Trust me, I did the math."
  • The Witness Way: "Show me the map." The computer must produce a specific, complete "sub-tree" (a witness) that proves, step-by-step, why "Left" is the best move. If the computer can't build this specific map using the data it has, the answer is considered suspicious, even if it looks right.

The Experiment: Two Competitors

The authors took two popular versions of this algorithm and put them through the "Witness" test.

1. The Wikipedia Version (NegamaxTTW)

  • How it works: It's a bit cautious. When it sees a sticky note, it checks: "Does this note guarantee I can stop looking right now?" If the note is vague or from a different context, it ignores it and does the full calculation.
  • The Result: Pass. The authors successfully proved with the Dafny machine that this version always produces a valid "Witness." It's safe, reliable, and mathematically sound.

2. The Marsland Version (NegamaxTTM)

  • How it works: This version is more aggressive. When it sees a sticky note saying "The value is at least 3," it immediately shrinks its search window, thinking, "Great, I don't need to look at anything lower than 3!"
  • The Result: Fail. The authors found a specific scenario (a "counterexample") where this aggression backfired.
    • The Trap: The computer saw a note saying "Value is at least 3." It used this to stop looking at a branch that actually contained a value of 1 (which was better for the opponent). Because it stopped looking, it missed the better move and returned a wrong answer.
    • The Proof: The computer could not produce a "Witness" for its answer. It was like a detective claiming to have solved a case but refusing to show the evidence because they stopped looking too early.

Why This Matters

This paper is like a safety inspector for the "black box" of game AI.

  • It shows that formal verification (using math to prove code is correct) is possible even for these complex, optimized algorithms.
  • It reveals that small changes in how an algorithm handles "sticky notes" can lead to big errors.
  • It provides a new standard (the "Witness") for how we should judge if a game AI is actually playing correctly, rather than just getting lucky.

In a nutshell: The authors built a mathematical microscope to inspect game-playing code. They proved one popular method is safe and sound, but they caught another popular method making a subtle, dangerous mistake by trusting its own notes too quickly. This ensures that the AI we play against is playing by the rules of logic, not just guessing.

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 →