Hello World

This example shows the very basic usage of the API. We create a solver, declare a Boolean variable and check whether it is entailed (by true , as nothing has been asserted to the solver).

examples/api/cpp/helloworld.cpp

 1 /******************************************************************************
 2  * Top contributors (to current version):
 3  *   Aina Niemetz, Tim King, Andrew Reynolds
 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 very simple cvc5 example.
14  */
15 
16 #include <cvc5/cvc5.h>
17 
18 #include <iostream>
19 
20 using namespace cvc5;
21 
22 int main()
23 {
24   Solver slv;
25   Term helloworld = slv.mkConst(slv.getBooleanSort(), "Hello World!");
26   std::cout << helloworld << " is " << slv.checkSatAssuming(helloworld)
27             << std::endl;
28   return 0;
29 }