99#include < util/substitute_symbols.h>
1010#include < util/format_expr.h>
1111
12- /*
13- * Traverses the clauses in order and resolving all predicates (symbols)
14- * that are not a head (e.g. a head of a loop).
12+ /* *
13+ * Traverses the clauses in order (wto) and resolving all predicates (symbols)
14+ * that are not a head of a component (e.g. a head of a loop).
1515 * This is similar to variable elimination in SAT.
1616 */
1717class resolution_visitort : public wto_element_visitort
@@ -38,15 +38,19 @@ class resolution_visitort : public wto_element_visitort
3838 {
3939 const symbol_exprt* head = comp.head ();
4040 m_heads.insert (head->hash ());
41- std::string str = head->get_identifier ().c_str ();
42- std::cout << " Head: " << str << " \n " ;
41+ if (m_verbose)
42+ {
43+ std::string str = head->get_identifier ().c_str ();
44+ std::cout << " Head: " << str << " \n " ;
45+ }
4346 for (auto it = comp.begin (); it != comp.end (); it++)
4447 {
4548 it->get ()->accept (this );
4649 }
4750 eliminate (head);
4851 }
4952
53+ // Create the new CHC db after eliminating uninterpreted predicates.
5054 void populate_new_db ()
5155 {
5256 std::vector<symbol_exprt> rels;
@@ -131,6 +135,13 @@ class resolution_visitort : public wto_element_visitort
131135 }
132136 }
133137
138+ /* * Assuming the following shapes:
139+ * c1 := Sxx(ς) ∧ ς(COND1) ⇒ Syy(ς[update1])
140+ * c2 := Syy(ς) ∧ ς(COND2) ⇒ Szz(ς[update2])
141+ * In this case, Syy(ς) is eliminated and we use substitution for c2 such
142+ * that it "operates" over ς[update1]. This results in:
143+ * Sxx(ς) ∧ ς(COND1) ∧ ς[update1](COND2) ⇒ Szz(ς[update1][update2])
144+ */
134145 forall_exprt resolve_clauses (const horn_clauset & c1, const horn_clauset & c2)
135146 {
136147 const exprt &body1 = *c1.body ();
0 commit comments