Theory Reference: Transcendentals

cvc5 supports transcendental functions that naturally extend the nonlinear real arithmetic theories NRA and NIRA . The theory consists of the constant \(\pi\) and function symbols for most common transcendental functions like, e.g., sin , cos and tan .

Logic

To enable cvc5’s decision procedure for transcendentals, append T to the arithmetic logic that is being used:

(set-logic QF_NRAT)

Alternatively, use the ALL logic:

(set-logic ALL)

Syntax

cvc5 internally defines a constant real.pi of sort Real and the following unary function symbols from Real to Real :

  • the square root function sqrt

  • the exponential function exp

  • the sine function sin

  • the cosine function cos

  • the tangent function tan

  • the cosecant function csc

  • the secant function sec

  • the cotangent function cot

  • the arcsine function arcsin

  • the arccosine function arccos

  • the arctangent function arctan

  • the arccosecant function arccsc

  • the arcsecant function arcsec

  • the arccotangent function arccot

Semantics

Both the constant real.pi and all function symbols are defined on real numbers and are thus not subject to limited precision. That being said, cvc5 internally uses inexact techniques based on incremental linearization. While real.pi is specified using a rational enclosing interval that is automatically refined on demand, the function symbols are approximated using tangent planes and secant lines using the techniques described in [ CGI+18 ] .

Examples

examples/api/cpp/transcendentals.cpp

 1/******************************************************************************
 2 * Top contributors (to current version):
 3 *   Gereon Kremer, Mathias Preiner
 4 *
 5 * This file is part of the cvc5 project.
 6 *
 7 * Copyright (c) 2009-2022 by the authors listed in the file AUTHORS
 8 * in the top-level source directory and their institutional affiliations.
 9 * All rights reserved.  See the file COPYING in the top-level source
10 * directory for licensing information.
11 * ****************************************************************************
12 *
13 * A simple demonstration of the transcendental extension.
14 */
15
16#include <iostream>
17
18#include <cvc5/cvc5.h>
19
20using namespace std;
21using namespace cvc5;
22
23int main()
24{
25  Solver slv;
26  slv.setLogic("QF_NRAT");
27
28  Sort real = slv.getRealSort();
29
30  // Variables
31  Term x = slv.mkConst(real, "x");
32  Term y = slv.mkConst(real, "y");
33
34  // Helper terms
35  Term two = slv.mkReal(2);
36  Term pi = slv.mkPi();
37  Term twopi = slv.mkTerm(Kind::MULT, {two, pi});
38  Term ysq = slv.mkTerm(Kind::MULT, {y, y});
39  Term sinx = slv.mkTerm(Kind::SINE, {x});
40
41  // Formulas
42  Term x_gt_pi = slv.mkTerm(Kind::GT, {x, pi});
43  Term x_lt_tpi = slv.mkTerm(Kind::LT, {x, twopi});
44  Term ysq_lt_sinx = slv.mkTerm(Kind::LT, {ysq, sinx});
45
46  slv.assertFormula(x_gt_pi);
47  slv.assertFormula(x_lt_tpi);
48  slv.assertFormula(ysq_lt_sinx);
49
50  cout << "cvc5 should report UNSAT." << endl;
51  cout << "Result from cvc5 is: " << slv.checkSat() << endl;
52
53  return 0;
54}