mirror of
https://github.com/Z3Prover/z3
synced 2025-05-09 08:45:47 +00:00
Z3 sources
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
3f9edad676
commit
e9eab22e5c
1186 changed files with 381859 additions and 0 deletions
93
lib/dl_mk_subsumption_checker.h
Normal file
93
lib/dl_mk_subsumption_checker.h
Normal file
|
@ -0,0 +1,93 @@
|
|||
/*++
|
||||
Copyright (c) 2006 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
mk_subsumption_checker.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Rule transformer which checks for subsumption
|
||||
(currently just for subsumption with total relations)
|
||||
|
||||
Author:
|
||||
|
||||
Krystof Hoder (t-khoder) 2011-10-01.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _DL_MK_SUBSUMPTION_CHECKER_H_
|
||||
#define _DL_MK_SUBSUMPTION_CHECKER_H_
|
||||
|
||||
#include "dl_context.h"
|
||||
#include "dl_rule_transformer.h"
|
||||
#include "dl_rule_subsumption_index.h"
|
||||
|
||||
namespace datalog {
|
||||
|
||||
class mk_subsumption_checker : public rule_transformer::plugin {
|
||||
|
||||
|
||||
ast_manager & m;
|
||||
context & m_context;
|
||||
|
||||
rule_ref_vector m_ref_holder;
|
||||
|
||||
func_decl_set m_total_relations;
|
||||
|
||||
/** Map that for each relation contains the rule which implies its totality.
|
||||
If the totality is due to the relation containing all facts, the rule stored
|
||||
here is zero*/
|
||||
obj_map<func_decl, rule *> m_total_relation_defining_rules;
|
||||
|
||||
|
||||
/**
|
||||
Contains heads of rules of shape
|
||||
R(c1,c2,...cN).
|
||||
grouped by their predicate.
|
||||
|
||||
This information helps to improve the results of the
|
||||
scan_for_relations_total_due_to_facts() function.
|
||||
*/
|
||||
obj_map<func_decl, obj_hashtable<app> *> m_ground_unconditional_rule_heads;
|
||||
|
||||
|
||||
bool m_have_new_total_rule;
|
||||
bool m_new_total_relation_discovery_during_transformation;
|
||||
|
||||
bool is_total_rule(const rule * r);
|
||||
|
||||
|
||||
|
||||
/** Function to be called when a new total relation is discovered */
|
||||
void on_discovered_total_relation(func_decl * pred, rule * r);
|
||||
|
||||
void scan_for_total_rules(const rule_set & rules);
|
||||
void scan_for_relations_total_due_to_facts();
|
||||
|
||||
void collect_ground_unconditional_rule_heads(const rule_set & rules);
|
||||
|
||||
/** Return false if rule is unsatisfiable */
|
||||
bool transform_rule(rule * r, rule_subsumption_index& subs_index, rule_ref & res);
|
||||
/** Return false if the rule set hasn't changed */
|
||||
bool transform_rules(const rule_set & orig, rule_set & tgt);
|
||||
public:
|
||||
mk_subsumption_checker(context & ctx, unsigned priority=31000)
|
||||
: plugin(priority),
|
||||
m(ctx.get_manager()),
|
||||
m_context(ctx),
|
||||
m_ref_holder(ctx.get_rule_manager()),
|
||||
m_new_total_relation_discovery_during_transformation(true) {}
|
||||
~mk_subsumption_checker() {
|
||||
reset_dealloc_values(m_ground_unconditional_rule_heads);
|
||||
}
|
||||
|
||||
rule_set * operator()(rule_set const & source, model_converter_ref& mc, proof_converter_ref& pc);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif /* _DL_MK_SUBSUMPTION_CHECKER_H_ */
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue