Hi everyone, can someone help me with this question please :

The empty binary tree will be represented by the abvide constant symbol.

A non-empty binary tree will be of the form ab (label, left_sub_tree, right_sub_tree).

Defining the flattened predicate / 2 which is such that flattened (A, L) is true if the list L is the set of labels of a binary tree A. (The order of the elements in the list L is irrelevant.)

Example: flattened (ab (a, ab (1, abvide, ab (a, abvide, abvide)), abvide), [a, 1, a]) is true.