Add verified Reversi with alpha-beta AI#7
Open
CharlesCNorton wants to merge 2 commits intobloomberg:pruningfrom
Open
Add verified Reversi with alpha-beta AI#7CharlesCNorton wants to merge 2 commits intobloomberg:pruningfrom
CharlesCNorton wants to merge 2 commits intobloomberg:pruningfrom
Conversation
Board symmetry (reflect, rotate), stable disc majority, certificate type with 7 constructors, fuel-bounded checker, terminal soundness proof. Zero Admitted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Formalizes Reversi (Othello) as a two-player game on an 8×8 board with standard placement and flipping rules, following the same patterns as TicTacToe.v and ConnectFour.v. The complete game tree is defined via well-founded recursion on a lexicographic measure (empty cells × pass count), proving finiteness. Execution uses depth-limited cotree search with alpha-beta pruning from AlphaBeta.v.
Game model
find_flipswalks each direction accumulating opponents until a friendly bookend;all_flipsaggregates across all 8 directionsVerified properties
valid_movesmoves gsatisfiesvalid_movemoves_completevalid_moveappears inmoves gapply_move_lengthplace_decreases_emptyall_flips_occupiedall_flipsis occupied (not empty)all_flips_in_boundsapply_flips_preserves_emptycomplete_tree_soundcomplete_tree_completeat_most_one_winnerget_resultcannot simultaneously return bothwon_by blackandwon_by whiteresult_deterministicget_resultis a function (unique output)reversi_eval_ab_correcteval_ab_co_correcteval_ab_co_minimaxai_subtree_reachablefull_board_no_movesdouble_pass_no_movesExecution
Cotrees.unfold_cotree+tree_of_cotree, rebuilt from current position each AI turneval_ab_cooperates directly on cotrees, avoiding full tree materializationeval_ab players_le_ge, picks optimal moveprint_board, row/col input (0–7)make reversiruns the gameLibrary reuse
tree,unfold_tree,In_tree,root,childrenunfold_cotree,tree_of_cotree,colist_of_list,cotree,colisteval_ab,eval_val,players_le_ge,players_le_ge_strong,players_le_ge_adversarialmax,comparingreachable,stepIO,SimpleIO, extraction setupTest plan
makecompiles all files including Reversi.v (Rocq 9.0)reversi.ml;make reversiruns the interactive game