PySMT

March 22, 2018 | Author: jeremy | Category: Boolean Data Type, Logic, Computer Programming, Software Engineering, Mathematical Logic


Comments



Description

PySMT DocumentationRelease 0.2.2 Andrea Micheli and Marco Gario July 29, 2015 CONTENTS 1 Introduction 3 2 Getting Started 2.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Hello World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 5 5 7 3 Change Log 3.1 0.4.2: XXXX-XX-XX – YYYYYYYYYYYYYYYYYYY 3.2 0.4.1: 2015-07-13 – BitVectors Extension . . . . . . . . . . 3.3 0.4.0: 2015-06-15 – Interpolation and BDDs . . . . . . . . 3.4 0.3.0: 2015-05-01 – BitVectors/UnsatCores . . . . . . . . . 3.5 0.2.4: 2015-03-15 – PicoSAT . . . . . . . . . . . . . . . . 3.6 0.2.3: 2015-03-12 – Logics Refactoring . . . . . . . . . . . 3.7 0.2.2: 2015-02-07 – BDDs . . . . . . . . . . . . . . . . . . 3.8 0.2.1: 2014-11-29 – SMT-LIB . . . . . . . . . . . . . . . . 3.9 0.2.0: 2014-10-02 – Beta release. . . . . . . . . . . . . . . 3.10 0.1.0: 2014-03-10 – Alpha release. . . . . . . . . . . . . . 3.11 0.0.1: 2014-02-01 – Initial release. . . . . . . . . . . . . . . . . . . . . . . . . 9 9 9 9 10 10 10 11 11 11 12 12 4 Developing in pySMT 4.1 Building Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Running Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Distributing PySMT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 13 13 13 5 API Reference 5.1 Shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 QuantifierEliminator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 15 20 21 6 Indices and tables 23 Python Module Index 25 Index 27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i ii . PySMT Documentation.2 Contents: CONTENTS 1 .2. Release 0. PySMT Documentation.2 2 CONTENTS .2. Release 0. please let us know of any problem or possible improvements. The aim of this library is to be an intermediate step between the SMT-LIB (that is unversal but not programmable) and solvers API (that are programmable. but specific).CHAPTER ONE INTRODUCTION pySMT makes working with Satisfiability Modulo Theory simple. The project is still in its infancy. but does not tie you to a particular solver. Among others. 3 . you can: • Define formulae in a solver independent way • Perform quantifier elimination • Write ad-hoc simplifiers and operators The API is inspired by the great python bindings offered by Z3. 2 4 Chapter 1. Release 0. Introduction .2.PySMT Documentation. codeplex.python. After digesting this example. These are simple wrappers around functionalities provided by other objects.2 Hello World Any decent tutorial starts with an Hello World example. without the need of any solver.2. 5 . 2.eu/) >= 5 (Optional) • Z3 (http://z3.nyu. you will be able to perform the most common operations using pySMT.1 Installation To run pySMT you need the following software to be installed: • Python (http://www. Is there a value for each letter so that H+E+L+L+O = W+O+R+L+D = 25? 2. 2.edu/web/) (Optional) The python binding for the SMT Solvers must be installed and accessible from your PYTHONPATH. with a possible integer value between 1 and 10 to each of them.com/releases) >= 4 (Optional) • CVC4 (http://cvc4.2. 2. this represents a good starting point if you are interested in learning more about pySMT internals. The current version supports MathSAT 5. We will encode a problem as an SMT problem. Z3 4 and (starting from version 0.shortcuts provides the most used functions of the library.cs.6 • MathSAT (http://mathsat.2. and then invoke a solver to solve it. therefore.0) CVC4.org) >= 2.fbk.1 The Problem The problem that we are going to solve is the following: Lets consider the letters composing the words HELLO and WORLD.2 The Basics The module pysmt.CHAPTER TWO GETTING STARTED In this section we will see how to install pySMT and how to solve a simple problem using it. The library can be used to build and dump SMT-LIB problems. get_value(l))) else: print("No solution found") Defaults methods for formula allow for simple printing. And. INT) for s in "hello"] world = [Symbol(s. problem) print("Serialization of the formula:") print(formula) with Solver(name="z3") as solver: solver. Checking satisfiability can also be done with a one-liner. h). we can assert the forumla and query the solver. solver. The types available for constants are defined in pysmt.typing import INT h = Symbol("H". print "Serialization of the formula:" print formula print "Checking Satisfiability:" print is_sat(formula) Althoug checking satisfiability is quite straight-forward. Solvers can be instantiate within a context (with) to automatically handle destruction. After creating the solver. varibles) and operators. GE(Int(10). from pysmt. INT) # domain = (1 <= h) /\ (10 >= h) domain = And( LE(Int(1). sum_world). Or.typing import INT hello = [Symbol(s. Int(36))) formula = And(domains.. Int. Plus) can accept lists of arguments. we will use python list comprehension to apply the same operation to multiple symbols. Release 0. GE(Int(10). LE. Constant.2 We first include the methods needed to define new symbols (i. Getting Started . Equals. GE. l). with Solver(name="z3") as solver: solver. extract a models requires working with an explicit instance of a solver. Solver from pysmt.add_assertion(formula) if solver. h)) Instead of defining one variable at the time.PySMT Documentation. And. Int from pysmt. Plus. LE.e.2. INT) for s in "world"] letters = set(hello+world) domains = And([And( LE(Int(1).typing. List-comprehensions are so common in pySMT that n-ary operators (such as And.shortcuts import Symbol.add_assertion(formula) 6 Chapter 2. GE.solve(): for l in letters: print("%s = %s" %(l. Equals(sum_hello. l) ) for l in letters]) sum_hello = Plus(hello) sum_world = Plus(world) problem = And(Equals(sum_hello. from pysmt.shortcuts import Symbol. INT) for s in "hello"] world = [Symbol(s. we can specify which solver we want to run by changing the way we instantiate it. Plus. What’s Next? 7 .PySMT Documentation. If mathsat is installed you can try by replacing name="z3" with name="msat". solver. sum_world).add_assertion(formula) if solver. problem) print("Serialization of the formula:") print(formula) with Solver(name="z3") as solver: solver.get_value(l))) else: print("No solution found") 2. In our example.2 if solver.solve(): for l in letters: print("%s = %s" %(l.shortcuts module. GE(Int(10). LE. Solver from pysmt. l). GE. l) ) for l in letters]) sum_hello = Plus(hello) sum_world = Plus(world) problem = And(Equals(sum_hello. 2. The best place to understand more about pySMT is the pysmt. All the important functionalities are exported there with a simple to use interface. Equals. Equals(sum_hello. And.3 What’s Next? This simlpe example provides the basic ideas of how to work with pySMT. Int(36))) formula = And(domains. INT) for s in "world"] letters = set(hello+world) domains = And([And( LE(Int(1).shortcuts import Symbol.typing import INT hello = [Symbol(s. Here is the complete example for reference: from pysmt.get_value(l))) else: print("No solution found") The key-point of pySMT is to be able to run the same code by using different solvers.2. solver.solve(): for l in letters: print("%s = %s" %(l. Release 0. Int.3. Getting Started .2 8 Chapter 2.2. Release 0.PySMT Documentation. CHAPTER THREE CHANGE LOG 3. Deprecation: • Started deprecation of get_dependencies and get_sons • Depreaced Randomizer and associated functions. Now internal functions do no need to import shortcuts.1: 2015-07-13 – BitVectors Extension Theories: • BitVectors: Added Signed operators Solvers: • Support for BitVectors added for Z3.2: XXXX-XX-XX – YYYYYYYYYYYYYYYYYYY 3. • Moved global environment initialization to environment.com/pysmt/repycudd) to a custom re-entrant version called repycudd • Added BDD-Based quantifier eliminator for BOOL theory 9 . prenex-normalization and disjunctive/conjunctive partitioning. Current support is limited to MathSAT and Z3.py anymore. 3. • Improved support for infix notation. Thanks to Alberto Griggio for implementing this! • Rewriting functions: nnf-ization. thus breaking some circular dependencies.4.3 0. • get_implicant(): Returns the implicant of a satisfiable formula.2 0.4.py. CVC4.1 0.4. • Z3Model Iteration bugfix BDDs: • Switched from pycudd wrapper (https://github.0: 2015-06-15 – Interpolation and BDDs General: • Craig interpolation support through Interpolator class. and Yices General: • SmartPrinting: Print expression by replacing sub-expression with custom strings. binary_interpolant and sequence_interpolant shortcuts. Current support is limited to MathSAT and unsigned operators. • get_logic() Oracle: Detects the logic used in a formula. Current support is limited to MathSAT and Z3. _is_valid()_.4: 2015-03-15 – PicoSAT Solvers: • PicoSAT solver support General: • Iterative implementation of FNode. Bugfix: • Fixed bug (#48) in pypi package.5 0.6 0.get_dependencies().PySMT Documentation.size(): Added method to compute the size of an expression using multiple metrics. • Partial Model Support: Return a partial model whenever possible. as well as the respective factory methods can now accept a ‘logic’ parameter that allows to select a quantifier eliminator instance supporting a given logic (analogously to what happens for solvers). Thanks to Rhishikesh Limaye for reporting this.4 0.3. 10 Chapter 3.2. Solvers: • Two new quantifier eliminators for LRA using MathSAT API: Fourier-Motzkin (msat_fm) and LoosWeisspfenning (msat_lw) • Yices: Improved handling of int/real precision General: • Unsat Cores: Unsat core extraction with dedicated shortcut get_unsat_core . This can now be used in the shortcuts (_is_sat()_.3: 2015-03-12 – Logics Refactoring General: • install.py: script to automate the installation of supported solvers. This also deprecates FNode. • QuantifierEliminator and qelim shortcuts. 3. Release 0.2 • Added support for static/dynamic variable ordering • Re-implemented back-conversion avoiding recursion 3. Change Log . • FNode.2.get_free_variables(). _is_unsat()_. making pysmt-install (and other commands) unavailable. and _get_model()_) by choosing the special logic pysmt.AUTO. The library now works with both Python 2 and Python 3. 3. Current support is limited to MathSAT and Z3 • Added support for Python 3.2.logics.0: 2015-05-01 – BitVectors/UnsatCores Theories: • Added initial support for BitVectors and QF_BV logic. 3.2.7 0.1: 2014-11-29 – SMT-LIB Solvers: • Yices 2 • Generic Wrapper: enable usage of any SMT-LIB compatible solver.add_dynamic_walker_function). • Removed option _quantified_ from all shortcuts. 3. • SMT-LIB: Substantially improved parser performances.2. Release 0.2: 2015-02-07 – BDDs Solvers: • pyCUDD to perform BDD-based reasoning General: • Dynamic Walker Function: Dynamic Handlers for new node types can now be registered through the environment (see Environment. Theories: LIRA Solvers: CVC4 General: • Type-checking • Definition of SMT-LIB logics • Converted the DAGWalker from recursive to iterative • Better handling of errors during formula creation and solving • Preferences among available solvers. Added explicit Annotations object to deal with SMTLIB Annotations.8 0. The factory not provides a way to change this default.get_solver() is now the most generic quantifier free logic supported by pySMT (currently. General: • SMT-LIB parsing • Changed internal representation of FNode • Multiple performance improvements • Added configuration file 3.2 • Expressions: Added Min/Max operators.2.2.PySMT Documentation.2: 2015-02-07 – BDDs 11 . 0.2.7. Deprecation: • Option ‘quantified’ within Solver() and all related methods will be removed in the next release.0: 2014-10-02 – Beta release. QF_UFLIRA).9 0. 3. • Improved iteration methods on EagerModel Backwards Incompatible Changes: • The default logic for Factory. to avoid conflicts with the Python Standard Library.2.PySMT Documentation.1.0.1: 2014-02-01 – Initial release. Theories: LIA. RDL.0: 2014-03-10 – Alpha release. EUF Solvers: MathSAT. Printing • Uniform Solving for QF formulae • Unified Quantifier Elimination (Z3 support only) 3. Simplification.2 Backwards Incompatible Changes: • Renamed the module pysmt. Substitution.10 0. LRA. Release 0.11 0. Change Log .types into pysmt. Z3 General Functionalities: • Formula Manipulation: Creation. 12 Chapter 3. 3.typing. To run all tests. To build the documentation you will need sphinx installed.py bdist –format=gztar ‘‘ will produce a tar. Among them. We strive to keep the execution time of the tests brief.sh this usually takes significantly longer (3 minutes).py script can be used to create distributable packages. run_tests. Each TestCase is stored into a separate file. we usually consider html and latex. and we skip slow tests. For convenience the script make_distrib.g. this builds both the binary and source distributions within dist/.py To launch all the tests. and is should be possible to lunch it by calling the file directly.: nosetests pysmt/tests/test_formula.sh and run_all_tests. To achieve this. 4.sh are provided. this can be done via pip.gz file inside the dist/ directory.py However. use run_all_tests. e. scripts run_tests.2 Running Tests Tests in pySMT are developed using python’s built-in testing framework unittest. 4.CHAPTER FOUR DEVELOPING IN PYSMT 4. The command ‘‘ python setup. the preferred way is to use nosetests. A Makefile in the docs/ directory allows to build the documentation in many formats.sh should complete within 1 minute.: python test_formula. we use parallel tests.1 Building Documentation pySMT uses Sphinx for documentation. 13 .sh is provided. e.3 Distributing PySMT The setup.g. Developing in pySMT .2.PySMT Documentation. Release 0.2 14 Chapter 4. · · · . pysmt. pysmt. This module defines a global environment. 𝑣𝑛 .shortcuts.shortcuts. Functions trying to access the global environment should use the method get_global_env(). pysmt. subs) Applies the substitutions defined in the dictionary to the formula. · · · . to be guaranteed that a fresh environment is used.get_free_variables(formula) Returns the simplified version of the formula.shortcuts.reset_env() Resets the global environment.shortcuts.SizeOracle for details.Exists(variables. and returns the new one. 𝑣𝑛 .simplify(formula) Returns the simplified version of the formula.shortcuts.𝜙(𝑣1 .substitute(formula.get_formula_size(formula.shortcuts.ForAll(variables. pysmt. · · · . Keep in mind that the global state of the environment might lead to inconsistency and unexpected bugs. 𝑣𝑛 ) pysmt.shortcuts. pysmt. See pysmt.shortcuts. pysmt.shortcuts. pysmt.serialize(formula. formula) ∀𝑣1 .oracles.shortcuts. 𝑣𝑛 ) 15 . pysmt.get_env() Returns the global environment.shortcuts.CHAPTER FIVE API REFERENCE 5. For tests it is recommended to perform an environment reset in the setUp phase.𝜙(𝑣1 .get_type(formula) Returns the type of the formula. threshold=None) Provides a string representing the formula. formula) ∃𝑣1 . so that most methods can be called without the need to specify an environment or a FormulaManager.1 Shortcuts Provides the most used functions in a nicely wrapped API. · · · . pysmt. pysmt. measure=None) Returns the size of the formula as measured by the given counting type.get_atoms(formula) Returns the set of atoms of the formula. This is particularly true for tests. params) 𝑣𝑛𝑎𝑚𝑒(𝑝1 .Equals(left. right) 𝑙<𝑟 pysmt.shortcuts.Minus(left. · · · .Iff(left. right) 𝑙↔𝑟 pysmt.shortcuts.shortcuts.2.Ite(iff.Function(vname.PySMT Documentation.shortcuts.Div(left.shortcuts.Implies(left. API Reference .LT(left. right) 𝑙≤𝑟 pysmt. right) If 𝑖 Then 𝑙 Else 𝑟 16 Chapter 5. Release 0. right) 𝑙=𝑟 pysmt. right) 𝑙−𝑟 pysmt. right) 𝑙→𝑟 pysmt.shortcuts. 𝑝𝑛 ) pysmt. right) 𝑙≥𝑟 pysmt. right) 𝑙*𝑟 pysmt. left.shortcuts.Not(formula) ¬𝜙 pysmt.Times(left.shortcuts. right) 𝑙 𝑟 pysmt.GT(left.2 pysmt.LE(left.shortcuts.shortcuts.shortcuts.shortcuts.GE(left.shortcuts. right) 𝑙>𝑟 pysmt. BooleanType object>.shortcuts.shortcuts.shortcuts.AtMostOne(*args) Cardinality constraint over a set of boolean expressions.shortcuts.Symbol(name.typing.TRUE() Returns the Boolean constant TRUE.2 pysmt. 5.PySMT Documentation. template=None) Returns a symbol with a fresh name and given type.shortcuts.Int(value) Returns an Integer constant with the given value.shortcuts.Bool(value) Returns a Boolean constant with the given value.1.2.ToReal(formula) Explicit cast of a term into a Real term. width=None) Returns a constant of type BitVector.a string starting with “#b” followed by a sequence of 0s and 1s .Plus(*args) 𝜙0 + · · · + 𝜙𝑛 pysmt.shortcuts.ExactlyOne(*args) Given a set of boolean expressions requires that exactly one holds. requires that each of them has value different from all the others pysmt.FreshSymbol(typename=<pysmt.a string of 0s and 1s .BV(value.Real(value) Returns a Real constant with the given value. Shortcuts 17 .shortcuts. pysmt. pysmt.Xor(left.shortcuts.Min(*args) Minimum over a set of real or integer terms pysmt. pysmt. typename=<pysmt. pysmt. At most one can be true at anytime.And(*args) 𝜙0 ∧ · · · ∧ 𝜙𝑛 pysmt. value can be either: . pysmt.AllDifferent(*args) Given a set of non-boolean expressions.Max(*args) Maximum over a set of real or integer terms pysmt. pysmt.shortcuts. pysmt. pysmt.shortcuts.shortcuts.shortcuts.typing. Release 0. 0 <= value < 2**width In order to create the BV representation of a signed integer. the SBV() method shall be used.shortcuts. pysmt.BooleanType object>) Returns a symbol with the given name and type.shortcuts.shortcuts.Or(*args) 𝜙0 ∨ · · · ∨ 𝜙𝑛 pysmt.shortcuts.an integer number s.FALSE() Returns the Boolean constant FALSE. pysmt. right) Returns the XOR of left and right pysmt.shortcuts.t. 2 pysmt.shortcuts. pysmt.BVLShl(left.BVOr(left.BVNot(formula) Returns the bitvector Not(bv) pysmt. right) Returns the Bit-wise AND of two bitvectors of the same size. right) Returns the Bit-wise XOR of two bitvectors of the same size.BVUGE(left.BVAnd(left.BVXor(left.shortcuts. pysmt. If the specified value is an integer. right) Returns the division of the two BV. end=None) Returns the slice of formula from start to end (inclusive). pysmt.BVURem(left.BVULT(left.BVSub(left. pysmt. right) Returns the formula left <= right. it is converted in the 2-complement representation of the given number.shortcuts. right) Returns the formula left >= right. right) Returns the difference of two BV. pysmt. right) Returns the product of two BV.shortcuts.shortcuts. right) Returns the formula left > right.shortcuts. otherwise the behavior is the same as BV(). pysmt. pysmt.shortcuts.BVUDiv(left. 18 Chapter 5. right) Returns the logical left shift the BV.BVConcat(left.BVUGT(left.BVExtract(formula.shortcuts.BVZero(width=None) Returns the zero constant BitVector. pysmt.shortcuts.BVMul(left.shortcuts.shortcuts.shortcuts. start=0. right) Returns the Concatenation of the two BVs pysmt. pysmt. pysmt. right) Returns the reminder of the two BV.shortcuts. right) Returns the Bit-wise OR of two bitvectors of the same size.PySMT Documentation.BVAdd(left. pysmt.shortcuts.shortcuts. pysmt.BVULE(left. pysmt. pysmt.shortcuts.SBV(value. pysmt. right) Returns the sum of two BV. pysmt. Release 0.2. API Reference .BVOne(width=None) Returns the unsigned one constant BitVector.shortcuts. pysmt. width=None) Returns a constant of type BitVector interpreting the sign. right) Returns the formula left < right.BVNeg(formula) Returns the arithmetic negation of the BV.shortcuts.shortcuts.shortcuts. BVSLT(left. solver_name=None.QuantifierEliminator(name=None. pysmt.shortcuts. name=None.UnsatCoreSolver(quantified=False.Solver(quantified=False.shortcuts. right) Returns the SIGNED REMAINDER of left divided by right pysmt. Release 0. 5. pysmt. pysmt.BVRor(formula.BVRol(formula. pysmt. pysmt. pysmt. logic=None. pysmt.PySMT Documentation. right) Returns the SIGNED DIVISION of left by right pysmt.shortcuts.BVSGE(left. logic=None) Returns a solver. logic=None) Returns an interpolator pysmt. un- pysmt. right) Returns the SIGNED GREATER-THAN-OR-EQUAL-TO comparison for BV. pysmt. name=None. pysmt.BVComp(left.shortcuts. steps) Returns the RIGHT rotation of the BV by the number of steps. logic=None) Returns whether a formula is satisfiable.shortcuts.shortcuts. Parameters • formula (FNode) – The formula to check satisfiability • solver_name – Specify the name of the solver to be used. • logic – Specify the logic that is going to be used. pysmt.BVSRem(left.BVZExt(formula.BVSLE(left. right) Returns the SIGNED LOWER-THAN comparison for BV.is_sat(formula. otherwise 1 is returned.shortcuts.2.shortcuts.BVAShr(left.2 pysmt.shortcuts.shortcuts. right) Returns the SIGNED GREATER-THAN comparison for BV.shortcuts. increase) Returns the signed extension of the BV New bits are set according to the most-significant-bit.shortcuts.shortcuts.BVSExt(formula. Shortcuts 19 .BVSDiv(left.shortcuts. right) Returns a BV of size 1 equal to 0 if left is equal to right. logic=None) Returns a quantifier eliminator pysmt. pysmt. right) Returns the RIGHT arithmetic rotation of the left BV by the number of steps specified by the right BV. pysmt. increase) Returns the extension of the BV New bits are set to zero. sat_cores_mode=’all’) Returns a solver supporting unsat core extraction.BVSGT(left.Interpolator(name=None. right) Returns the logical right shift the BV.shortcuts.BVLShr(left.shortcuts. steps) Returns the LEFT rotation of the BV by the number of steps.shortcuts.shortcuts.1. right) Returns the SIGNED LOWER-THAN-OR-EQUAL-TO comparison for BV. solver. solver_name=None. API Reference .shortcuts.read_configuration(config_filename.shortcuts. solver_name=None. pop(levels=1) Pop the context of the given number of levels.get_unsat_core(clauses.qelim(formula. solver_name=None. solver_name=None.Solver(environment. logic=None) Similar to is_sat() but checks unsatisfiability. logic=None) Similar to is_sat() but checks validity.2 Solver class pysmt. If no environment is specified.is_unsat(formula. environment=None) Dumps the current pysmt configuration to the specified file path 5.shortcuts. pysmt.get_implicant(formula.2 Returns Whether the formula is SAT or UNSAT. get_values(exprs) Returns the value of the expressions if a model was found. if no change to the assertion set occurred. otherwise None. the top-level environment will be used. formula_b). Return type bool pysmt.sequence_interpolant(formulas. logic=None) Performs quantifier elimination of the given formula. if complete is set to true.shortcuts. pysmt.binary_interpolant(formula_a. Returns None if the conjunction is satisfiable pysmt. pysmt. logic.shortcuts. pysmt.shortcuts. logic=None) Computes a sequence interpolant of the formulas. solver_name=None.shortcuts.shortcuts. logic=None) Similar to is_sat() but returns a model if the formula is satisfiable.is_valid(formula. solver_name=None. logic=None) Computes an interpolant of (formula_a. pysmt. all the variables appearing in the formula are forced to appear in f_i.shortcuts. logic=None) Similar to get_model() but returns the unsat core of the conjunction of the input clauses pysmt. formula) is valid or None if formula is unsatisfiable. exit() Destroys the solver.PySMT Documentation. solver_name=None. Returns None if the conjunction is satisfiable pysmt.shortcuts. formula_b. user_options=None) Represents a generic SMT Solver. Returns A dictionary associating to each expr a value Return type dict push(levels=1) Push the current context of the given number of levels. pysmt. environment=None) Reads the pysmt configuration of the given file path and applies it on the specified environment. Restrictions: Requires option :produce-models to be set to true and can be called only after checksat returned sat or unknown.solvers. solver_name=None. Release 0.get_model(formula. logic=None) Returns a formula f_i such that Implies(f_i.write_configuration(config_filename. 20 Chapter 5.2. 2 reset_assertions() Removes all defined assertions... Parameters options (Dictionary) – Options to be set 5. declare_variable(var) Declare a variable in the solver. add_assertion(formula... A call to solve([a1. an]) is functionally equivalent to: push() add_assertion(And(a1. for better naming. This is a wrapper to assert_().g.3.PySMT Documentation. solve(assumptions=None) Returns the satisfiability value of the asserted formulas. that will be called on each symbol to decide whether to print it. print_model(name_filter=None) Prints the model (if one exists). E. the satisfiability result is computed assuming that all the specified literals are True. get_value(formula) Returns the value of formula in the current model (if one exists).QuantifierEliminator eliminate_quantifiers(formula) Returns a quantifier-free equivalent formula of the given formula If explicit_vars is specified. get_py_values(formulae) Evaluates the values of the formulae as python types in the current model returning a dictionary. get_model() Returns an instance of Model that survives the solver instance set_options(options) Sets multiple options at once..2. An optional function can be passed... an explicit enumeration of all the possible models for such variables is computed and quantifier elimination is performed on each disjunct separately. named=None) Add assertion to the solver. .solvers. 5. This simplifies writing code that branches on values in the model. Bool(True) is translated into True.qelim. QuantifierEliminator 21 . . get_py_value(formula) Returns the value of formula as a python type. Assumptions is a list of Boolean variables or negations of boolean variables. If assumptions is specified. an)) res = solve() pop() return res but is in general more efficient. This is a simplified version of the SMT-LIB funtion get_values . Release 0.3 QuantifierEliminator class pysmt. 2.2 22 Chapter 5. API Reference .PySMT Documentation. Release 0. CHAPTER SIX INDICES AND TABLES • genindex • modindex • search 23 . 2 24 Chapter 6. Release 0.2. Indices and tables .PySMT Documentation. 15 25 .shortcuts.PYTHON MODULE INDEX p pysmt. 2. Release 0.2 26 Python Module Index .PySMT Documentation. Solver method).shortcuts). 17 Interpolator() (in module pysmt. 20 get_model() (in module pysmt. 21 AllDifferent() (in module pysmt.Solver method).shortcuts).Solver method).shortcuts).shortcuts). 18 BVRol() (in module pysmt.solver.qelim. 21 get_values() (pysmt.shortcuts).shortcuts). 18 BVNot() (in module pysmt. 18 BVUGE() (in module pysmt.shortcuts). 17 BV() (in module pysmt. 19 BVRor() (in module pysmt.shortcuts). 21 get_py_value() (pysmt. 18 BVMul() (in module pysmt. 18 BVZExt() (in module pysmt.solvers. 15 get_env() (in module pysmt.shortcuts). 21 Div() (in module pysmt.Solver method).shortcuts).solvers.solvers.shortcuts). 19 BVSub() (in module pysmt.shortcuts).shortcuts).shortcuts).Solver method). 19 BVConcat() (in module pysmt. 18 BVNeg() (in module pysmt.shortcuts).QuantifierEliminator method).solver.shortcuts).shortcuts).solver.shortcuts).shortcuts). 15 FreshSymbol() (in module pysmt. 19 BVSExt() (in module pysmt. 17 Exists() (in module pysmt. 20 get_value() (pysmt. 17 ForAll() (in module pysmt. 15 get_unsat_core() (in module pysmt.Solver method). 17 Function() (in module pysmt. 20 GT() (in module pysmt.shortcuts).shortcuts).shortcuts). 19 BVSLT() (in module pysmt.solver.solvers. 19 BVSGE() (in module pysmt.solver. 19 E eliminate_quantifiers() (pysmt.shortcuts).shortcuts).shortcuts).shortcuts). 18 BVZero() (in module pysmt. 18 BVULT() (in module pysmt. 16 get_atoms() (in module pysmt. 15 exit() (pysmt. 19 BVSRem() (in module pysmt.shortcuts). 15 get_free_variables() (in module pysmt.solvers.shortcuts). 17 BVAdd() (in module pysmt.shortcuts). 18 BVXor() (in module pysmt. 16 Implies() (in module pysmt.INDEX A D add_assertion() (pysmt.shortcuts).shortcuts). 20 Bool() (in module pysmt. 16 ExactlyOne() (in module pysmt. 19 BVComp() (in module pysmt.shortcuts).Solver method).shortcuts). 17 AtMostOne() (in module pysmt. 20 get_model() (pysmt. 18 BVAnd() (in module pysmt. 21 get_type() (in module pysmt.shortcuts).solvers. 21 get_py_values() (pysmt.shortcuts).shortcuts).shortcuts).solvers.shortcuts).shortcuts). 16 I Iff() (in module pysmt.shortcuts).shortcuts). 21 Equals() (in module pysmt.shortcuts). 17 declare_variable() (pysmt.shortcuts).shortcuts). 19 BVSGT() (in module pysmt.shortcuts).shortcuts).shortcuts).shortcuts). 18 BVLShl() (in module pysmt. 15 G GE() (in module pysmt. 18 BVULE() (in module pysmt.shortcuts). 18 BVExtract() (in module pysmt.shortcuts). 18 BVUGT() (in module pysmt. 18 BVOne() (in module pysmt. 15 get_implicant() (in module pysmt.shortcuts).shortcuts). 18 BVAShr() (in module pysmt. 19 27 . 17 And() (in module pysmt. 18 BVLShr() (in module pysmt.Solver method).shortcuts).shortcuts).shortcuts).solver.shortcuts). 19 BVSLE() (in module pysmt.shortcuts).shortcuts).shortcuts). 19 is_sat() (in module pysmt. 16 Int() (in module pysmt. 20 F FALSE() (in module pysmt.solver. 18 BVOr() (in module pysmt. 16 B binary_interpolant() (in module pysmt.solver. 19 BVSDiv() (in module pysmt.solvers. 18 BVURem() (in module pysmt. 18 BVUDiv() (in module pysmt.shortcuts).shortcuts). 15 get_formula_size() (in module pysmt.solvers. Solver method).shortcuts). 19 W write_configuration() (in module pysmt. 15 Q qelim() (in module pysmt.Solver method).shortcuts). 20 Real() (in module pysmt.shortcuts).shortcuts). 20 is_valid() (in module pysmt.solvers. 20 Solver() (in module pysmt. 17 TRUE() (in module pysmt. 15 Symbol() (in module pysmt. 17 Min() (in module pysmt. 15 S SBV() (in module pysmt.Solver method). 16 O Or() (in module pysmt. 17 reset_assertions() (pysmt.solver).solver.shortcuts). 20 QuantifierEliminator (class in pysmt. 17 Minus() (in module pysmt.shortcuts).shortcuts). 16 T Times() (in module pysmt.solvers. 19 substitute() (in module pysmt.shortcuts).shortcuts).shortcuts).shortcuts). 16 ToReal() (in module pysmt.solver.Solver method).solver.shortcuts). 16 28 Index .solver.2 is_unsat() (in module pysmt.shortcuts). 15 solve() (pysmt.solvers.shortcuts). 17 N Not() (in module pysmt.shortcuts). 20 print_model() (pysmt. 20 reset_env() (in module pysmt.solver. 20 serialize() (in module pysmt.shortcuts).shortcuts).solvers. 15 set_options() (pysmt. 16 M Max() (in module pysmt.shortcuts). 21 simplify() (in module pysmt. 20 X Xor() (in module pysmt. 17 pop() (pysmt. 20 Ite() (in module pysmt.PySMT Documentation. 21 push() (pysmt.shortcuts).shortcuts). 21 QuantifierEliminator() (in module pysmt.shortcuts). 19 R read_configuration() (in module pysmt.solvers.qelim). 16 LT() (in module pysmt.shortcuts).2. 20 pysmt.shortcuts (module). 21 Solver (class in pysmt. Release 0.shortcuts). 17 P Plus() (in module pysmt.Solver method).shortcuts).shortcuts). 17 sequence_interpolant() (in module pysmt.shortcuts).Solver method).shortcuts).shortcuts).solvers.solvers. 16 L LE() (in module pysmt.solvers. 17 U UnsatCoreSolver() (in module pysmt.shortcuts).solver.
Copyright © 2024 DOKUMEN.SITE Inc.