Automated reasoning about retrograde chess problems using Coq Marko Maliković, Ph.D. The Faculty of Humanities and Social Sciences University of Rijeka,

Slides:



Advertisements
Similar presentations
CHESS. CONTENTS introdution introdution introdution A Basic Chess Board A Basic Chess Board A Basic Chess Board A Basic Chess Board Openings Openings.
Advertisements

1 State-Space representation and Production Systems Introduction: what is State-space representation? What are the important trade-offs? (E.Rich, Chapt.2)
Chess 101 This tactic is critical in winning, or not losing, in this situation because many endgames come down to kings and pawns being the only pieces.
UIL Chess Puzzle Practice Material
Apostles Chess Club Lesson #4. Algebraic Chess Notation System The board is set up from white’s position. Black must look at the board from the white.
Place captured red pieces below Place captured blue pieces below Rules New Game Exit Left mouse click on piece – drag to desired location - left mouse.
Table of Contents Why Play Chess? Setting Up the Board Get to Know the Pieces Check and Checkmate What the Chess Pieces Are Worth Opening Goals Endgame.
CHESS FOR KIDS Lesson 1.
L.O. Today you will learn how to play chess. How to Play Chess.
Table of Contents The Importance of Chess –Research –Georgia Performance Standard The Players The Battlefield Magical Moves –Castling –Check and Check.
Welcome to the basics of chess. This is a graphically designed program that will help you learn how to play chess. By Amir and Mike, 9B.
Chess Variants (I) (#35) Build a 2-player Chess Game (no-AI) Make it as modular as possible, so that It is easy to adapt to game rule changes (variants)
Chess!!. Pawn How many pieces? 8 Value: Lowest What can it do? Move forward only one space at a time. Attack: Only Diagonally.
Deflection Tactics Chess I
Chapter 7 Multidimensional Arrays. Defining a two dimensional array elementType[][] arrayName; // Java pro elementType arrayName[][]; // C++ alternate.
Introduction to Chess Naming the Chess Squares Names of the Pieces Initial Setup Materials taken from Teaching Chess Step By Step manuals, Books 1 and.
Module 3 Chess 101 Strategy Strategy refers to an overall plan to achieve a goal In every game you play your goal should be to checkmate your opponent,
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
STRUCTURE OF VALUES Game pieces in chess are evaluated from two basic points of view: their weight with regard to a certain situation on the chessboard,
Chess Merit Badge Chess Basics: Set Up the Board & Basic Rules by Joseph L. Bell © 2011.
A Beginners Guide. The Pieces Chess consists of Sixteen pieces eight Pawns two Rooks two Knights two bishops one Queen and one king this guide will show.
Apostles chess club Session 2. Chess pieces are made mostly in the Staunton style. It is the only style accepted by chess tournaments.
Aayush Garg Pecha-Kucha Design Games 10. Games I like Strategy games Mathematical games Paper and Pencil games Street games.
Panther Chess Club Sponsors: –Mr. Sergio Treviño (English, Room 408) –Mr. Felix Esquivel (Criminal Justice, Room 50) Meetings every Monday and Wednesday.
1 Machine Learning: Lecture 11 Analytical Learning / Explanation-Based Learning (Based on Chapter 11 of Mitchell, T., Machine Learning, 1997)
Game Playing. Introduction Why is game playing so interesting from an AI point of view? –Game Playing is harder then common searching The search space.
#2. UIL Chess Puzzle Practice Material This year’s UIL Chess Puzzle Test includes “solve the mate” positions similar to last year’s, but it also tests.
Game Playing.
Naďa Heráková. Chess The classic board game for two players in the form of competition also considered the sport sector. It represents the clash of two.
Apostles Chess Club Session Three. Chess Piece Symbols The symbols shown above are the ones most used when showing chess pieces in print or on the internet.
Database Chess A server-based web gaming application by Jordan Arnold.
Prepared by : Walaa Maqdasawi Razan Jararah Supervised by: Dr. Aladdin Masri.
Problems, Problem Spaces and Search
CSE-490 Logic in Computer Science The Coq Proof Assistant POSTECH Dec 15, 2006 박성우.
Chess Merit Badge Chess Problems by Joseph L. Bell © 2011.
How to Play Chess. Name of Each Piece The relative values of the chess pieces 9 points 5 points 3+ points 3 points 1 point.
Chess By Kezia Farley.
Summary of the Moves of Chess
Lesson 1 History of Chess Why We Teach Chess Goal of Chess.
Chess By Kyle Fischer. What is chess? Chess is a game that you try to get the other person’s king in a checkmate.
Solving Kriegspiel endings with brute force: the case of KR vs. K Paolo Ciancarini Gian Piero Favini University of Bologna.
A game based off of the esteemed classic By: Tadziu Kosiara.
Four important rules of Castling: 1) The King and Rook may not have moved from their starting squares 2) All spaces between the King and Rook must be empty.
Each piece is represented by a symbol. The pieces all stand in the same position at the start of the game the pieces are the Rook, the Knight, the Bishop,
CHESS. Write what you already know about chess on a piece of paper which I will hand out now.
Quoridor and Artificial Intelligence
What is chess???? The game chess has been described as an art, a science and a sport. Almost anyone can learn how to play. Some top chess champions can.
CHESS. Write what you already know about chess on a piece of paper which I will hand out now.
How to play chess? By Mervyn George. The Rules of the Game White always move first White always move first You should always play touch a piece move a.
CHESS 2: Castling and Forking…and a Stalemate A Levoy Power Point.
The Basics Of Chess Student Name: Jovannie Charles Date: 3/25/11.
Every chess master was once a beginner. Irving Chernev
CpSc 810: Machine Learning Analytical learning. 2 Copy Right Notice Most slides in this presentation are adopted from slides of text book and various.
Chess Strategies Component Skills Strategies Prototype Josh Waters, Ty Fenn, Tianyu Chen.
CHESS Basics for Beginners. BOARD SET-UP The letters go across the board in front of you. “White on right!” Each player has a white square in their right.
A Levoy PowerPoint Presentation
CHESS INDUCTION COURSE FORNEWLY APPOINTED PET’S PRESENTATION BY TANDEL NILESH M.(LIBRARIRAN) JAWAHAR NAVODAYA VIDYALAYA, SABARKANTHA ( GUJARAT)
Steps and Vocabulary Martha Rice. You can use the same problem solving methods to solve just about any problem, from word problems to logic problems to.
CHESS “The Ultimate GAME of Challenge and Strategy”
Some counting questions with the Rules of Chess. Chessboard and Chess pieces The game of chess is played on an 8-by-8 grid of alternately colored squares.
Intro to Computer Science II
Ab & Team Presents CHESS “It’s not just a game”.
Ramblewood Middle Chess Club
CHESS PIECES.
How To Play Chess (And other Information)
CHESS.
Chess Basics: Set Up the Board & Basic Rules
Rules to play chess. Chess is a played with 16 pieces: 8 pawns, 2 towers, 2 knights, 2 bishops, 1 queen and 1 king. Movements: Pawns: They only can move.
FOUR PLAYER CHESS.
CS51A David Kauchak Spring 2019
Presentation transcript:

