Lineartime algorithms for testing the satisfiability of propositional Horn formulas