2021-10-01 18:21:02 -05:00
|
|
|
/******************************************************************************
|
|
|
|
|
* Top contributors (to current version):
|
2025-01-23 09:54:20 -08:00
|
|
|
* Mudathir Mohamed, Daniel Larraz, Andres Noetzli
|
2021-10-01 18:21:02 -05:00
|
|
|
*
|
|
|
|
|
* This file is part of the cvc5 project.
|
|
|
|
|
*
|
2025-01-23 09:54:20 -08:00
|
|
|
* Copyright (c) 2009-2025 by the authors listed in the file AUTHORS
|
2021-10-01 18:21:02 -05:00
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-03-30 21:09:03 -07:00
|
|
|
import static io.github.cvc5.Kind.*;
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2022-03-30 21:09:03 -07:00
|
|
|
import io.github.cvc5.*;
|
2021-10-01 18:21:02 -05:00
|
|
|
|
|
|
|
|
public class Transcendentals
|
|
|
|
|
{
|
|
|
|
|
public static void main(String args[]) throws CVC5ApiException
|
|
|
|
|
{
|
2024-09-26 16:00:25 -05:00
|
|
|
TermManager tm = new TermManager();
|
|
|
|
|
Solver slv = new Solver(tm);
|
2021-11-03 16:32:10 -05:00
|
|
|
{
|
|
|
|
|
slv.setLogic("QF_NRAT");
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2024-09-26 16:00:25 -05:00
|
|
|
Sort real = tm.getRealSort();
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2021-11-03 16:32:10 -05:00
|
|
|
// Variables
|
2024-09-26 16:00:25 -05:00
|
|
|
Term x = tm.mkConst(real, "x");
|
|
|
|
|
Term y = tm.mkConst(real, "y");
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2021-11-03 16:32:10 -05:00
|
|
|
// Helper terms
|
2024-09-26 16:00:25 -05:00
|
|
|
Term two = tm.mkReal(2);
|
|
|
|
|
Term pi = tm.mkPi();
|
|
|
|
|
Term twopi = tm.mkTerm(MULT, two, pi);
|
|
|
|
|
Term ysq = tm.mkTerm(MULT, y, y);
|
|
|
|
|
Term sinx = tm.mkTerm(SINE, x);
|
2021-10-01 18:21:02 -05:00
|
|
|
|
2021-11-03 16:32:10 -05:00
|
|
|
// Formulas
|
2024-09-26 16:00:25 -05:00
|
|
|
Term x_gt_pi = tm.mkTerm(GT, x, pi);
|
|
|
|
|
Term x_lt_tpi = tm.mkTerm(LT, x, twopi);
|
|
|
|
|
Term ysq_lt_sinx = tm.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());
|
|
|
|
|
}
|
2023-10-02 01:20:26 -05:00
|
|
|
Context.deletePointers();
|
2021-10-01 18:21:02 -05:00
|
|
|
}
|
2021-11-03 16:32:10 -05:00
|
|
|
}
|