mirror of
https://github.com/Z3Prover/z3
synced 2025-07-18 02:16:40 +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
78
lib/dl_mk_similarity_compressor.h
Normal file
78
lib/dl_mk_similarity_compressor.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*++
|
||||
Copyright (c) 2006 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
dl_mk_similarity_compressor.h
|
||||
|
||||
Abstract:
|
||||
|
||||
<abstract>
|
||||
|
||||
Author:
|
||||
|
||||
Krystof Hoder (t-khoder) 2010-10-22.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#ifndef _DL_MK_SIMILARITY_COMPRESSOR_H_
|
||||
#define _DL_MK_SIMILARITY_COMPRESSOR_H_
|
||||
|
||||
#include<utility>
|
||||
|
||||
#include"map.h"
|
||||
#include"obj_pair_hashtable.h"
|
||||
|
||||
#include"dl_context.h"
|
||||
#include"dl_rule_set.h"
|
||||
#include"dl_rule_transformer.h"
|
||||
|
||||
namespace datalog {
|
||||
|
||||
/**
|
||||
\brief Functor for merging groups of similar rules.
|
||||
|
||||
A rule sequence
|
||||
|
||||
P("1",x):-Q(x).
|
||||
...
|
||||
P("N",x):-Q(x).
|
||||
|
||||
will be replaced by
|
||||
|
||||
P(y,x):-Q(x), Aux(y).
|
||||
|
||||
and a set of facts
|
||||
|
||||
Aux("1").
|
||||
...
|
||||
Aux("N").
|
||||
|
||||
Similar transformation is performed when the varying constant appears in the positive tail.
|
||||
*/
|
||||
class mk_similarity_compressor : public rule_transformer::plugin {
|
||||
|
||||
context & m_context;
|
||||
ast_manager & m_manager;
|
||||
/** number of similar rules necessary for a group to be introduced */
|
||||
unsigned m_threshold_count;
|
||||
rule_vector m_rules;
|
||||
rule_ref_vector m_result_rules;
|
||||
bool m_modified;
|
||||
ast_ref_vector m_pinned;
|
||||
|
||||
void merge_class(rule_vector::iterator first, rule_vector::iterator after_last);
|
||||
void process_class(rule_vector::iterator first, rule_vector::iterator after_last);
|
||||
|
||||
void reset();
|
||||
public:
|
||||
mk_similarity_compressor(context & ctx, unsigned threshold_count);
|
||||
|
||||
rule_set * operator()(rule_set const & source, model_converter_ref& mc, proof_converter_ref& pc);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif /* _DL_MK_SIMILARITY_COMPRESSOR_H_ */
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue