A close relative of mine teaches Maths to school students in different Grades. During a casual chat some time ago, he mentioned that he was trying to adopt an automated approach to selecting assignment problems based on each student’s performance so far. Obviously, there are many ways in which this can be done, but he outlined one approach that he felt would be effective for him.

The basic idea is to come up with a hierarchy of “Concepts” (or core Topics) in Mathematics, and associate one such concept with each problem given to the students to solve. The hierarchy models “depends on” relationship showing how a concept “depends on” one or more other concepts. Thus, each problem attempted by a student would be directly or indirectly associated with one or more concepts. When students submit their assigments or exam papers, depending on the correct/incorrect answers, it is possible to automatically infer which concepts need strengthening, and accordingly, which problems they should practise in future. A practical approach indeed.

Of course, the challenge here is to come up with a Concept hierarchy (in theory, multiple hierarchies are possible) and design problems to map to these concepts. This requires serious effort.

In this article, I will show how this problem can be modelled in Prolog. Of course, I have simplified the model to convey the core idea instead of getting bogged down in too much of detail.

Here is a simple (and partial) hierarchy:

The arrows depict “depends on” relationship. Thus, for example,  in order to understand the concept of “Triangle”, one must be familiar with the concepts of “Straight Line” and “Pythogoras Theorem”.

As I hinted before, this specific hierarchy might be debatable, but in general, an acceptable hierarchy can be arrived at.

How do we represent this model in Prolog? Here is what I have done:

The first part in the above diagram captures the concepts hierarchy. The second part assumes the existence of different problems, each mapping directly to exactly one concept. For example, the problems “square-pblm1” and “square-pblm2” both test the concept of “square”.

The following Prolog predicates show the core reasoning logic:

Consider the notion of a particular student being weak in a concept. This is how we represent it in Prolog:

A Student S is weak in a Concept C if:

a) There is a problem P that tests the concept C and S has solved P incorrectly

(OR)

b) The student S is known to be weak in a concept C1 and the concept C depends on knowing concept C1

I hope you get the idea. The other predicates work similarly.

How can we recommend a set of problems for a student based on what he has solved so far? That and related logic is shown below:

I am sure you can understand the code above.

After I completed the simple Prolog model, I decided to build a C#-based Win Forms application that can interact with the Prolog engine and provide a convenient UI to show how this works.

Here is one screenshot from the application:

Here, a student by name “Diana” has solved the “statistics-pblm” correctly, but not the “probability-pblm”. Based on this, the system concludes that Diana is strong in “Statistics”, but is weak in “Probability” and “Bayes Theorem”, and suggests the student to solve “bayestheorem-pblm”. The reason why the system infers that “Diana” is weak in “Bayes Theorem” is because the latter depends on “Probability” and “Diana” is known to be weak in this topic.

Here is another example:

In the above case, “Square” is considered a weak concept for the student because, out of the two problems that exercise this concept, he got one right and the other wrong.

I hope you can understand the approach I have taken to construct this model. To implement the idea completely requires considerable effort, but I am sure it is worth it.

You can download my Prolog code from here. I used Sicstus Prolog 4.5.1 to implement the above.

Have a nice weekend!