z3 / src / muz_qe / dl_mk_coalesce.h

/*++
Copyright (c) 2012 Microsoft Corporation

Module Name:

    dl_mk_coalesce.h

Abstract:

    Coalesce rules with shared bodies.

Author:

    Nikolaj Bjorner (nbjorner) 2012-10-15

Revision History:

--*/
#ifndef _DL_MK_COALESCE_H_
#define _DL_MK_COALESCE_H_

#include"dl_context.h"
#include"dl_rule_set.h"
#include"uint_set.h"
#include"dl_rule_transformer.h"
#include"dl_mk_rule_inliner.h"

namespace datalog {

    /**
       \brief Implements an unfolding transformation.
    */
    class mk_coalesce : public rule_transformer::plugin {
        context&        m_ctx;
        ast_manager&    m;
        rule_manager&   rm;
        expr_ref_vector m_sub1, m_sub2;
        unsigned        m_idx;
        replace_proof_converter* m_pc;

        void mk_pred(app_ref& pred, app* p1, app* p2);

        void extract_conjs(expr_ref_vector const& sub, rule const& rl, expr_ref& result);

        bool same_body(rule const& r1, rule const& r2) const;

        void merge_rules(rule_ref& tgt, rule const& src);

    public:
        /**
           \brief Create coalesced rules.
         */
        mk_coalesce(context & ctx);
        
        rule_set * operator()(rule_set const & source, model_converter_ref& mc, proof_converter_ref& pc);
    };

};

#endif /* _DL_MK_COALESCE_H_ */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.