Automated reasoning about retrograde chess problems using Coq Marko Maliković, Ph.D. The Faculty of Humanities and Social Sciences University of Rijeka, CROATIA

Retrograde chess analysis Method that determine which moves: 1. have to be2. could be played leading up to a given chess position

What did Black just play? What was white's move before that? Black did move his King (his only piece) from a7 (only possible square)! a b c d e f g h

What did Black just play? What was white's move before that? Black king was in check by white bishop! How white made the last checking move? Bishop is blocked => Some white piece must have moved to discover the check! a b c d e f g h

What did Black just play? What was white's move before that? White had some piece on a8 which black king captured by last move! a b c d e f g h

What did Black just play? What was white's move before that? Only white piece which can discover the check is white knight! a b c d e f g h

The position two moves before the given position a b c d e f g h Retrograde chess analysis is a matter of deductive reasoning

Retrograde chess move Definition: "If in accordance with the laws of chess, position P n+1 arises from position P n due to the move m of piece p, then the retrograde chess move m 1 of move m is the movement of piece p due to the position P n arising from position P n+1 "

Different types of retrograde chess moves can have very different properties Retrograde promotion with capturing

Basic formal system in Coq M. Maliković. A formal system for automated reasoning about retrograde chess problems using Coq. Proceedings of 19th Central European Conference on Information and Intelligent Systems, 2008, pp Varaždin, Croatia Chess pieces as enumerated inductive type: Inductive pieces : Set := P | B | R | Q | N | K | p | b | r | q | n | k | O | v.

Position Parameter position : nat -> list (list pieces). Hypothesis H_position : position on = (v :: nil) :: (v :: k :: O :: K :: O :: O :: O :: O :: O :: nil) :: (v :: O :: O :: O :: O :: Q :: O :: O :: O :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: O :: nil) :: (v :: O :: O :: B :: O :: P :: O :: O :: O :: nil) :: (v :: O :: O :: O :: P :: O :: O :: O :: O :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: P :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: O :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: B :: nil) :: nil.

