Semantic and Declarative Technologies Course, Assignment 1 – obtaining subgrids without recursion


This page gives some hints on how to obtain sudoku subgrids without having to write recursive predicates.

For handling subgrids the following function may be useful:

For now I just give these hints:

  1. It is possible to write a Prolog program for this task without any recursive predicates, making use of the following helper predicates:

    If you are using SWI Prolog, you can load the transpose from this file, or simply use :- library(clpfd).

  2. It is also possible to solve the task in such a way that chop/3 is called exactly twice.

You may find useful some predicates in SICStus Prolog library(lists), e.g. transpose/2 and sublist/5. In solving this assignment you can freely use predicates from this library.

In SWI Prolog transpose/2 is part of library(clpfd). You can load this library for the purpose of using transpose/2, but no other predicates should be used from library(clpfd). Also, sublist/5 is not available in SWI, you can use list_sub/5 from Homework P4 instead.

Ask the instructors if you would like to use other libraries.

Some predicates you wrote for earlier homework may be re-used here, such as chop/3 from Homework P4, and pairings/2 from Homework P4.

Please send an email if you need further clarification or help.


Last modified by Péter Szeredi, szeredi@cs.bme.hu, on 11.11.2018.