#include <iostream>
#include "Api/VampireAPI.hpp"
using namespace Api;
using namespace Kernel;
int main() {
options().setTimeLimitInSeconds(60);
unsigned a = addFunction("a", 0); unsigned P = addPredicate("P", 1); unsigned Q = addPredicate("Q", 1);
TermList aConst = constant(a); TermList x = var(0);
Clause* c1 = axiom({lit(P, true, {aConst})});
Clause* c2 = axiom({lit(P, false, {x}), lit(Q, true, {x})});
Clause* c3 = conjecture({lit(Q, false, {aConst})});
Problem* prb = problem({c1, c2, c3});
std::cout << "Running Vampire..." << std::endl;
ProofResult result = prove(prb);
switch (result) {
case ProofResult::PROOF: {
std::cout << "Theorem proved!" << std::endl;
std::cout << "\n--- Text Proof ---" << std::endl;
printProof(std::cout, getRefutation());
std::cout << "\n--- Structured Proof ---" << std::endl;
std::vector<ProofStep> proof = extractProof(getRefutation());
for (const ProofStep& step : proof) {
std::cout << "Step " << step.id << ": ";
if (Clause* cl = step.clause()) {
std::cout << clauseToString(cl);
}
std::cout << std::endl;
std::cout << " Rule: " << step.ruleName();
if (step.rule == InferenceRule::RESOLUTION) {
std::cout << " (binary resolution)";
} else if (step.rule == InferenceRule::INPUT) {
std::cout << " (input clause)";
}
std::cout << std::endl;
std::cout << " Type: " << step.inputTypeName();
if (step.inputType == UnitInputType::NEGATED_CONJECTURE) {
std::cout << " [GOAL]";
}
std::cout << std::endl;
if (!step.premiseIds.empty()) {
std::cout << " Premises: ";
for (size_t i = 0; i < step.premiseIds.size(); i++) {
if (i > 0) std::cout << ", ";
std::cout << step.premiseIds[i];
}
std::cout << std::endl;
}
if (Clause* cl = step.clause()) {
std::vector<Literal*> lits = getLiterals(cl);
std::cout << " Literals (" << lits.size() << "): ";
for (size_t i = 0; i < lits.size(); i++) {
if (i > 0) std::cout << ", ";
std::cout << literalToString(lits[i]);
}
std::cout << std::endl;
}
std::cout << std::endl;
}
std::cout << "Total steps: " << proof.size() << std::endl;
break;
}
case ProofResult::SATISFIABLE:
std::cout << "Not a theorem (satisfiable)" << std::endl;
break;
case ProofResult::TIMEOUT:
std::cout << "Timeout" << std::endl;
break;
case ProofResult::MEMORY_LIMIT:
std::cout << "Memory limit exceeded" << std::endl;
break;
default:
std::cout << "Unknown result" << std::endl;
}
delete prb;
return result == ProofResult::PROOF ? 0 : 1;
}