1#script (python)
2
3from clingo import Control, String, Tuple_
4
5class Values:
6    def __init__(self, values):
7        self.__values = values
8    def get(self):
9        return Tuple_(self.__values)
10
11def ground(prg, solve=False):
12    ctl = Control()
13    ctl.add("base", [], prg)
14    ctl.ground([("base", [])])
15    if solve: ctl.solve()
16    return ctl.is_conflicting
17
18def main(prg):
19    values = []
20    values.append(String(str(ground("a."))))
21    values.append(String(str(ground(":-."))))
22    values.append(String(str(ground("2 { a; b }. :- a, b."))))
23    values.append(String(str(ground("2 { a; b }. :- a, b.", True))))
24
25    prg.ground([("base", [])], Values(values))
26    prg.solve()
27
28#end.
29
30p(X) :- X = @get().
31