The Logic of Sudoku