Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Horn-satisfiability
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Algorithm== The problem of Horn satisfiability is solvable in [[linear time]].<ref>{{citation | last1 = Dowling | first1 = William F. | last2 = Gallier | first2 = Jean H. | author2-link = Jean Gallier | doi = 10.1016/0743-1066(84)90014-1 | issue = 3 | journal = Journal of Logic Programming | mr = 770156 | pages = 267–284 | title = Linear-time algorithms for testing the satisfiability of propositional Horn formulae | volume = 1 | year = 1984| doi-access = free }}</ref> A polynomial-time algorithm for Horn satisfiability is [[Recursion (computer science)|recursive]]: * A first termination condition is a formula in which all the clauses currently existing contain negative literals. In this case, all the variables currently in the clauses can be set to false. * A second termination condition is an empty clause. In this case, the formula has no solutions. * In the other cases, the formula contains a positive unit clause <math>l</math>, so we do a [[unit propagation]]: the literal <math>l</math> is set to true, all the clauses containing <math>l</math> are removed, and all clauses containing <math>\neg l</math> have this literal removed. The result is a new Horn formula, so we reiterate. This algorithm also allows determining a truth assignment of satisfiable Horn formulae: all variables contained in a unit clause are set to the value satisfying that unit clause; all other literals are set to false. The resulting assignment is the minimal model of the Horn formula, that is, the assignment having a minimal set of variables assigned to true, where comparison is made using set containment. Using a linear algorithm for unit propagation, the algorithm is linear in the size of the formula. ===Examples=== ====Trivial case==== In the Horn formula :{{math|(¬''a'' ∨ ¬''b'' ∨ ''c'') ∧}} :{{math|(¬''b'' ∨ ¬''c'' ∨ ''d'') ∧}} :{{math|(¬''f'' ∨ ¬''a'' ∨ ''b'') ∧}} :{{math|(¬''e'' ∨ ¬''c'' ∨ ''a'') ∧}} :{{math|(¬''e'' ∨ ''f'') ∧}} :{{math|(¬''d'' ∨ ''e'') ∧}} :{{math|(¬''b'' ∨ ¬''c'')}}, each clause has a negated literal. Therefore, setting each variable to false satisfies all clauses, hence it is a solution. ====Solvable case==== In the Horn formula :{{math|(¬''a'' ∨ ¬''b'' ∨ ''c'') ∧}} :{{math|(¬''b'' ∨ ¬''c'' ∨ ''f'') ∧}} :{{math|(¬''f'' ∨ ''b'') ∧}} :{{math|(¬''e'' ∨ ¬''c'' ∨ ''a'') ∧}} :{{math|(''f'') ∧}} :{{math|(¬''d'' ∨ ''e'') ∧}} :{{math|(¬''b'' ∨ ¬''c'')}}, one clause forces ''f'' to be true. Setting ''f'' to true and simplifying gives :{{math|(¬''a'' ∨ ¬''b'' ∨ ''c'') ∧}} :{{math|(''b'') ∧}} :{{math|(¬''e'' ∨ ¬''c'' ∨ ''a'') ∧}} :{{math|(¬''d'' ∨ ''e'') ∧}} :{{math|(¬''b'' ∨ ¬''c'')}}. Now ''b'' must be true. Simplification gives :{{math|(¬''a'' ∨ ''c'') ∧}} :{{math|(¬''e'' ∨ ¬''c'' ∨ ''a'') ∧}} :{{math|(¬''d'' ∨ ''e'') ∧}} :{{math|(¬''c'')}}. Now it is a trivial case, so the remaining variables can all be set to false. Thus, a satisfying assignment is :{{math|1=''a'' = false}}, :{{math|1=''b'' = true}}, :{{math|1=''c'' = false}}, :{{math|1=''d'' = false}}, :{{math|1=''e'' = false}}, :{{math|1=''f'' = true}}. ====Unsolvable case==== In the Horn formula :{{math|(¬''a'' ∨ ¬''b'' ∨ ''c'') ∧}} :{{math|(¬''b'' ∨ ¬''c'' ∨ ''f'') ∧}} :{{math|(¬''f'' ∨ ''b'') ∧}} :{{math|(¬''e'' ∨ ¬''c'' ∨ ''a'') ∧}} :{{math|(''f'') ∧}} :{{math|(¬''d'' ∨ ''e'') ∧}} :{{math|(¬''b'')}}, one clause forces ''f'' to be true. Subsequent simplification gives :{{math|(¬''a'' ∨ ¬''b'' ∨ ''c'') ∧}} :{{math|(''b'') ∧}} :{{math|(¬''e'' ∨ ¬''c'' ∨ ''a'') ∧}} :{{math|(¬''d'' ∨ ''e'') ∧}} :{{math|(¬''b'')}}. Now ''b'' has to be true. Simplification gives :{{math|(¬''a'' ∨ ''c'') ∧}} :{{math|(¬''e'' ∨ ¬''c'' ∨ ''a'') ∧}} :{{math|(¬''d'' ∨ ''e'') ∧}} :{{math|()}}. We obtained an empty clause, hence the formula is unsatisfiable.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)