General
Material
Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5

Hint

The general strategy for solving this task is to first make sure that the first element of the list (the head) is an 'a'. If that is the case, then you have to deal with the tail of the list. The tail of a list is again a list and you have to make sure that it also is a list which contains only a's as elements (an all_as list) or is empty.

There is also a more declarative way of describing the predicates that you have to define. Ask yourself: what are the properties that an all_as list should have? One possibility is that it is empty. If it is not empty, then its first element should be an a and the tail should be an all_as list.

Solution

Back to the exercise.