Files
cvc5/examples/api/cpp/transcendentals.cpp
Mathias Preiner bbcd471ed4 Introduce internal namespace and remove api namespace. (#8443)
The public cvc5 API now lives in the cvc5 namespace. All internal parts were moved into the (new) internal namespace.
The final hierarchy will be as follows:

cvc5
  ~~ public API
  ::context
  ::internal
  ::parser
  ::main

After this PR it will be:

cvc5
  ~~ public API
  ::internal
      ::context
      ::main
  ::parser
2022-03-29 23:23:01 +00:00

55 lines
1.4 KiB
C++

/******************************************************************************
* Top contributors (to current version):
* Aina Niemetz, Tim King, Mudathir Mohamed
*
* This file is part of the cvc5 project.
*
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
* in the top-level source directory and their institutional affiliations.
* All rights reserved. See the file COPYING in the top-level source
* directory for licensing information.
* ****************************************************************************
*
* A simple demonstration of the transcendental extension.
*/
#include <iostream>
#include <cvc5/cvc5.h>
using namespace std;
using namespace cvc5;
int main()
{
Solver slv;
slv.setLogic("QF_NRAT");
Sort real = slv.getRealSort();
// Variables
Term x = slv.mkConst(real, "x");
Term y = slv.mkConst(real, "y");
// Helper terms
Term two = slv.mkReal(2);
Term pi = slv.mkPi();
Term twopi = slv.mkTerm(MULT, {two, pi});
Term ysq = slv.mkTerm(MULT, {y, y});
Term sinx = slv.mkTerm(SINE, {x});
// Formulas
Term x_gt_pi = slv.mkTerm(GT, {x, pi});
Term x_lt_tpi = slv.mkTerm(LT, {x, twopi});
Term ysq_lt_sinx = slv.mkTerm(LT, {ysq, sinx});
slv.assertFormula(x_gt_pi);
slv.assertFormula(x_lt_tpi);
slv.assertFormula(ysq_lt_sinx);
cout << "cvc5 should report UNSAT." << endl;
cout << "Result from cvc5 is: " << slv.checkSat() << endl;
return 0;
}