mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 03:15:50 +00:00
checkpoint
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
4722fdfca5
commit
add684d8e9
377 changed files with 204 additions and 62 deletions
49
src/smt/uses_theory.cpp
Normal file
49
src/smt/uses_theory.cpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*++
|
||||
Copyright (c) 2006 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
uses_theory.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
<abstract>
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2008-10-21.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
|
||||
#include"uses_theory.h"
|
||||
#include"for_each_expr.h"
|
||||
|
||||
bool uses_theory(expr * n, family_id fid) {
|
||||
expr_mark visited;
|
||||
return uses_theory(n, fid, visited);
|
||||
}
|
||||
|
||||
namespace uses_theory_ns {
|
||||
struct found {};
|
||||
struct proc {
|
||||
family_id m_fid;
|
||||
proc(family_id fid):m_fid(fid) {}
|
||||
void operator()(var * n) {}
|
||||
void operator()(app * n) { if (n->get_family_id() == m_fid) throw found(); }
|
||||
void operator()(quantifier * n) {}
|
||||
};
|
||||
};
|
||||
|
||||
bool uses_theory(expr * n, family_id fid, expr_mark & visited) {
|
||||
uses_theory_ns::proc p(fid);
|
||||
try {
|
||||
for_each_expr(p, visited, n);
|
||||
}
|
||||
catch (uses_theory_ns::found) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue