@@ -24,18 +24,37 @@ assignment = Dict([:a=>true, :b=>false, :c=>false, :d=>true, :e=>false, :f=>fals
2424
2525satisfiable (cnf, assignment)
2626
27- # We can contruct a [`Satisfiability`](@ref) problem to solve the above problem more cleverly.
27+ # ## Tensor network representation
28+ # We can contruct a [`Satisfiability`](@ref) problem to solve the above problem.
29+ # To generate a tensor network, we map a boolean variable ``x`` and its negation ``\neg x`` to a degree of freedom (label) ``s_x \in \{0, 1\}``,
30+ # where 0 stands for variable ``x`` having value `false` while 1 stands for having value `true`.
31+ # Then we map a clause to a tensor. For example, a clause ``¬x ∨ y ∨ ¬z`` can be mapped to a tensor labeled by ``(s_x, s_y, s_z)``.
32+ # ```math
33+ # C = \left(\begin{matrix}
34+ # \left(\begin{matrix}
35+ # x & x \\
36+ # x & x
37+ # \end{matrix}\right) \\
38+ # \left(\begin{matrix}
39+ # x & x \\
40+ # 1 & x
41+ # \end{matrix}\right)
42+ # \end{matrix}\right).
43+ # ```
44+ # There is only one entry ``(s_x, s_y, s_z) = (1, 0, 1)`` that makes this clause unsatisfied.
45+ # If we contract this tensor network, we will get a multiplicative factor ``x`` whenever there is a clause satisfied.
2846
2947problem = Satisfiability (cnf);
3048
31- # ## Satisfiability and its counting
49+ # ## Solving properties
50+ # #### Satisfiability and its counting
3251# The size of a satisfiability problem is defined by the number of satisfiable clauses.
3352num_satisfiable = solve (problem, SizeMax ())[]
3453
3554# The [`GraphPolynomial`](@ref) of a satisfiability problem counts the number of solutions that `k` clauses satisfied.
3655num_satisfiable_count = solve (problem, GraphPolynomial ())[]
3756
38- # ## Find one of the solutions
57+ # #### Find one of the solutions
3958single_config = solve (problem, SingleConfigMax ())[]. c. data
4059
4160# One will see a bit vector printed.
0 commit comments