mirror of
https://github.com/Z3Prover/z3
synced 2025-06-06 22:23:22 +00:00
Improved collect-statistics tactic
This commit is contained in:
parent
da34de340d
commit
943dc8118a
1 changed files with 26 additions and 14 deletions
|
@ -101,8 +101,9 @@ protected:
|
||||||
stats_type & m_stats;
|
stats_type & m_stats;
|
||||||
obj_hashtable<sort> m_seen_sorts;
|
obj_hashtable<sort> m_seen_sorts;
|
||||||
obj_hashtable<func_decl> m_seen_func_decls;
|
obj_hashtable<func_decl> m_seen_func_decls;
|
||||||
|
unsigned m_qdepth;
|
||||||
|
|
||||||
collect_proc(ast_manager & m, stats_type & s) : m(m), m_stats(s) {}
|
collect_proc(ast_manager & m, stats_type & s) : m(m), m_stats(s), m_qdepth(0) {}
|
||||||
|
|
||||||
void operator()(var * v) {
|
void operator()(var * v) {
|
||||||
m_stats["bound-variables"]++;
|
m_stats["bound-variables"]++;
|
||||||
|
@ -113,7 +114,18 @@ protected:
|
||||||
m_stats["quantifiers"]++;
|
m_stats["quantifiers"]++;
|
||||||
SASSERT(is_app(q->get_expr()));
|
SASSERT(is_app(q->get_expr()));
|
||||||
app * body = to_app(q->get_expr());
|
app * body = to_app(q->get_expr());
|
||||||
|
if (q->is_forall())
|
||||||
|
m_stats["forall-variables"] += q->get_num_decls();
|
||||||
|
else
|
||||||
|
m_stats["exists-variables"] += q->get_num_decls();
|
||||||
|
m_stats["patterns"] += q->get_num_patterns();
|
||||||
|
m_stats["no-patterns"] += q->get_num_no_patterns();
|
||||||
|
m_qdepth++;
|
||||||
|
if (m_stats.find("max-quantification-depth") == m_stats.end() ||
|
||||||
|
m_stats["max-quantification-depth"] < m_qdepth)
|
||||||
|
m_stats["max-quantification-depth"] = m_qdepth;
|
||||||
this->operator()(body);
|
this->operator()(body);
|
||||||
|
m_qdepth--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(app * n) {
|
void operator()(app * n) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue