This repository accompanies our submission to the Dafny Workshop at POPL 2026. It presents a formal verification study of game-tree search algorithms in Dafny. We introduce a witness-based correctness criterion for depth-limited search with transposition tables, and verify a representative family of minimax and negamax variants against this criterion. The repository also includes corresponding Python implementations to support experimentation and empirical testing. See also the extended arXiv version of our paper.
Contains formally verified Dafny implementations of minimax and negamax algorithms, including depth-limited and transposition-table-enhanced variants. These are verified using Dafny 4.10.0.
Key files and classes:
minimax.dfy:Minimaxminimax-alpha-beta.dfy:MinimaxABKnuth1975AlgorithmMinimaxFishburn1983AlgorithmMinimaxABWiki2025Algorithm
negamax.dfy:NegamaxAlgorithmnegamax-alpha-beta.dfy:NegamaxKnuth1975AlgorithmNegamaxFishburn1983AlgorithmNegamaxABWikipedia2025Algorithm,NegamaxWikipedia2025'Algorithm
negamax-depth-limited.dfy:NegamaxDepthLimitedAlgorithmNegamaxAlphaBetaDepthLimitedAlgorithmNegamaxPVSAlgorithm
negamax-ttw.dfy:NegamaxTTWnegamax-ttw-current-alpha.dfy:NegamaxTTWCurrentAlphanegamax-ttw-fishburn-propagation.dfy:NegamaxTTWFishburnPropagationlemmas.dfy,definitions.dfy: Common definitions and supporting lemmas
Provides executable implementations and randomized testing for all verified algorithms. Also includes tools for tree construction, visualization, and correctness checking.
Key files:
definitions.py: Core algorithm definitions and correctness predicatesminimax.py: Classic and alpha-beta minimax variantsnegamax.py: Classic, alpha-beta, depth-limited, and transposition table negamax variantsminimax_plaat.py: Plaat-style transposition table versionnegamax-ttm-counter-example.py: Counterexample for a Marsland-style variant that violates the witness-based criteriongame_trees.py: Utilities to construct, parse, print, and visualize game treestest_minimax.py: Randomized testing and correctness checkslogger.py,utilities.py: Supporting infrastructure
- ✅ Witness-based correctness: A natural and rigorous correctness notion for transposition table search
- ✅ Formal verification: Over 15 variants verified in Dafny
- ✅ Executable Python code: Validated against randomized game trees