min
It calculates the minimum value for one ore more positions on an atom, grouping by the other positions.
The syntax is the following:
@post("atomName","min(p1, ..., pn)").
where atomName
is the atom at hand, p1, …, pn
are integers denoting a valid position in atomName (starting from 1).
Example 40
t(1,"b",5).
t(1,"b",1).
t(1,"c",1).
p(X,Y,Z) :- t(X,Y,Z).
@output("p").
@post("p","min(3)").
The expected result is:
` p(1,"b",1). p(1,"c",1). `
Note that the min value is computed according to the lexicographic order over tuples obtained by projecting on the positions in the post-processing annotation.
Example
t(1,"b",1).
t(2,"c",1).
t(1,"a",1).
q(X,Y,Z) :- t(X,Y,Z).
@output("q").
@post("q","min(1,2)").
Then the expected result is ` p(1,"a",1). ` Indeed, all the three tuples (1,"b")
, (2,"c")
and (1,"a")
fall within one group, and (1,"a")
is a minimal tuple among them according to the lexicographic order.