File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -318,6 +318,22 @@ Definition score (g : game) : nat :=
318318 | ongoing => 1
319319 end .
320320
321+ (* The minimax value of tic-tac-toe is 1 (a draw).
322+ This means the maximizer (X) can guarantee at least a draw,
323+ and the minimizer (O) can guarantee at most a draw.
324+ Combined with [eval_ab_correct], this proves the AI is unbeatable:
325+ it computes exact minimax via alpha-beta on the complete game tree,
326+ so it always plays optimally and never loses.
327+
328+ We evaluate on [complete_tree_again] (the cotree-based construction)
329+ because [complete_tree] uses well-founded [Acc] recursion that
330+ does not reduce under [vm_compute]. Both represent the same
331+ complete game tree — [ttt_is_finite] proves the cotree stabilises
332+ at depth 10. *)
333+ Theorem ttt_minimax_draw :
334+ eval_ab players_le_ge score (fun _ => false) complete_tree_again = 1.
335+ Proof . vm_compute. reflexivity. Qed .
336+
321337(* Score children on-the-fly using alpha-beta pruning
322338 instead of pre-computing the entire scored tree. *)
323339
You can’t perform that action at this time.
0 commit comments