src/tactic/core/dom_simplify_tactic.cpp
/**
   \brief compute a post-order traversal for e.
   Also populate the set of parents
*/
\brief compute a post-order traversal for e.
Also populate the set of parents
\ brief compute a post - order traversal for e . Also populate the set of parents
void expr_dominators::compute_post_order() {
    unsigned post_num = 0;
    SASSERT(m_post2expr.empty());
    SASSERT(m_expr2post.empty());
    ast_mark mark;
    ptr_vector<expr> todo;
    todo.push_back(m_root);
    while (!todo.empty()) {
        expr* e = todo.back();
        if (mark.is_marked(e)) {
            todo.pop_back();
            continue;
        }
        if (is_app(e)) {
            app* a = to_app(e);
            bool done = true;
            for (expr* arg : *a) {
                if (!mark.is_marked(arg)) {
                    todo.push_back(arg);
                    done = false;
                }
            }
            if (done) {
                mark.mark(e, true);
                m_expr2post.insert(e, post_num++);
                m_post2expr.push_back(e);
                todo.pop_back();
                for (expr* arg : *a) {
                    add_edge(m_parents, arg, a);
                }
            }
        }
        else {
            mark.mark(e, true);
            todo.pop_back();
        }
    }
}
void expr_dominators :: compute_post_order ( ) { unsigned post_num = 0 ; SASSERT ( m_post2expr . empty ( ) ) ; SASSERT ( m_expr2post . empty ( ) ) ; ast_mark mark ; ptr_vector < expr > todo ; todo . push_back ( m_root ) ; while ( ! todo . empty ( ) ) { expr * e = todo . back ( ) ; if ( mark . is_marked ( e ) ) { todo . pop_back ( ) ; continue ; } if ( is_app ( e ) ) { app * a = to_app ( e ) ; bool done = true ; for ( expr * arg : * a ) { if ( ! mark . is_marked ( arg ) ) { todo . push_back ( arg ) ; done = false ; } } if ( done ) { mark . mark ( e , true ) ; m_expr2post . insert ( e , post_num ++ ) ; m_post2expr . push_back ( e ) ; todo . pop_back ( ) ; for ( expr * arg : * a ) { add_edge ( m_parents , arg , a ) ; } } } else { mark . mark ( e , true ) ; todo . pop_back ( ) ; } } }
\brief compute a post-order traversal for e.
Also populate the set of parents
\ brief compute a post - order traversal for e . Also populate the set of parents