Hi Boning
Thanks for the question.
The README.md explains CNFs, and there it says that a literal is a Boolean variable or its negation.
Also, z.Lit is a type representing a literal. The godoc for the package reads:
"""
Variables and literals are represented as uint32s. The LSB indicates for a literal whether or not it is the negation of a variable.
"""
which gives a low level way of creating variables and literals: eg z.Var(2).Pos() == z.Lit(4) && z.Var(2).Neg() == z.Lit(5).
But this is not very useful by itself, of course one wants to create formulas and solve them.
There are 2 main interfaces to constructing formulas to solve. One is in CNF, using Add(). Gini.Add()'s docs give an example of adding a clause. (You can also construct a CNF formula for a solver in dimacs format using gini.NewDimacs). So one can add all the clauses one likes and the call Solve() if your formula is in CNF.
The other interface is a circuit represented in gini/logic.C. here is one example in the docs for an equivalence check on a circuit. Using circuits
makes it easy to construct arbitrary form formulas. Solving circuits requires using assumptions, as in the example. I recommend using circuits unless you already have formulas in CNF.
Finally, the gini/gen package gives examples of pigeon hole principle problems and similar.
The
docs for the Solve() and GoSolve() methods of the solver should be clear.
I hope this helps, and please do feel free to ask any other questions or raise an issue requesting features or documentation or anything else you feel would improve the interface.
Scott