proving correctness of a krk chess endgame strategy by
play

Proving Correctness of a KRK Chess Endgame Strategy by SAT-based - PowerPoint PPT Presentation

Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratkos Strategy for KRK URSA Specification of KRK Endgame and of Strategy Correctness of Strategy Discussion and Conclusions Proving Correctness of a KRK Chess


  1. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK URSA Specification of KRK Endgame and of Strategy Correctness of Strategy Discussion and Conclusions Proving Correctness of a KRK Chess Endgame Strategy by SAT-based Constraint Solving Marko Malikovi´ c, University of Rijeka, Croatia Predrag Janiˇ ci´ c, University of Belgrade, Serbia COST IC0901 Meeting — SVARM 2013 Madrid, Spain, October 17-18, 2013. Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  2. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Introduction URSA Specification of KRK Endgame and of Strategy Overview Correctness of Strategy Discussion and Conclusions Introduction Within COST Action IC0901: a number of SAT-based systems and applications To be presented: application of SAT in chess, using the URSA system Marko Malikovi´ c, Predrag Janiˇ ci´ c: Proving Correctness of a KRK Chess Endgame Strategy by SAT-based Constraint Solving. ICGA Journal (International Computer Games Association), 36(2) (2013). Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  3. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Introduction URSA Specification of KRK Endgame and of Strategy Overview Correctness of Strategy Discussion and Conclusions Overview Reduction to SAT and URSA system Chess endgame strategies and Bratko’s strategy for KRK URSA specification of KRK and the strategy Correctness of the strategy Discussion and conclusions Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  4. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Reduction to SAT URSA Specification of KRK Endgame and of Strategy URSA System Correctness of Strategy Discussion and Conclusions Reduction to SAT Wide range of applications: planning, scheduling, operations research, combinatorial optimization, software and hardware verification SAT solvers — ,,Swiss army knife“ ,,Efficient SAT solving is a key technology for 21st century computer science.” (Clarke) Most often reduction to SAT is performed by ad-hoc tools Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  5. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Reduction to SAT URSA Specification of KRK Endgame and of Strategy URSA System Correctness of Strategy Discussion and Conclusions Example: Eigth Queens Different encodings can be used For instance: p ij is true iff there is a queen on ( i , j ) Or: v i is a row of the queen in i -th column (represented by three bits) Or: ... Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  6. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Reduction to SAT URSA Specification of KRK Endgame and of Strategy URSA System Correctness of Strategy Discussion and Conclusions Overview of URSA U niform R eduction to SA t Stand-alone, implemented in C++, open-source C-like specification language Unknowns are represented by bit-vectors Symbolic execution of specifications Constraints translated to SAT instances Models give solutions of the constraints Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  7. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Reduction to SAT URSA Specification of KRK Endgame and of Strategy URSA System Correctness of Strategy Discussion and Conclusions URSA: Example specification (Seed) Linear congruential pseudorandom number generator: nX = nSeed; for(nI = 0; nI < 100; nI++) nX = 1664525 * nX + 1013904223; assert(nX==123); Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  8. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Reduction to SAT URSA Specification of KRK Endgame and of Strategy URSA System Correctness of Strategy Discussion and Conclusions URSA: Properties Theorem: If the variables v 1 , v 2 , . . . , v n are (the only) unknowns in an URSA specification S ; assert ( b );, then it leads to a solution ( v 1 , v 2 , . . . , v n ) = ( c 1 , c 2 , . . . , c n ), iff � v 1 = c 1 ; v 2 = c 2 ; . . . ; v n = c n ; S ; assert ( b ) , s ∅ � �→ � skip , s � where s ( b ) is true . Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  9. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Reduction to SAT URSA Specification of KRK Endgame and of Strategy URSA System Correctness of Strategy Discussion and Conclusions Eight Queens Example nDim=8; bDomain = true; bNoCapture = true; for(ni=0; ni<nDim; ni++) { bDomain &&= (n[ni]<nDim); for(nj=0; nj<nDim; nj++) if(ni!=nj) { bNoCapture &&= (n[ni]!=n[nj]); bNoCapture &&= (ni+n[nj]!=nj+ n[ni]) && (ni+n[ni] != nj+n[nj]); } } assert(bDomain && bNoCapture); Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  10. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Chess Endgame Strategies URSA Specification of KRK Endgame and of Strategy Bratko’s Strategy for KRK Correctness of Strategy Discussion and Conclusions Chess Endgame Strategies Different from midgame computer strategies Different from lookup tables approach Should be concise and intuitive and useful both for computers and humans Endgame strategies do not need to ensure optimal moves Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  11. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Chess Endgame Strategies URSA Specification of KRK Endgame and of Strategy Bratko’s Strategy for KRK Correctness of Strategy Discussion and Conclusions (Simplified) Bratko’s Strategy for KRK (for White) Mate: If possible, mate black in two moves; Squeeze: Otherwise, if possible, further constrain the area to which the black king is confined by the white rook Approach: Otherwise, if possible, move the king closer to the black king KeepRoom: Otherwise, if possible, maintain the present achievements in the sense of Squeeze and Approach Divide: Otherwise, if possible, obtain a position in which the rook divides the two kings vertically or horizontally. Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  12. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Chess Endgame Strategies URSA Specification of KRK Endgame and of Strategy Bratko’s Strategy for KRK Correctness of Strategy Discussion and Conclusions Modified Bratko’s Strategy for KRK – No Search Instead of Mate : ImmediateMate: If there is such, play a mating move; ReadyToMate: If the above is not possible, then play a move that leads to the ,,ready to mate position” Instead of Divide : RookHome: Otherwise, if possible, move the rook to be safe and horizontally or vertically adjacent to the white king RookSafe: Otherwise, if possible, move the rook to be safe and on some edge Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  13. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Chess Endgame Strategies URSA Specification of KRK Endgame and of Strategy Bratko’s Strategy for KRK Correctness of Strategy Discussion and Conclusions Basic Ideas of the Strategy Reducing ,,room“ / ready for mate Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

  14. Introduction Reduction to SAT and URSA system Chess Endgame Strategies and Bratko’s Strategy for KRK Chess Endgame Strategies URSA Specification of KRK Endgame and of Strategy Bratko’s Strategy for KRK Correctness of Strategy Discussion and Conclusions Strategy Performance The strategy is not optimal: 22000 optimal play 20000 play by strategy 18000 16000 14000 12000 10000 8000 6000 4000 2000 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 The number of positions with certain number of moves to win Marko Malikovi´ c and Predrag Janiˇ ci´ c Proving Correctness of a KRK Chess Endgame Strategy

Recommend


More recommend