1# Compte the well-founded model of a program 2 3This examples computes the well-founded model of a normal logic program. It 4prints true and unknown atoms before solving. Note that it does not print false 5atoms because there are in general infinitely many of them. 6 7Disclaimer: Writing an efficient algorithm to compute the well-founded model is 8actually quite tricky. This example is not very well tested - there might be 9bugs. 10 11## Dependencies 12 13The example needs the clingox and networkx python packages in addition to the 14clingo package. The packages can be installed using: 15 16 python3 -m pip install --user --upgrade --extra-index-url https://test.pypi.org/simple/ clingo-cffi clingox 17 python3 -m pip install --user --upgrade networkx 18 19# Example Calls 20 21 ➜ python well-founded.py example.lp 22 level version 1.0 23 Reading from example.lp 24 Facts: 25 r s 26 Unknown: 27 u v x y 28 Solving... 29 UNSATISFIABLE 30 31 Models : 0 32 Calls : 1 33 Time : 0.001s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s) 34 CPU Time : 0.001s 35