2021-10-01 18:21:02 -05:00
|
|
|
/******************************************************************************
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-10-22 18:00:06 -05:00
|
|
|
import static io.github.cvc5.api.Kind.*;
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2021-10-22 18:00:06 -05:00
|
|
|
import io.github.cvc5.api.*;
|
2021-10-01 18:21:02 -05:00
|
|
|
|
|
|
|
|
public class Transcendentals
|
|
|
|
|
{
|
|
|
|
|
public static void main(String args[]) throws CVC5ApiException
|
|
|
|
|
{
|
2021-11-03 16:32:10 -05:00
|
|
|
try (Solver slv = new Solver())
|
|
|
|
|
{
|
|
|
|
|
slv.setLogic("QF_NRAT");
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2021-11-03 16:32:10 -05:00
|
|
|
Sort real = slv.getRealSort();
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2021-11-03 16:32:10 -05:00
|
|
|
// Variables
|
|
|
|
|
Term x = slv.mkConst(real, "x");
|
|
|
|
|
Term y = slv.mkConst(real, "y");
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2021-11-03 16:32:10 -05:00
|
|
|
// 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);
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2021-11-03 16:32:10 -05:00
|
|
|
// 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);
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2021-11-03 16:32:10 -05:00
|
|
|
slv.assertFormula(x_gt_pi);
|
|
|
|
|
slv.assertFormula(x_lt_tpi);
|
|
|
|
|
slv.assertFormula(ysq_lt_sinx);
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2021-11-03 16:32:10 -05:00
|
|
|
System.out.println("cvc5 should report UNSAT.");
|
|
|
|
|
System.out.println("Result from cvc5 is: " + slv.checkSat());
|
|
|
|
|
}
|
2021-10-01 18:21:02 -05:00
|
|
|
}
|
2021-11-03 16:32:10 -05:00
|
|
|
}
|