本文整理汇总了C++中Enode::print方法的典型用法代码示例。如果您正苦于以下问题:C++ Enode::print方法的具体用法?C++ Enode::print怎么用?C++ Enode::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enode
的用法示例。
在下文中一共展示了Enode::print方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verifyDeductionWithExternalTool
void THandler::verifyDeductionWithExternalTool( Enode * imp )
{
assert( imp->isDeduced( ) );
// First stage: print declarations
const char * name = "/tmp/verifydeduction.smt2";
std::ofstream dump_out( name );
core_solver.dumpHeaderToFile( dump_out );
dump_out << "(assert" << endl;
dump_out << "(and" << endl;
for ( int j = 0 ; j < trail.size( ) ; j ++ )
{
Var v = var( trail[ j ] );
if ( v == var_True || v == var_False )
continue;
Enode * e = varToEnode( v );
assert( e );
if ( !e->isTAtom( ) )
continue;
bool negated = sign( trail[ j ] );
if ( negated )
dump_out << "(not ";
e->print( dump_out );
if ( negated )
dump_out << ")";
dump_out << endl;
}
if ( imp->getDeduced( ) == l_True )
dump_out << "(not " << imp << ")" << endl;
else
dump_out << imp << endl;
dump_out << "))" << endl;
dump_out << "(check-sat)" << endl;
dump_out << "(exit)" << endl;
dump_out.close( );
// Second stage, check the formula
const bool tool_res = callCertifyingSolver( name );
if ( tool_res )
opensmt_error2( config.certifying_solver, " says this is not a valid deduction" );
}
示例2: verifyCallWithExternalTool
void THandler::verifyCallWithExternalTool( bool res, size_t trail_size )
{
// First stage: print declarations
const char * name = "/tmp/verifycall.smt2";
std::ofstream dump_out( name );
core_solver.dumpHeaderToFile( dump_out );
dump_out << "(assert" << endl;
dump_out << "(and" << endl;
for ( size_t j = 0 ; j <= trail_size ; j ++ )
{
Var v = var( trail[ j ] );
if ( v == var_True || v == var_False )
continue;
// Enode * e = var_to_enode[ v ];
Enode * e = varToEnode( v );
assert( e );
if ( !e->isTAtom( ) )
continue;
bool negated = sign( trail[ j ] );
if ( negated )
dump_out << "(not ";
e->print( dump_out );
if ( negated )
dump_out << ")";
dump_out << endl;
}
dump_out << "))" << endl;
dump_out << "(check-sat)" << endl;
dump_out << "(exit)" << endl;
dump_out.close( );
// Second stage, check the formula
const bool tool_res = callCertifyingSolver( name );
if ( res == false && tool_res == true )
opensmt_error2( config.certifying_solver, " says SAT stack, but we say UNSAT" );
if ( res == true && tool_res == false )
opensmt_error2( config.certifying_solver, " says UNSAT stack, but we say SAT" );
}
示例3: verifyExplanationWithExternalTool
void THandler::verifyExplanationWithExternalTool( vector< Enode * > & expl )
{
// First stage: print declarations
const char * name = "/tmp/verifyexp.smt2";
std::ofstream dump_out( name );
core_solver.dumpHeaderToFile( dump_out );
dump_out << "(assert " << endl;
dump_out << "(and" << endl;
for ( size_t j = 0 ; j < expl.size( ) ; j ++ )
{
Enode * e = expl[ j ];
assert( e->isTAtom( ) );
assert( e->getPolarity( ) != l_Undef );
bool negated = e->getPolarity( ) == l_False;
if ( negated )
dump_out << "(not ";
e->print( dump_out );
if ( negated )
dump_out << ")";
dump_out << endl;
}
dump_out << "))" << endl;
dump_out << "(check-sat)" << endl;
dump_out << "(exit)" << endl;
dump_out.close( );
// Third stage, check the formula
const bool tool_res = callCertifyingSolver( name );
if ( tool_res == true )
opensmt_error2( config.certifying_solver, " says this is not an explanation" );
}
示例4: verifyInterpolantWithExternalTool
void THandler::verifyInterpolantWithExternalTool( vector< Enode * > & expl
, Enode * interp_list )
{
uint64_t mask = 0xFFFFFFFFFFFFFFFEULL;
for ( unsigned in = 1 ; in < core_solver.getNofPartitions( ) ; in ++ )
{
Enode * args = interp_list;
// Advance in the interpolants list
for ( unsigned i = 0 ; i < in - 1 ; i ++ )
args = args->getCdr( );
Enode * interp = args->getCar( );
mask &= ~SETBIT( in );
// Check A -> I, i.e., A & !I
// First stage: print declarations
const char * name = "/tmp/verifyinterp.smt2";
std::ofstream dump_out( name );
core_solver.dumpHeaderToFile( dump_out );
// Print only A atoms
dump_out << "(assert " << endl;
dump_out << "(and" << endl;
for ( size_t j = 0 ; j < expl.size( ) ; j ++ )
{
Enode * e = expl[ j ];
assert( e->isTAtom( ) );
assert( e->getPolarity( ) != l_Undef );
assert( (core_solver.getIPartitions( e ) & mask) != 0
|| (core_solver.getIPartitions( e ) & ~mask) != 0 );
if ( (core_solver.getIPartitions( e ) & ~mask) != 0 )
{
bool negated = e->getPolarity( ) == l_False;
if ( negated )
dump_out << "(not ";
e->print( dump_out );
if ( negated )
dump_out << ")";
dump_out << endl;
}
}
dump_out << "(not " << interp << ")" << endl;
dump_out << "))" << endl;
dump_out << "(check-sat)" << endl;
dump_out << "(exit)" << endl;
dump_out.close( );
// Check !
bool tool_res;
if ( int pid = fork() )
{
int status;
waitpid(pid, &status, 0);
switch ( WEXITSTATUS( status ) )
{
case 0:
tool_res = false;
break;
case 1:
tool_res = true;
break;
default:
perror( "Tool" );
exit( EXIT_FAILURE );
}
}
else
{
execlp( "tool_wrapper.sh", "tool_wrapper.sh", name, 0 );
perror( "Tool" );
exit( 1 );
}
if ( tool_res == true )
opensmt_error2( config.certifying_solver, " says A -> I does not hold" );
// Now check B & I
dump_out.open( name );
core_solver.dumpHeaderToFile( dump_out );
// Print only B atoms
dump_out << "(assert " << endl;
dump_out << "(and" << endl;
for ( size_t j = 0 ; j < expl.size( ) ; j ++ )
{
Enode * e = expl[ j ];
assert( e->isTAtom( ) );
assert( e->getPolarity( ) != l_Undef );
assert( (core_solver.getIPartitions( e ) & mask) != 0
|| (core_solver.getIPartitions( e ) & ~mask) != 0 );
if ( (core_solver.getIPartitions( e ) & mask) != 0 )
{
bool negated = e->getPolarity( ) == l_False;
if ( negated )
dump_out << "(not ";
e->print( dump_out );
if ( negated )
dump_out << ")";
dump_out << endl;
}
}
dump_out << interp << endl;
dump_out << "))" << endl;
dump_out << "(check-sat)" << endl;
dump_out << "(exit)" << endl;
//.........这里部分代码省略.........