Functions for computing check positions Recursive for the bishop, rook and queen Non-recursive for knights and pawns Recursive functions check the content of squares, starting from the closest square of the king in all eight directions

Functions for computing check positions Square is empty -> Check next square!

Functions for computing check positions Square is empty -> Check next square!

Functions for computing check positions Square is engaged with opponent’s bishop => King is in check in direction left-up

Example in Coq: Function for direction left-up Fixpoint check_lu_k (xkb ykb : nat) (pos : list (list pieces)) {struct xkb} : Prop := match xkb with S xkb' => match ykb with S ykb' => match nth ykb' (nth xkb' pos nil) v with O => check_lu_k xkb' ykb' pos | Q => True | B => True | _ => False end | _ => False end | _ => False end.

Functions for computing new position after a retrograde move position on = (v :: nil) :: (v :: k :: O :: K :: O :: O :: O :: O :: O :: nil) :: (v :: O :: O :: O :: O :: Q :: O :: O :: O :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: O :: nil) :: (v :: O :: O :: B :: O :: P :: O :: O :: O :: nil) :: (v :: O :: O :: O :: P :: O :: O :: O :: O :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: P :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: O :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: B :: nil) :: nil. position (S on) = (v :: nil) :: (v :: N :: O :: K :: O :: O :: O :: O :: O :: nil) :: (v :: k :: O :: O :: O :: Q :: O :: O :: O :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: O :: nil) :: (v :: O :: O :: B :: O :: P :: O :: O :: O :: nil) :: (v :: O :: O :: O :: P :: O :: O :: O :: O :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: P :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: O :: nil) :: (v :: O :: O :: O :: O :: O :: O :: O :: B :: nil) :: nil.

Retrograde move Type of retrograde move: Parameter move : nat -> pieces -> nat -> nat -> nat -> nat -> pieces -> type_of_move. Sequences of retrograde moves are stored on the list of moves: H_list_moves : list_moves 2 = moved 0 k N standard_move :: moved 1 A b standard_move :: nil

Generating retrograde moves

M. Maliković; M. Čubrilo. What Were the Last Moves? International Review on Computers and Software (IRECOS), Vol. 5, No. 1, 2010, pp Using Coq’s tactics and Ltac language we create only one Ltac function One_Move We build up tree of retrograde chess moves and positions Every position as well as sequence of moves is stored in separate subgoal Thus, we use Coq’s proof tree as tree of states and actions Our system is automated: – One_Move;One_Move;... – If all subgoals become proven => position is not legal – If only one subgoal remain unproven => it is a solution

Generating retrograde moves - with heuristic solutions obtained by observation - Each retrograde move must satisfy a number of conditions For example, the function One_Move check: – Is the player whose turn it is in check? – Is the player whose turn it isn’t in check? – Determining eventually forced moves e.g. because of the check positions by the pawn or knight – Eliminating the moves of the rook and king if retrograde castling has been already played by these pieces – So-called “imaginary check positions” –...

Purposes of RCA

What were the last 3 moves

Mate in 2 moves! Or: Is white’s en passant capture legal?

Can black castle?

Is position legal?

Shortest proof games SPG’s serve to establish the legality of a position in chess problems by searching for the shortest sequence of moves that lead from initial to given chess position

Formal bases of system for solving SPGs using Coq M. Maliković; M. Čubrilo. Solving Shortest Proof Games by Generating Trajectories using Coq Proof Management System. Proceedings of 21st Central European Conference on Information and Intelligent Systems, 2010, pp Varaždin, Croatia M. Maliković; M. Čubrilo. Formal System for Searching for the Shortest Proof Games using Coq. International Review on Computers and Software (IRECOS), Vol. 5, No. 6, 2010, pp

For given chess position we created recursive functions in Coq for generating: Trajectories - planing paths between two squares which certain pieces might follow to reach the target square

For given chess position we created recursive functions in Coq for generating: Shortest trajectories

For given chess position we created recursive functions in Coq for generating: Admissible trajectories of some degree - defined inductively: – An admissible trajectory of degree 1 is a shortest trajectory – An admissible trajectory of degree k > 1 is a concatenation of an admissible trajectory of degree k-1 and one shortest trajectory

For given chess position we created recursive functions in Coq for generating: Admissible trajectories Admissible trajectory of degree k-1 Shortest trajectory Admissible trajectory of degree k

For given chess position we created recursive functions in Coq for generating: Circular trajectories - trajectory that’s starting and end square coincide Circular trajectories can be generated as admissible trajectories of some degree with same starting and end square

Thank you!