本文整理汇总了C++中prop_convt::convert方法的典型用法代码示例。如果您正苦于以下问题:C++ prop_convt::convert方法的具体用法?C++ prop_convt::convert怎么用?C++ prop_convt::convert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prop_convt
的用法示例。
在下文中一共展示了prop_convt::convert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convert_assertions
void symex_target_equationt::convert_assertions(
prop_convt &prop_conv)
{
// we find out if there is only _one_ assertion,
// which allows for a simpler formula
unsigned number_of_assertions=count_assertions();
if(number_of_assertions==0)
return;
if(number_of_assertions==1)
{
for(SSA_stepst::iterator it=SSA_steps.begin();
it!=SSA_steps.end(); it++)
if(it->is_assert())
{
prop_conv.set_to_false(it->cond_expr);
it->cond_literal=prop_conv.convert(it->cond_expr);
return; // prevent further assumptions!
}
else if(it->is_assume())
prop_conv.set_to_true(it->cond_expr);
assert(false); // unreachable
}
bvt bv;
bv.reserve(number_of_assertions);
literalt assumption_literal=const_literal(true);
for(SSA_stepst::iterator it=SSA_steps.begin();
it!=SSA_steps.end(); it++)
if(it->is_assert())
{
// do the expression
literalt tmp_literal=prop_conv.convert(it->cond_expr);
it->cond_literal=prop_conv.prop.limplies(assumption_literal, tmp_literal);
bv.push_back(prop_conv.prop.lnot(it->cond_literal));
}
else if(it->is_assume())
assumption_literal=
prop_conv.prop.land(assumption_literal, it->cond_literal);
if(!bv.empty())
prop_conv.prop.lcnf(bv);
}
示例2: convert_guards
void symex_target_equationt::convert_guards(
prop_convt &prop_conv)
{
for(auto & it : SSA_steps)
{
if(it.ignore)
it.guard_literal=const_literal(false);
else
it.guard_literal=prop_conv.convert(it.guard);
}
}
示例3: make_pos
literalt make_pos(
const namespacet &ns,
prop_convt &conv,
const exprt &expr)
{
exprt tmp_expr(expr);
literalt l=conv.convert(tmp_expr);
literalt tmp_lit=conv.prop.new_variable();
conv.prop.set_equal(tmp_lit, l);
assert(!tmp_lit.sign());
return tmp_lit;
}
示例4: convert_decls
void symex_target_equationt::convert_decls(
prop_convt &prop_conv) const
{
for(const auto & it : SSA_steps)
{
if(it.is_decl() && !it.ignore)
{
// The result is not used, these have no impact on
// the satisfiability of the formula.
prop_conv.convert(it.cond_expr);
}
}
}
示例5: convert_goto_instructions
void symex_target_equationt::convert_goto_instructions(
prop_convt &prop_conv)
{
for(auto & it : SSA_steps)
{
if(it.is_goto())
{
if(it.ignore)
it.cond_literal=const_literal(true);
else
it.cond_literal=prop_conv.convert(it.cond_expr);
}
}
}
示例6: convert_assumptions
void symex_target_equationt::convert_assumptions(
prop_convt &prop_conv)
{
for(SSA_stepst::iterator it=SSA_steps.begin();
it!=SSA_steps.end(); it++)
{
if(it->is_assume())
{
if(it->ignore)
it->cond_literal=const_literal(true);
else
it->cond_literal=prop_conv.convert(it->cond_expr);
}
}
}
示例7: convert_assertions
void symex_target_equationt::convert_assertions(
prop_convt &prop_conv)
{
// we find out if there is only _one_ assertion,
// which allows for a simpler formula
unsigned number_of_assertions=count_assertions();
if(number_of_assertions==0)
return;
if(number_of_assertions==1)
{
for(auto & it : SSA_steps)
{
if(it.is_assert())
{
prop_conv.set_to_false(it.cond_expr);
it.cond_literal=const_literal(false);
return; // prevent further assumptions!
}
else if(it.is_assume())
prop_conv.set_to_true(it.cond_expr);
}
assert(false); // unreachable
}
// We do (NOT a1) OR (NOT a2) ...
// where the a's are the assertions
or_exprt::operandst disjuncts;
disjuncts.reserve(number_of_assertions);
exprt assumption=true_exprt();
for(auto & it : SSA_steps)
{
if(it.is_assert())
{
implies_exprt implication(
assumption,
it.cond_expr);
// do the conversion
it.cond_literal=prop_conv.convert(implication);
// store disjunct
disjuncts.push_back(literal_exprt(!it.cond_literal));
}
else if(it.is_assume())
{
// the assumptions have been converted before
// avoid deep nesting of ID_and expressions
if(assumption.id()==ID_and)
assumption.copy_to_operands(literal_exprt(it.cond_literal));
else
assumption=
and_exprt(assumption, literal_exprt(it.cond_literal));
}
}
// the below is 'true' if there are no assertions
prop_conv.set_to_true(disjunction(disjuncts));
}