本文整理汇总了C++中bvt::end方法的典型用法代码示例。如果您正苦于以下问题:C++ bvt::end方法的具体用法?C++ bvt::end怎么用?C++ bvt::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bvt
的用法示例。
在下文中一共展示了bvt::end方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lcnf
void cvc_propt::lcnf(const bvt &bv)
{
if(bv.empty()) return;
bvt new_bv;
std::set<literalt> s;
new_bv.reserve(bv.size());
for(bvt::const_iterator it=bv.begin(); it!=bv.end(); it++)
{
if(s.insert(*it).second)
new_bv.push_back(*it);
if(s.find(lnot(*it))!=s.end())
return; // clause satisfied
assert(it->var_no()<_no_variables);
}
assert(!new_bv.empty());
out << "%% lcnf" << std::endl;
out << "ASSERT ";
for(bvt::const_iterator it=new_bv.begin(); it!=new_bv.end(); it++)
{
if(it!=new_bv.begin()) out << " OR ";
out << cvc_literal(*it);
}
out << ";" << std::endl << std::endl;
}
示例2: lcnf
void dplib_propt::lcnf(const bvt &bv)
{
if(bv.empty())
return;
bvt new_bv;
std::set<literalt> s;
new_bv.reserve(bv.size());
for(bvt::const_iterator it=bv.begin(); it!=bv.end(); it++)
{
if(s.insert(*it).second)
new_bv.push_back(*it);
if(s.find(!*it)!=s.end())
return; // clause satisfied
assert(it->var_no()<=_no_variables);
}
assert(!new_bv.empty());
out << "// lcnf\n";
out << "AXIOM ";
for(bvt::const_iterator it=new_bv.begin(); it!=new_bv.end(); it++)
{
if(it!=new_bv.begin())
out << " | ";
out << dplib_literal(*it);
}
out << ";\n\n";
}
示例3:
void z3_propt::eliminate_duplicates(const bvt &bv, bvt &dest)
{
std::set<literalt> s;
dest.reserve(bv.size());
for(bvt::const_iterator it=bv.begin(); it!=bv.end(); it++)
{
if(s.insert(*it).second)
dest.push_back(*it);
}
}
示例4: assert
bool z3_propt::process_clause(const bvt &bv, bvt &dest)
{
dest.clear();
// empty clause! this is UNSAT
if(bv.empty()) return false;
std::set<literalt> s;
dest.reserve(bv.size());
for(bvt::const_iterator it=bv.begin();
it!=bv.end();
it++)
{
literalt l=*it;
// we never use index 0
assert(l.var_no()!=0);
if(l.is_true())
return true; // clause satisfied
if(l.is_false())
continue;
if(l.var_no()>=_no_variables)
std::cout << "l.var_no()=" << l.var_no() << " _no_variables=" << _no_variables << std::endl;
assert(l.var_no()<_no_variables);
// prevent duplicate literals
if(s.insert(l).second)
dest.push_back(l);
if(s.find(lnot(l))!=s.end())
return true; // clause satisfied
}
return false;
}
示例5: if
void smt1_propt::lcnf(const bvt &bv)
{
out << std::endl;
out << ":assumption ; lcnf" << std::endl;
out << " ";
if(bv.empty())
out << "false ; the empty clause";
else if(bv.size()==1)
out << smt1_literal(bv.front());
else
{
out << "(or";
for(bvt::const_iterator it=bv.begin(); it!=bv.end(); it++)
out << " " << smt1_literal(*it);
out << ")";
}
out << std::endl;
}
示例6: type_conversion
bool boolbvt::type_conversion(
const typet &src_type, const bvt &src,
const typet &dest_type, bvt &dest)
{
bvtypet dest_bvtype=get_bvtype(dest_type);
bvtypet src_bvtype=get_bvtype(src_type);
if(src_bvtype==IS_C_BIT_FIELD)
return type_conversion(
c_bit_field_replacement_type(to_c_bit_field_type(src_type), ns), src, dest_type, dest);
if(dest_bvtype==IS_C_BIT_FIELD)
return type_conversion(
src_type, src, c_bit_field_replacement_type(to_c_bit_field_type(dest_type), ns), dest);
std::size_t src_width=src.size();
std::size_t dest_width=boolbv_width(dest_type);
if(dest_width==0 || src_width==0)
return true;
dest.clear();
dest.reserve(dest_width);
if(dest_type.id()==ID_complex)
{
if(src_type==dest_type.subtype())
{
forall_literals(it, src)
dest.push_back(*it);
// pad with zeros
for(std::size_t i=src.size(); i<dest_width; i++)
dest.push_back(const_literal(false));
return false;
}
else if(src_type.id()==ID_complex)
{
// recursively do both halfs
bvt lower, upper, lower_res, upper_res;
lower.assign(src.begin(), src.begin()+src.size()/2);
upper.assign(src.begin()+src.size()/2, src.end());
type_conversion(ns.follow(src_type.subtype()), lower, ns.follow(dest_type.subtype()), lower_res);
type_conversion(ns.follow(src_type.subtype()), upper, ns.follow(dest_type.subtype()), upper_res);
assert(lower_res.size()+upper_res.size()==dest_width);
dest=lower_res;
dest.insert(dest.end(), upper_res.begin(), upper_res.end());
return false;
}
}
if(src_type.id()==ID_complex)
{
assert(dest_type.id()!=ID_complex);
if(dest_type.id()==ID_signedbv ||
dest_type.id()==ID_unsignedbv ||
dest_type.id()==ID_floatbv ||
dest_type.id()==ID_fixedbv ||
dest_type.id()==ID_c_enum ||
dest_type.id()==ID_c_enum_tag ||
dest_type.id()==ID_bool)
{
// A cast from complex x to real T
// is (T) __real__ x.
bvt tmp_src(src);
tmp_src.resize(src.size()/2); // cut off imag part
return type_conversion(src_type.subtype(), tmp_src, dest_type, dest);
}
}
switch(dest_bvtype)
{
case IS_RANGE:
if(src_bvtype==IS_UNSIGNED ||
src_bvtype==IS_SIGNED ||
src_bvtype==IS_C_BOOL)
{
mp_integer dest_from=to_range_type(dest_type).get_from();
if(dest_from==0)
{
// do zero extension
dest.resize(dest_width);
for(std::size_t i=0; i<dest.size(); i++)
dest[i]=(i<src.size()?src[i]:const_literal(false));
return false;
}
}
else if(src_bvtype==IS_RANGE) // range to range
{
mp_integer src_from=to_range_type(src_type).get_from();
mp_integer dest_from=to_range_type(dest_type).get_from();
if(dest_from==src_from)
{
// do zero extension, if needed
dest=bv_utils.zero_extension(src, dest_width);
return false;
//.........这里部分代码省略.........