1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/usr/bin/env python
###############################################################################
# Top contributors (to current version):
# Makai Mann, Mudathir Mohamed, Aina Niemetz
#
# 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.
##
import pycvc5
from pycvc5 import kinds
if __name__ == "__main__":
slv = pycvc5.Solver()
slv.setLogic("QF_NRAT")
real = slv.getRealSort()
# Variables
x = slv.mkConst(real, "x")
y = slv.mkConst(real, "y")
# Helper terms
two = slv.mkReal(2)
pi = slv.mkPi()
twopi = slv.mkTerm(kinds.Mult, two, pi)
ysq = slv.mkTerm(kinds.Mult, y, y)
sinx = slv.mkTerm(kinds.Sine, x)
# Formulas
x_gt_pi = slv.mkTerm(kinds.Gt, x, pi)
x_lt_tpi = slv.mkTerm(kinds.Lt, x, twopi)
ysq_lt_sinx = slv.mkTerm(kinds.Lt, ysq, sinx)
slv.assertFormula(x_gt_pi)
slv.assertFormula(x_lt_tpi)
slv.assertFormula(ysq_lt_sinx)
print("cvc5 should report UNSAT")
print("Result from cvc5 is:", slv.checkSat())
|