Пример #1
0
void Result::toStreamTptp(std::ostream& out) const {
  out << "% SZS status ";
  if (isSat() == Result::SAT) {
    out << "Satisfiable";
  } else if (isSat() == Result::UNSAT) {
    out << "Unsatisfiable";
  } else if (isValid() == Result::VALID) {
    out << "Theorem";
  } else if (isValid() == Result::INVALID) {
    out << "CounterSatisfiable";
  } else {
    out << "GaveUp";
  }
  out << " for " << getInputName();
}
Пример #2
0
void Result::toStreamDefault(std::ostream& out) const {
  if (getType() == Result::TYPE_SAT) {
    switch (isSat()) {
      case Result::UNSAT:
        out << "unsat";
        break;
      case Result::SAT:
        out << "sat";
        break;
      case Result::SAT_UNKNOWN:
        out << "unknown";
        if (whyUnknown() != Result::UNKNOWN_REASON) {
          out << " (" << whyUnknown() << ")";
        }
        break;
    }
  } else {
    switch (isValid()) {
      case Result::INVALID:
        out << "invalid";
        break;
      case Result::VALID:
        out << "valid";
        break;
      case Result::VALIDITY_UNKNOWN:
        out << "unknown";
        if (whyUnknown() != Result::UNKNOWN_REASON) {
          out << " (" << whyUnknown() << ")";
        }
        break;
    }
  }
} /* Result::toStreamDefault() */
Пример #3
0
void Result::toStreamSmt2(ostream& out) const {
  if (getType() == Result::TYPE_SAT && isSat() == Result::SAT_UNKNOWN) {
    out << "unknown";
  } else {
    toStreamDefault(out);
  }
}
void ContractManager::saveState(FunctionIdentifier::Ptr func, PredicateState::Ptr state) {
    if (llvm::isa<BasicPredicateState>(state)) {
        contracts->at(func)->push_back(state);
    } else if (auto&& chain = llvm::dyn_cast<PredicateStateChain>(state)) {
        saveState(func, chain->getBase());
        saveState(func, chain->getCurr());
    } else if (auto&& stateTerm = stateToTerm(state)) {
        auto&& statePred = FN.Predicate->getEqualityPredicate(stateTerm, FN.Term->getTrueTerm(), Locus(), PredicateType::PATH);
        auto&& newState = FN.State->Basic({statePred});

        Z3::ExprFactory ef;
        Z3::Solver s(ef, func->memBounds().first, func->memBounds().second);
        auto res = s.isFullGroup(newState);

        if (res.isSat()) {
            contracts->at(func)->push_back(newState);
        }
    } else {
        errs() << "Unable to save state:" << state << endl;
    }
}