diff --git a/.project b/.project
new file mode 100644
index 0000000..cbf33d5
--- /dev/null
+++ b/.project
@@ -0,0 +1,11 @@
+
+
+ jSMTLIB
+
+
+
+
+
+
+
+
diff --git a/README.txt b/README.txt
index 7f270e7..90c2c80 100644
--- a/README.txt
+++ b/README.txt
@@ -1,5 +1,5 @@
-jSMTLIB is an open source implementation of SMT-LIB in Java, as a command-line tool, an Eclipse plugin, and an API
-
-
+jSMTLIB is an open source implementation of SMT-LIB in Java, as a command-line tool, an Eclipse plugin, and an API
+
+
This material is based upon work supported by the National Science Foundation under Grant No. ACI-1314674.
Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
diff --git a/SMT/.classpath b/SMT/.classpath
index 0ec1e71..c255df1 100644
--- a/SMT/.classpath
+++ b/SMT/.classpath
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/SMT/.externalToolBuilders/checkers.eclipse.checkerbuilder.launch b/SMT/.externalToolBuilders/checkers.eclipse.checkerbuilder.launch
index 1f7be5f..3fc69d0 100644
--- a/SMT/.externalToolBuilders/checkers.eclipse.checkerbuilder.launch
+++ b/SMT/.externalToolBuilders/checkers.eclipse.checkerbuilder.launch
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/SMT/.project b/SMT/.project
index b810248..d0bc099 100644
--- a/SMT/.project
+++ b/SMT/.project
@@ -1,39 +1,39 @@
-
-
- SMT
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.ui.externaltools.ExternalToolBuilder
- full,incremental,
-
-
- LaunchConfigHandle
- <project>/.externalToolBuilders/checkers.eclipse.checkerbuilder.launch
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- checkers.eclipse.buildnature
- org.eclipse.pde.PluginNature
-
-
+
+
+ SMT
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.ui.externaltools.ExternalToolBuilder
+ full,incremental,
+
+
+ LaunchConfigHandle
+ <project>/.externalToolBuilders/checkers.eclipse.checkerbuilder.launch
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ checkers.eclipse.buildnature
+ org.eclipse.pde.PluginNature
+
+
diff --git a/SMT/LICENSE b/SMT/LICENSE
index 8f249bb..689e94d 100644
--- a/SMT/LICENSE
+++ b/SMT/LICENSE
@@ -1,45 +1,45 @@
-The software with which this license file is associated is
- Copyright (c) 2014 by David R. Cok.
-
-End-User License Agreement
-
-This software is licensed under the terms of the Eclipse Public License
-(www.opensource.org/licenses/EPL-1.0)
-
-SOFTWARE DISCLAIMER OF WARRANTY/LIMITATION ON LIABILITY & REMEDIES.
-Author does not warrant that the SOFTWARE will meet your requirements,
-that operation of the SOFTWARE will be uninterrupted or error-free, or
-that all SOFTWARE errors will be corrected.
-
-THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE
-LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING, THE AUTHOR AND/OR OTHER
-PARTIES PROVIDE THE PROGRAM “AS IS AND WITH ALL FAULTS,” WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESS, IMPLIED OR STATUTORY (IF ANY), INCLUDING, BUT
-NOT LIMITED TO, ANY IMPLIED WARRANTIES, DUTIES OR CONDITIONS OF
-MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF RELIABILITY OR
-AVAILABILITY, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
-WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE, ALL
-WITH REGARD TO THE SOFTWARE, AND THE PROVISION OF OR FAILURE TO PROVIDE
-SUPPORT OR OTHER SERVICES, INFORMATION, SOFTWARE, AND RELATED CONTENT
-THROUGH THE SOFTWARE OR OTHERWISE ARISING OUT OF THE USE OF THE SOFTWARE.
-THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, QUIET
-POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT WITH REGARD
-TO THE SOFTWARE.
-
-IN NO EVENT, UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING,
-WILL AUTHOR AND/OR ANY OTHER PARTY THAT PROVIDES THE SOFTWARE AS PERMITTED
-HEREIN, BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
-CONSEQUENTIAL, INDIRECT OR SIMILAR DAMAGES, INCLUDING, BUT NOT LIMITED TO,
-ANY ECONOMIC LOSS OR LOST DATA ARISING OUT OF THE USE OR INABILITY TO USE
-THE SOFTWARE OR ANY DATA SUPPLIED THEREWITH OR ARISING FROM ANY BREACH OF
-THIS AGREEMENT OR ANY OBLIGATIONS UNDER THIS AGREEMENT OR THE LICENSE
-GRANTED, EVEN IF AUTHOR OR ANYONE ELSE HAS BEEN ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGES, EVEN IN THE EVENT OF FAULT, TORT (INCLUDING NEGLIGENCE),
-MISREPRESENTATION, OR STRICT LIABILITY, OR FOR ANY CLAIM BY ANY OTHER PARTY.
-
-If the disclaimer of warranty and limitation of liability provided herein
-cannot be given local legal effect according to their terms, reviewing
-courts shall apply the controlling law that most closely approximates
-an absolute waiver of all civil liability in connection with the SOFTWARE.
-
-
+The software with which this license file is associated is
+ Copyright (c) 2014 by David R. Cok.
+
+End-User License Agreement
+
+This software is licensed under the terms of the Eclipse Public License
+(www.opensource.org/licenses/EPL-1.0)
+
+SOFTWARE DISCLAIMER OF WARRANTY/LIMITATION ON LIABILITY & REMEDIES.
+Author does not warrant that the SOFTWARE will meet your requirements,
+that operation of the SOFTWARE will be uninterrupted or error-free, or
+that all SOFTWARE errors will be corrected.
+
+THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE
+LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING, THE AUTHOR AND/OR OTHER
+PARTIES PROVIDE THE PROGRAM “AS IS AND WITH ALL FAULTS,” WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESS, IMPLIED OR STATUTORY (IF ANY), INCLUDING, BUT
+NOT LIMITED TO, ANY IMPLIED WARRANTIES, DUTIES OR CONDITIONS OF
+MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF RELIABILITY OR
+AVAILABILITY, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
+WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE, ALL
+WITH REGARD TO THE SOFTWARE, AND THE PROVISION OF OR FAILURE TO PROVIDE
+SUPPORT OR OTHER SERVICES, INFORMATION, SOFTWARE, AND RELATED CONTENT
+THROUGH THE SOFTWARE OR OTHERWISE ARISING OUT OF THE USE OF THE SOFTWARE.
+THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, QUIET
+POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT WITH REGARD
+TO THE SOFTWARE.
+
+IN NO EVENT, UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING,
+WILL AUTHOR AND/OR ANY OTHER PARTY THAT PROVIDES THE SOFTWARE AS PERMITTED
+HEREIN, BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
+CONSEQUENTIAL, INDIRECT OR SIMILAR DAMAGES, INCLUDING, BUT NOT LIMITED TO,
+ANY ECONOMIC LOSS OR LOST DATA ARISING OUT OF THE USE OR INABILITY TO USE
+THE SOFTWARE OR ANY DATA SUPPLIED THEREWITH OR ARISING FROM ANY BREACH OF
+THIS AGREEMENT OR ANY OBLIGATIONS UNDER THIS AGREEMENT OR THE LICENSE
+GRANTED, EVEN IF AUTHOR OR ANYONE ELSE HAS BEEN ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGES, EVEN IN THE EVENT OF FAULT, TORT (INCLUDING NEGLIGENCE),
+MISREPRESENTATION, OR STRICT LIABILITY, OR FOR ANY CLAIM BY ANY OTHER PARTY.
+
+If the disclaimer of warranty and limitation of liability provided herein
+cannot be given local legal effect according to their terms, reviewing
+courts shall apply the controlling law that most closely approximates
+an absolute waiver of all civil liability in connection with the SOFTWARE.
+
+
diff --git a/SMT/META-INF/MANIFEST.MF b/SMT/META-INF/MANIFEST.MF
index 0a0c7df..f6025f0 100644
--- a/SMT/META-INF/MANIFEST.MF
+++ b/SMT/META-INF/MANIFEST.MF
@@ -1,9 +1,9 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: jSMTLIB
-Bundle-SymbolicName: org.smtlib.SMT
-Bundle-Version: 0.9.10.5
-Export-Package: org.smtlib,
- org.smtlib.command,
- org.smtlib.impl
-Require-Bundle: org.junit
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: jSMTLIB
+Bundle-SymbolicName: org.smtlib.SMT
+Bundle-Version: 0.9.10.5
+Export-Package: org.smtlib,
+ org.smtlib.command,
+ org.smtlib.impl
+Require-Bundle: org.junit
diff --git a/SMT/TODO b/SMT/TODO
index 5682e2c..b5a1bc8 100644
--- a/SMT/TODO
+++ b/SMT/TODO
@@ -1,104 +1,104 @@
-Pieces:
- - SMT-LIB checker
- - Adapters to various solvers
- - Network server/client
- - Plugin
- - Tutorial
- - User guide
- - Java API
- - validation suite
- - extensibility
-
-Bug with simplify on copy.smt2
-
-Plugin:
-
- set a time out on jobs
- enabling problem navigation
- reporting exception errors better
- result matrix
- cancelling running job, including long-running solver tasks
- undocked progress monitor
- finish moving strings to properties files
- distinguish dirty files in the console
- allow loading preferences from jsmtlib.properties file by button push
- implement a way to easily add new solvers (either pure SMT or new adapters)
- unsupported responses should be shown in the editor as markers
- errors should be shown in the console window as well
- have a progress monitor
- put in a multipage editor with output to alternate page
- output to a new popup widow
- * expand the HELP document
- * implement options
- DONE - implement different solvers
- DONE - implement markers for errors
- DONE ENOUGH - find out how repairing syntax coloring works
- implement font differences along with coloring for syntax coloring
- DONE - find out how to grab the current (dirty) content of a editor
- implement connections to various solvers
- DONE - fix the icons
- DONE - editor: real-time checking;
- editor: customizing the syntax coloring
- editor: allowing fonts for syntax coloring
- editor: word-completion with reserved words
- DONE - allow multiple selections in context menu
- DONE - no tooltip information when hovering over a marker in an editor
- DONE - plugin does not find logics in classpath
- DONE - control-shift-S does not work to save all dirty SMT editors - NOTE: needs to be explicitly set in the Keys preferences
- The list of logics updates when Apply is pushed ; can it update when the logic directory field is changed?
- Can we make a menu of logics to view that is appropriately dynamic?
- Can we make the default logic Path be a location within the plugin?
- Would like to have the list of solvers (in preferences and in the menu) be dynamic
- Hover information: e.g. type, value in current model
- Symbolic execution given a model
- Navigate to matching ( ); highlight matching ()
- Change selection to left sibling, right sibling, first child, last child, parent
- Find definition
- Find references
- Rename
- Refactor to add, remove a let
- Refactor to add, remove a sort or fcn definition
- Combine or split asserts
- Pretty print/reformat
- showing markers on linked files that are not in the project
- Enable/disable auto typechecking
- Add an another tool bar button solely for type-checking
- Help document
- Show non-OK responses in a plug-in window
- Show get-value responses as a tooltip
- Show logic of the selected file, if no text is selected
-
-App
- cleanup connection of configuration to solvers, e.g. verbosity, print success, logic
- should other SMT options become app options?
- textual error messages with locations indicated for batch processing
- handle reading and checking "par" declarations
- handle restrictions on attributes in logic and theory
- tie sort and fcn parameters to their declarations - will need corresponding visitors
-* checking that expressions are valid in the logic
- general handling of sort with parameterized identifiers
- DONE - implement properties for solver executables and reading a properties file
-* implement strict smtlib behavior
-* refactor the implementation of bit-vector functions. They are all hand-coded.
- Although SMT defines them all informally, we need a cleaner way to implement
- and add to the set of functions within the software.
-Saw crashes when using the driver with multiple commands
-Pretty print mode
-Clean up the code for showing values, maintaining state
-
-
-Bugs
- problem with showing error locations that span lines
- expressions containing let-bound parameters bound to unclosed expressions are not recognized as unclosed
- if properties file is to be read from the directory containing the .jar file,
- the .jar file must be named jSMTLIB.jar
-
-Document
- comment on strict smtlib behavior
-
-Adapters:
-** finish solver adapters
-** implement bitvector extensions
- figure out how to handle sorts within Simplify
- implement options and info in other solvers
-
+Pieces:
+ - SMT-LIB checker
+ - Adapters to various solvers
+ - Network server/client
+ - Plugin
+ - Tutorial
+ - User guide
+ - Java API
+ - validation suite
+ - extensibility
+
+Bug with simplify on copy.smt2
+
+Plugin:
+
+ set a time out on jobs
+ enabling problem navigation
+ reporting exception errors better
+ result matrix
+ cancelling running job, including long-running solver tasks
+ undocked progress monitor
+ finish moving strings to properties files
+ distinguish dirty files in the console
+ allow loading preferences from jsmtlib.properties file by button push
+ implement a way to easily add new solvers (either pure SMT or new adapters)
+ unsupported responses should be shown in the editor as markers
+ errors should be shown in the console window as well
+ have a progress monitor
+ put in a multipage editor with output to alternate page
+ output to a new popup widow
+ * expand the HELP document
+ * implement options
+ DONE - implement different solvers
+ DONE - implement markers for errors
+ DONE ENOUGH - find out how repairing syntax coloring works
+ implement font differences along with coloring for syntax coloring
+ DONE - find out how to grab the current (dirty) content of a editor
+ implement connections to various solvers
+ DONE - fix the icons
+ DONE - editor: real-time checking;
+ editor: customizing the syntax coloring
+ editor: allowing fonts for syntax coloring
+ editor: word-completion with reserved words
+ DONE - allow multiple selections in context menu
+ DONE - no tooltip information when hovering over a marker in an editor
+ DONE - plugin does not find logics in classpath
+ DONE - control-shift-S does not work to save all dirty SMT editors - NOTE: needs to be explicitly set in the Keys preferences
+ The list of logics updates when Apply is pushed ; can it update when the logic directory field is changed?
+ Can we make a menu of logics to view that is appropriately dynamic?
+ Can we make the default logic Path be a location within the plugin?
+ Would like to have the list of solvers (in preferences and in the menu) be dynamic
+ Hover information: e.g. type, value in current model
+ Symbolic execution given a model
+ Navigate to matching ( ); highlight matching ()
+ Change selection to left sibling, right sibling, first child, last child, parent
+ Find definition
+ Find references
+ Rename
+ Refactor to add, remove a let
+ Refactor to add, remove a sort or fcn definition
+ Combine or split asserts
+ Pretty print/reformat
+ showing markers on linked files that are not in the project
+ Enable/disable auto typechecking
+ Add an another tool bar button solely for type-checking
+ Help document
+ Show non-OK responses in a plug-in window
+ Show get-value responses as a tooltip
+ Show logic of the selected file, if no text is selected
+
+App
+ cleanup connection of configuration to solvers, e.g. verbosity, print success, logic
+ should other SMT options become app options?
+ textual error messages with locations indicated for batch processing
+ handle reading and checking "par" declarations
+ handle restrictions on attributes in logic and theory
+ tie sort and fcn parameters to their declarations - will need corresponding visitors
+* checking that expressions are valid in the logic
+ general handling of sort with parameterized identifiers
+ DONE - implement properties for solver executables and reading a properties file
+* implement strict smtlib behavior
+* refactor the implementation of bit-vector functions. They are all hand-coded.
+ Although SMT defines them all informally, we need a cleaner way to implement
+ and add to the set of functions within the software.
+Saw crashes when using the driver with multiple commands
+Pretty print mode
+Clean up the code for showing values, maintaining state
+
+
+Bugs
+ problem with showing error locations that span lines
+ expressions containing let-bound parameters bound to unclosed expressions are not recognized as unclosed
+ if properties file is to be read from the directory containing the .jar file,
+ the .jar file must be named jSMTLIB.jar
+
+Document
+ comment on strict smtlib behavior
+
+Adapters:
+** finish solver adapters
+** implement bitvector extensions
+ figure out how to handle sorts within Simplify
+ implement options and info in other solvers
+
diff --git a/SMT/bugs/temp.smt2 b/SMT/bugs/temp.smt2
index 8a96803..0009ecb 100644
--- a/SMT/bugs/temp.smt2
+++ b/SMT/bugs/temp.smt2
@@ -1,11 +1,11 @@
-(set-option :produce-models true)
-(set-logic ALL)
-(declare-const yyy Bool)
-
-; quantifiers and patterns
-(declare-sort S 0)
-(declare-fun le (S S) Bool)
-(declare-fun zz () S)
-(assert (forall ((x S)(y S)(z S)) (=> (and (le x y)(le y z)) (le x z))))
-(assert (exists ((x S)(y S)(z S)) (=> (and (le x y)(le y z)) (le x z))))
-(assert (forall ((x S)(y S)(z S)) (! (=> (and (le x y)(le y z)) (le x z)) :pattern ((le x zz)) :pattern ((le y zz) (le zz z)) )))
+(set-option :produce-models true)
+(set-logic ALL)
+(declare-const yyy Bool)
+
+; quantifiers and patterns
+(declare-sort S 0)
+(declare-fun le (S S) Bool)
+(declare-fun zz () S)
+(assert (forall ((x S)(y S)(z S)) (=> (and (le x y)(le y z)) (le x z))))
+(assert (exists ((x S)(y S)(z S)) (=> (and (le x y)(le y z)) (le x z))))
+(assert (forall ((x S)(y S)(z S)) (! (=> (and (le x y)(le y z)) (le x z)) :pattern ((le x zz)) :pattern ((le y zz) (le zz z)) )))
diff --git a/SMT/bugs/temp2.smt2 b/SMT/bugs/temp2.smt2
index e90303a..63fb3a0 100644
--- a/SMT/bugs/temp2.smt2
+++ b/SMT/bugs/temp2.smt2
@@ -1,15 +1,15 @@
-; Submitted as a bug in that QF_LIA should not support declaring new sorts
-; From Morgan Deters, 3/15/2014
-(set-logic QF_LIA)
-(set-info :smt-lib-version 2.0)
-(set-info :category "unknown")
-(set-info :status unknown)
-(declare-sort S1 0)
-(declare-fun f1 () S1)
-(declare-fun f2 () S1)
-(declare-fun f3 () Int)
-(declare-fun f4 () Int)
-(assert (not (= f1 f2)))
-(assert (not (and (<= 0 (ite (< f3 0) (* (- 2) f3) (* 2 f3))) (<= 0 (ite (< f4 0) (* (- 2) f4) (* 2 f4))))))
-(check-sat)
-(exit)
+; Submitted as a bug in that QF_LIA should not support declaring new sorts
+; From Morgan Deters, 3/15/2014
+(set-logic QF_LIA)
+(set-info :smt-lib-version 2.0)
+(set-info :category "unknown")
+(set-info :status unknown)
+(declare-sort S1 0)
+(declare-fun f1 () S1)
+(declare-fun f2 () S1)
+(declare-fun f3 () Int)
+(declare-fun f4 () Int)
+(assert (not (= f1 f2)))
+(assert (not (and (<= 0 (ite (< f3 0) (* (- 2) f3) (* 2 f3))) (<= 0 (ite (< f4 0) (* (- 2) f4) (* 2 f4))))))
+(check-sat)
+(exit)
diff --git a/SMT/build.properties b/SMT/build.properties
index 9d361b8..6cc35ab 100644
--- a/SMT/build.properties
+++ b/SMT/build.properties
@@ -1,7 +1,7 @@
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- jsmtlib.properties,\
- LICENSE
-src.includes = jsmtlib.properties,\
- LICENSE
+source.. = src/
+bin.includes = META-INF/,\
+ .,\
+ jsmtlib.properties,\
+ LICENSE
+src.includes = jsmtlib.properties,\
+ LICENSE
diff --git a/SMT/javadoc.xml b/SMT/javadoc.xml
index 62e4712..1f8491e 100644
--- a/SMT/javadoc.xml
+++ b/SMT/javadoc.xml
@@ -1,6 +1,6 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/SMT/jsmtlib.properties-template b/SMT/jsmtlib.properties-template
index 92bf36d..e9ce187 100644
--- a/SMT/jsmtlib.properties-template
+++ b/SMT/jsmtlib.properties-template
@@ -1,33 +1,33 @@
-# This file is a template - it lists all the properties that the jSMTLIB
-# application pays attention to. You should customize the values for your
-# own system. The application looks for jsmtlib.properties in the working
-# directory first and then anywhere on the classpath.
-
-# The directory in which logic and theory definitions are found
-# (if not set, the files from the official distribution as distributed in
-# the .jar file are used - there should be only a rare need to set this)
-# This value can also be set on the command-line by the --logics option.
-org.smtlib.logic_path=
-
-# The default solver to use. This can be overridden on the command-line with
-# the --solver option. If not set the default is to type-check only.
-##org.smtlib.default-solver=
-
-# The adapter class to use for the solver. If not specified, then solver ZZZ
-# will use class org.smtlib.Solver_ZZZ. If that does not exist, the solver
-# is presumed to use the pure SMT adapter: org.smtlib.Solver_smt.
-# (Replace ZZZ with the solver name)
-##org.smtlib.solver_ZZZ.adapter=
-
-# A solver must have either an executable or a whole command-line specified.
-# The absolute path to the executable for each solver. This value is overridden
-# by any value specified on the command-line (--exec option)
-org.smtlib.solver_yices.exec=
-org.smtlib.solver_cvc.exec=
-org.smtlib.solver_z3_2_11.exec=
-org.smtlib.solver_z3_4_3.exec=
-org.smtlib.solver_simplify.exec=
-
-# A command (executable + arguments) is specified by a comma-separated list
-# of executable path and arguments, with no extraneous spaces, in the form
+# This file is a template - it lists all the properties that the jSMTLIB
+# application pays attention to. You should customize the values for your
+# own system. The application looks for jsmtlib.properties in the working
+# directory first and then anywhere on the classpath.
+
+# The directory in which logic and theory definitions are found
+# (if not set, the files from the official distribution as distributed in
+# the .jar file are used - there should be only a rare need to set this)
+# This value can also be set on the command-line by the --logics option.
+org.smtlib.logic_path=
+
+# The default solver to use. This can be overridden on the command-line with
+# the --solver option. If not set the default is to type-check only.
+##org.smtlib.default-solver=
+
+# The adapter class to use for the solver. If not specified, then solver ZZZ
+# will use class org.smtlib.Solver_ZZZ. If that does not exist, the solver
+# is presumed to use the pure SMT adapter: org.smtlib.Solver_smt.
+# (Replace ZZZ with the solver name)
+##org.smtlib.solver_ZZZ.adapter=
+
+# A solver must have either an executable or a whole command-line specified.
+# The absolute path to the executable for each solver. This value is overridden
+# by any value specified on the command-line (--exec option)
+org.smtlib.solver_yices.exec=
+org.smtlib.solver_cvc.exec=
+org.smtlib.solver_z3_2_11.exec=
+org.smtlib.solver_z3_4_3.exec=
+org.smtlib.solver_simplify.exec=
+
+# A command (executable + arguments) is specified by a comma-separated list
+# of executable path and arguments, with no extraneous spaces, in the form
##org.smtlib.solver_ZZZ.command=EXE,arg1,arg2
\ No newline at end of file
diff --git a/SMT/launchConfigurations/Push jSMTLIB to SourceForge.launch b/SMT/launchConfigurations/Push jSMTLIB to SourceForge.launch
index fbd377d..e4ff3b2 100644
--- a/SMT/launchConfigurations/Push jSMTLIB to SourceForge.launch
+++ b/SMT/launchConfigurations/Push jSMTLIB to SourceForge.launch
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SMT/launchConfigurations/SMT app.launch b/SMT/launchConfigurations/SMT app.launch
index 11b050e..dfd772e 100644
--- a/SMT/launchConfigurations/SMT app.launch
+++ b/SMT/launchConfigurations/SMT app.launch
@@ -1,17 +1,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SMT/launchConfigurations/SMT javadoc.xml.launch b/SMT/launchConfigurations/SMT javadoc.xml.launch
index eb734b8..ebf0e0b 100644
--- a/SMT/launchConfigurations/SMT javadoc.xml.launch
+++ b/SMT/launchConfigurations/SMT javadoc.xml.launch
@@ -1,17 +1,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SMT/launchConfigurations/SMT plugin.launch b/SMT/launchConfigurations/SMT plugin.launch
index ef45518..44872d1 100644
--- a/SMT/launchConfigurations/SMT plugin.launch
+++ b/SMT/launchConfigurations/SMT plugin.launch
@@ -1,182 +1,182 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SMT/logics/ALIA.smt2 b/SMT/logics/ALIA.smt2
index 5ebe5db..0e4a309 100644
--- a/SMT/logics/ALIA.smt2
+++ b/SMT/logics/ALIA.smt2
@@ -1,22 +1,22 @@
-(logic ALIA
-
- :smt-lib-version 2.0
- :written_by "David Cok, from QF_ALIA"
- :date "2015-06-27"
-
- :theories (Ints ArraysEx)
-
- :language
- "Closed formulas built over arbitrary expansions of the
- Ints and ArraysEx signatures with free constant symbols, but
- with the following restrictions:
- - all terms of sort Int are linear, that is, have no occurrences of the
- function symbols *, /, div, mod, and abs, except as specified in the
- :extensions attributes;
- - all array terms have sort (Array Int Int).
- "
-
- :extensions
- "As in the logic QF_LIA."
-)
-
+(logic ALIA
+
+ :smt-lib-version 2.0
+ :written_by "David Cok, from QF_ALIA"
+ :date "2015-06-27"
+
+ :theories (Ints ArraysEx)
+
+ :language
+ "Closed formulas built over arbitrary expansions of the
+ Ints and ArraysEx signatures with free constant symbols, but
+ with the following restrictions:
+ - all terms of sort Int are linear, that is, have no occurrences of the
+ function symbols *, /, div, mod, and abs, except as specified in the
+ :extensions attributes;
+ - all array terms have sort (Array Int Int).
+ "
+
+ :extensions
+ "As in the logic QF_LIA."
+)
+
diff --git a/SMT/logics/ALL.smt2 b/SMT/logics/ALL.smt2
index dcd45d7..a7792ba 100644
--- a/SMT/logics/ALL.smt2
+++ b/SMT/logics/ALL.smt2
@@ -1,11 +1,11 @@
-(logic ALL
-
- :smt-lib-version 2.5
- :written_by "David Cok"
-
- :theories (Core ArraysEx Reals_Ints FloatingPoint Fixed_Size_BitVectors)
-
- ;; This is a special logic that maps to a most general logic supported by the chosen solver
-)
-
-
+(logic ALL
+
+ :smt-lib-version 2.5
+ :written_by "David Cok"
+
+ :theories (Core ArraysEx Reals_Ints FloatingPoint Fixed_Size_BitVectors)
+
+ ;; This is a special logic that maps to a most general logic supported by the chosen solver
+)
+
+
diff --git a/SMT/logics/AUFLIA.smt2 b/SMT/logics/AUFLIA.smt2
index c0b1045..2255984 100644
--- a/SMT/logics/AUFLIA.smt2
+++ b/SMT/logics/AUFLIA.smt2
@@ -1,27 +1,27 @@
-(logic AUFLIA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-30"
-
- :theories (Ints ArraysEx)
-
- :language
- "Closed formulas built over arbitrary expansions of the Ints and ArraysEx
- signatures with free sort and function symbols, but with the following
- restrictions:
- - all terms of sort Int are linear, that is, have no occurrences of the
- function symbols *, /, div, mod, and abs, except as specified in the
- :extensions attributes;
- - all array terms have sort (Array Int Int).
- "
-
- :extensions
- "As in the logic QF_AUFLIA."
-
-:notes
- "This logic properly extends the logic QF_AUFLIA by allowing quantifiers."
-
-)
-
-
+(logic AUFLIA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-30"
+
+ :theories (Ints ArraysEx)
+
+ :language
+ "Closed formulas built over arbitrary expansions of the Ints and ArraysEx
+ signatures with free sort and function symbols, but with the following
+ restrictions:
+ - all terms of sort Int are linear, that is, have no occurrences of the
+ function symbols *, /, div, mod, and abs, except as specified in the
+ :extensions attributes;
+ - all array terms have sort (Array Int Int).
+ "
+
+ :extensions
+ "As in the logic QF_AUFLIA."
+
+:notes
+ "This logic properly extends the logic QF_AUFLIA by allowing quantifiers."
+
+)
+
+
diff --git a/SMT/logics/AUFLIRA.smt2 b/SMT/logics/AUFLIRA.smt2
index 9174f97..3aedf55 100644
--- a/SMT/logics/AUFLIRA.smt2
+++ b/SMT/logics/AUFLIRA.smt2
@@ -1,42 +1,42 @@
-(logic AUFLIRA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli and Clark Barrett"
- :date "2010-05-05"
-
- :theories (Reals_Ints ArraysEx)
-
-:language
- "Closed formulas built over arbitrary expansions of the Reals_Ints and
- ArraysEx signatures with free sort and function symbols, but with the
- following restrictions:
- - all terms of sort Int are linear, that is, have no occurrences of the
- function symbols *, /, div, mod, and abs, except as specified in the
- :extensions attributes;
- - all terms of sort Real are linear, that is, have no occurrences of the
- function symbols * and /, except as specified in the
- :extensions attribute;
- - all array terms have sort
- (Array Int Real) or
- (Array Int (Array Int Real)).
- "
-
-:extensions
- "For every operator op with declaration (op Real Real s) for some sort s,
- and every term t1, t2 of sort Int and t of sort Real, the expression
- - (op t1 t) is syntactic sugar for (op (to_real t1) t)
- - (op t t1) is syntactic sugar for (op t (to_real t1))
- - (/ t1 t2) is syntactic sugar for (/ (to_real t1) (to_real t2))
- "
-
- :extensions
- "Real or Int terms with _concrete_ coefficients are also allowed, that is,
- terms of the form (* c x), or (* x c) where
- x is a free constant of sort Int or Real and
- c is an integer or rational coefficient, respectively.
- - An integer coefficient is a term of the form m or (- m) for some
- numeral m.
- - A rational coefficient is a term of the form d, (- d) or (/ c n)
- for some decimal d, integer coefficient c and numeral n other than 0.
- "
+(logic AUFLIRA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli and Clark Barrett"
+ :date "2010-05-05"
+
+ :theories (Reals_Ints ArraysEx)
+
+:language
+ "Closed formulas built over arbitrary expansions of the Reals_Ints and
+ ArraysEx signatures with free sort and function symbols, but with the
+ following restrictions:
+ - all terms of sort Int are linear, that is, have no occurrences of the
+ function symbols *, /, div, mod, and abs, except as specified in the
+ :extensions attributes;
+ - all terms of sort Real are linear, that is, have no occurrences of the
+ function symbols * and /, except as specified in the
+ :extensions attribute;
+ - all array terms have sort
+ (Array Int Real) or
+ (Array Int (Array Int Real)).
+ "
+
+:extensions
+ "For every operator op with declaration (op Real Real s) for some sort s,
+ and every term t1, t2 of sort Int and t of sort Real, the expression
+ - (op t1 t) is syntactic sugar for (op (to_real t1) t)
+ - (op t t1) is syntactic sugar for (op t (to_real t1))
+ - (/ t1 t2) is syntactic sugar for (/ (to_real t1) (to_real t2))
+ "
+
+ :extensions
+ "Real or Int terms with _concrete_ coefficients are also allowed, that is,
+ terms of the form (* c x), or (* x c) where
+ x is a free constant of sort Int or Real and
+ c is an integer or rational coefficient, respectively.
+ - An integer coefficient is a term of the form m or (- m) for some
+ numeral m.
+ - A rational coefficient is a term of the form d, (- d) or (/ c n)
+ for some decimal d, integer coefficient c and numeral n other than 0.
+ "
)
\ No newline at end of file
diff --git a/SMT/logics/AUFNIRA.smt2 b/SMT/logics/AUFNIRA.smt2
index 90f7ed2..4e86ea9 100644
--- a/SMT/logics/AUFNIRA.smt2
+++ b/SMT/logics/AUFNIRA.smt2
@@ -1,26 +1,26 @@
-(logic AUFNIRA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli and Clark Barrett"
- :date "2010-05-12"
-
- :theories (Reals_Ints ArraysEx)
-
-:language
- "Closed formulas built over arbitrary expansions of the Reals_Ints and
- ArraysEx signatures with free sort and function symbols.
- "
-
-:extensions
- "For every operator op with declaration (op Real Real s) for some sort s,
- and every term t1, t2 of sort Int and t of sort Real, the expression
- - (op t1 t) is syntactic sugar for (op (to_real t1) t)
- - (op t t1) is syntactic sugar for (op t (to_real t1))
- - (/ t1 t2) is syntactic sugar for (/ (to_real t1) (to_real t2))
- "
-
-:notes
- "This logic properly extends the logic AUFLIRA by allowing non-linear
- (integer/real) operators such as *, /, div, mod, and abs.
- "
-)
+(logic AUFNIRA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli and Clark Barrett"
+ :date "2010-05-12"
+
+ :theories (Reals_Ints ArraysEx)
+
+:language
+ "Closed formulas built over arbitrary expansions of the Reals_Ints and
+ ArraysEx signatures with free sort and function symbols.
+ "
+
+:extensions
+ "For every operator op with declaration (op Real Real s) for some sort s,
+ and every term t1, t2 of sort Int and t of sort Real, the expression
+ - (op t1 t) is syntactic sugar for (op (to_real t1) t)
+ - (op t t1) is syntactic sugar for (op t (to_real t1))
+ - (/ t1 t2) is syntactic sugar for (/ (to_real t1) (to_real t2))
+ "
+
+:notes
+ "This logic properly extends the logic AUFLIRA by allowing non-linear
+ (integer/real) operators such as *, /, div, mod, and abs.
+ "
+)
diff --git a/SMT/logics/ArraysEx.smt2 b/SMT/logics/ArraysEx.smt2
index 59757bc..04053be 100644
--- a/SMT/logics/ArraysEx.smt2
+++ b/SMT/logics/ArraysEx.smt2
@@ -1,38 +1,38 @@
-(theory ArraysEx
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-28"
- :last_modified "2010-08-15"
-
- :sorts ((Array 2))
-
- :funs ((par (X Y) (select (Array X Y) X Y))
- (par (X Y) (store (Array X Y) X Y (Array X Y))) )
-
- :notes "A schematic version of the theory of functional arrays with extensionality."
-
- :definition
- "For every expanded signature Sigma, the instance of ArraysEx with that signature
- is the theory consisting of all Sigma-models that satisfy all axioms of the form
- below, for all sorts s1, s2 in Sigma:
-
- - (forall ((a (Array s1 s2)) (i s1) (e s2))
- (= (select (store a i e) i) e))
-
- - (forall ((a (Array s1 s2)) (i s1) (j s1) (e s2))
- (=> (distinct i j)
- (= (select (store a i e) j) (select a j))))
-
- - (forall ((a (Array s1 s2)) (b (Array s1 s2)))
- (=> (forall ((i s1)) (= (select a i) (select b i)))
- (= a b)))
- "
-
- :values
- "For all sorts s1, s2 in in the signature, the values of sort (Array s1 s2) are
- abstract.
- "
-)
-
-
+(theory ArraysEx
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-28"
+ :last_modified "2010-08-15"
+
+ :sorts ((Array 2))
+
+ :funs ((par (X Y) (select (Array X Y) X Y))
+ (par (X Y) (store (Array X Y) X Y (Array X Y))) )
+
+ :notes "A schematic version of the theory of functional arrays with extensionality."
+
+ :definition
+ "For every expanded signature Sigma, the instance of ArraysEx with that signature
+ is the theory consisting of all Sigma-models that satisfy all axioms of the form
+ below, for all sorts s1, s2 in Sigma:
+
+ - (forall ((a (Array s1 s2)) (i s1) (e s2))
+ (= (select (store a i e) i) e))
+
+ - (forall ((a (Array s1 s2)) (i s1) (j s1) (e s2))
+ (=> (distinct i j)
+ (= (select (store a i e) j) (select a j))))
+
+ - (forall ((a (Array s1 s2)) (b (Array s1 s2)))
+ (=> (forall ((i s1)) (= (select a i) (select b i)))
+ (= a b)))
+ "
+
+ :values
+ "For all sorts s1, s2 in in the signature, the values of sort (Array s1 s2) are
+ abstract.
+ "
+)
+
+
diff --git a/SMT/logics/BV.smt2 b/SMT/logics/BV.smt2
index ac5e8c3..f5d77f6 100644
--- a/SMT/logics/BV.smt2
+++ b/SMT/logics/BV.smt2
@@ -1,237 +1,237 @@
-(logic BV
-
-:smt-lib-version 2.0
-:written_by "David Cok, from QF_BV"
-:date "2015-06-27"
-
-:theories (Fixed_Size_BitVectors)
-
-:language
- "Closed formulas built over an arbitrary expansion of the
- Fixed_Size_BitVectors signature with free constant symbols over the sorts
- (_ BitVec m) for 0 < m. Formulas in ite terms must satisfy the same
- restriction as well, with the exception that they need not be closed
- (because they may be in the scope of a let binder).
- "
-
-:notes
- "For quick reference, the following is a brief and informal summary of the
- legal symbols in this logic and their meaning (formal definitions are found
- either in the Fixed_Size_Bitvectors theory, or in the extensions below).
-
- Defined in theory Fixed_Size_Bitvectors:
-
-
- Bitvector constants:
-
- - #bX where X is a binary numeral of length m defines the
- bitvector constant with value X and size m.
- - #xX where X is a hexadecimal numeral of length m defines the
- bitvector constant with value X and size 4*m.
-
- Functions:
-
- (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
- - concatenation of bitvectors of size i and j to get a new bitvector of
- size m, where m = i + j
- ((_ extract i j) (_ BitVec m) (_ BitVec n))
- - extraction of bits i down to j from a bitvector of size m to yield a
- new bitvector of size n, where n = i - j + 1
- (bvnot (_ BitVec m) (_ BitVec m))
- - bitwise negation
- (bvand (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise and
- (bvor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise or
- (bvneg (_ BitVec m) (_ BitVec m))
- - 2's complement unary minus
- (bvadd (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - addition modulo 2^m
- (bvmul (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - multiplication modulo 2^m
- (bvudiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - unsigned division, truncating towards 0 (undefined if divisor is 0)
- (bvurem (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - unsigned remainder from truncating division (undefined if divisor is 0)
- (bvshl (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - shift left (equivalent to multiplication by 2^x where x is the value of
- the second argument)
- (bvlshr (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - logical shift right (equivalent to unsigned division by 2^x where x is
- the value of the second argument)
- (bvult (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned less-than
-
- Defined below:
-
- Functions:
-
- (bvnand (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise nand (negation of and)
- (bvnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise nor (negation of or)
- (bvxor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise exclusive or
- (bvxnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise equivalence (equivalently, negation of bitwise exclusive or)
- (bvcomp (_ BitVec m) (_ BitVec m) (_ BitVec 1))
- - bit comparator: equals #b1 iff all bits are equal
- (bvsub (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement subtraction modulo 2^m
- (bvsdiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed division
- (bvsrem (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed remainder (sign follows dividend)
- (bvsmod (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed remainder (sign follows divisor)
- (bvashr (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - Arithmetic shift right, like logical shift right except that the most
- significant bits of the result always copy the most significant
- bit of the first argument.
-
- The following symbols are parameterized by the numeral i, where i >= 1.
-
- ((_ repeat i) (_ BitVec m) (_ BitVec i*m))
- - ((_ repeat i) x) means concatenate i copies of x
-
- The following symbols are parameterized by the numeral i, where i >= 0.
-
- ((_ zero_extend i) (_ BitVec m) (_ BitVec m+i))
- - ((_ zero_extend i) x) means extend x with zeroes to the (unsigned)
- equivalent bitvector of size m+i
- ((_ sign_extend i) (_ BitVec m) (_ BitVec m+i))
- - ((_ sign_extend i) x) means extend x to the (signed) equivalent bitvector
- of size m+i
- ((_ rotate_left i) (_ BitVec m) (_ BitVec m))
- - ((_ rotate_left i) x) means rotate bits of x to the left i times
- ((_ rotate_right i) (_ BitVec m) (_ BitVec m))
- - ((_ rotate_right i) x) means rotate bits of x to the right i times
-
- (bvule (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned less than or equal
- (bvugt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned greater than
- (bvuge (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned greater than or equal
- (bvslt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed less than
- (bvsle (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed less than or equal
- (bvsgt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed greater than
- (bvsge (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed greater than or equal
-
- "
-
-:extensions
- "Below, let |exp| denote the integer resulting from the evaluation
- of the arithmetic expression exp.
-
- - Bitvector Constants:
- (_ bvX n) where X and n are numerals, i.e. (_ bv13 32),
- abbreviates the term #bY of sort (_ BitVec n) such that
-
- [[#bY]] = nat2bv[n](X) for X=0, ..., 2^n - 1.
-
- See the specification of the theory's semantics for a definition
- of the functions [[_]] and nat2bv. Note that this convention implicitly
- considers the numeral X as a number written in base 10.
-
- - Bitwise operators
-
- For all terms s,t of sort (_ BitVec m), where 0 < m,
-
- (bvnand s t) abbreviates (bvnot (bvand s t))
- (bvnor s t) abbreviates (bvnot (bvor s t))
- (bvxor s t) abbreviates (bvor (bvand s (bvnot t)) (bvand (bvnot s) t))
- (bvxnor s t) abbreviates (bvor (bvand s t) (bvand (bvnot s) (bvnot t)))
- (bvcomp s t) abbreviates (bvxnor s t) if m = 1, and
- (bvand (bvxnor ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvcomp ((_ extract |m-2| 0) s) ((_ extract |m-2| 0) t))) otherwise
-
- - Arithmetic operators
-
- For all terms s,t of sort (_ BitVec m), where 0 < m,
-
- (bvsub s t) abbreviates (bvadd s (bvneg t))
- (bvsdiv s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvudiv s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvneg (bvudiv (bvneg s) t))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvneg (bvudiv s (bvneg t)))
- (bvudiv (bvneg s) (bvneg t))))))
- (bvsrem s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvurem s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvneg (bvurem (bvneg s) t))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvurem s (bvneg t)))
- (bvneg (bvurem (bvneg s) (bvneg t))))))
- (bvsmod s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvurem s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvadd (bvneg (bvurem (bvneg s) t)) t)
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvadd (bvurem s (bvneg t)) t)
- (bvneg (bvurem (bvneg s) (bvneg t)))))))
- (bvule s t) abbreviates (or (bvult s t) (= s t))
- (bvugt s t) abbreviates (bvult t s)
- (bvuge s t) abbreviates (or (bvult t s) (= s t))
- (bvslt s t) abbreviates:
- (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
- (= ((_ extract |m-1| |m-1|) t) #b0))
- (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvult s t)))
- (bvsle s t) abbreviates:
- (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
- (= ((_ extract |m-1| |m-1|) t) #b0))
- (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvule s t)))
- (bvsgt s t) abbreviates (bvslt t s)
- (bvsge s t) abbreviates (bvsle t s)
-
- - Other operations
-
- For all numerals i > 0, j > 1 and 0 < m, and all terms s and t of
- sort (_ BitVec m),
-
- (bvashr s t) abbreviates
- (ite (= ((_ extract |m-1| |m-1|) s) #b0)
- (bvlshr s t)
- (bvnot (bvlshr (bvnot s) t)))
-
- ((_ repeat 1) t) stands for t
- ((_ repeat j) t) abbreviates (concat t ((_ repeat |j-1|) t))
-
- ((_ zero_extend 0) t) stands for t
- ((_ zero_extend i) t) abbreviates (concat ((_ repeat i) #b0) t)
-
- ((_ sign_extend 0) t) stands for t
- ((_ sign_extend i) t) abbreviates
- (concat ((_ repeat i) ((_ extract |m-1| |m-1|) t)) t)
-
- ((_ rotate_left 0) t) stands for t
- ((_ rotate_left i) t) abbreviates t if m = 1, and
- ((_ rotate_left |i-1|)
- (concat ((_ extract |m-2| 0) t) ((_ extract |m-1| |m-1|) t))
- otherwise
-
- ((_ rotate_right 0) t) stands for t
- ((_ rotate_right i) t) abbreviates t if m = 1, and
- ((_ rotate_right |i-1|)
- (concat ((_ extract 0 0) t) ((_ extract |m-1| 1) t)))
- otherwise
- "
-)
-
+(logic BV
+
+:smt-lib-version 2.0
+:written_by "David Cok, from QF_BV"
+:date "2015-06-27"
+
+:theories (Fixed_Size_BitVectors)
+
+:language
+ "Closed formulas built over an arbitrary expansion of the
+ Fixed_Size_BitVectors signature with free constant symbols over the sorts
+ (_ BitVec m) for 0 < m. Formulas in ite terms must satisfy the same
+ restriction as well, with the exception that they need not be closed
+ (because they may be in the scope of a let binder).
+ "
+
+:notes
+ "For quick reference, the following is a brief and informal summary of the
+ legal symbols in this logic and their meaning (formal definitions are found
+ either in the Fixed_Size_Bitvectors theory, or in the extensions below).
+
+ Defined in theory Fixed_Size_Bitvectors:
+
+
+ Bitvector constants:
+
+ - #bX where X is a binary numeral of length m defines the
+ bitvector constant with value X and size m.
+ - #xX where X is a hexadecimal numeral of length m defines the
+ bitvector constant with value X and size 4*m.
+
+ Functions:
+
+ (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
+ - concatenation of bitvectors of size i and j to get a new bitvector of
+ size m, where m = i + j
+ ((_ extract i j) (_ BitVec m) (_ BitVec n))
+ - extraction of bits i down to j from a bitvector of size m to yield a
+ new bitvector of size n, where n = i - j + 1
+ (bvnot (_ BitVec m) (_ BitVec m))
+ - bitwise negation
+ (bvand (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise and
+ (bvor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise or
+ (bvneg (_ BitVec m) (_ BitVec m))
+ - 2's complement unary minus
+ (bvadd (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - addition modulo 2^m
+ (bvmul (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - multiplication modulo 2^m
+ (bvudiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - unsigned division, truncating towards 0 (undefined if divisor is 0)
+ (bvurem (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - unsigned remainder from truncating division (undefined if divisor is 0)
+ (bvshl (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - shift left (equivalent to multiplication by 2^x where x is the value of
+ the second argument)
+ (bvlshr (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - logical shift right (equivalent to unsigned division by 2^x where x is
+ the value of the second argument)
+ (bvult (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned less-than
+
+ Defined below:
+
+ Functions:
+
+ (bvnand (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise nand (negation of and)
+ (bvnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise nor (negation of or)
+ (bvxor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise exclusive or
+ (bvxnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise equivalence (equivalently, negation of bitwise exclusive or)
+ (bvcomp (_ BitVec m) (_ BitVec m) (_ BitVec 1))
+ - bit comparator: equals #b1 iff all bits are equal
+ (bvsub (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement subtraction modulo 2^m
+ (bvsdiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed division
+ (bvsrem (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed remainder (sign follows dividend)
+ (bvsmod (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed remainder (sign follows divisor)
+ (bvashr (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - Arithmetic shift right, like logical shift right except that the most
+ significant bits of the result always copy the most significant
+ bit of the first argument.
+
+ The following symbols are parameterized by the numeral i, where i >= 1.
+
+ ((_ repeat i) (_ BitVec m) (_ BitVec i*m))
+ - ((_ repeat i) x) means concatenate i copies of x
+
+ The following symbols are parameterized by the numeral i, where i >= 0.
+
+ ((_ zero_extend i) (_ BitVec m) (_ BitVec m+i))
+ - ((_ zero_extend i) x) means extend x with zeroes to the (unsigned)
+ equivalent bitvector of size m+i
+ ((_ sign_extend i) (_ BitVec m) (_ BitVec m+i))
+ - ((_ sign_extend i) x) means extend x to the (signed) equivalent bitvector
+ of size m+i
+ ((_ rotate_left i) (_ BitVec m) (_ BitVec m))
+ - ((_ rotate_left i) x) means rotate bits of x to the left i times
+ ((_ rotate_right i) (_ BitVec m) (_ BitVec m))
+ - ((_ rotate_right i) x) means rotate bits of x to the right i times
+
+ (bvule (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned less than or equal
+ (bvugt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned greater than
+ (bvuge (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned greater than or equal
+ (bvslt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed less than
+ (bvsle (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed less than or equal
+ (bvsgt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed greater than
+ (bvsge (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed greater than or equal
+
+ "
+
+:extensions
+ "Below, let |exp| denote the integer resulting from the evaluation
+ of the arithmetic expression exp.
+
+ - Bitvector Constants:
+ (_ bvX n) where X and n are numerals, i.e. (_ bv13 32),
+ abbreviates the term #bY of sort (_ BitVec n) such that
+
+ [[#bY]] = nat2bv[n](X) for X=0, ..., 2^n - 1.
+
+ See the specification of the theory's semantics for a definition
+ of the functions [[_]] and nat2bv. Note that this convention implicitly
+ considers the numeral X as a number written in base 10.
+
+ - Bitwise operators
+
+ For all terms s,t of sort (_ BitVec m), where 0 < m,
+
+ (bvnand s t) abbreviates (bvnot (bvand s t))
+ (bvnor s t) abbreviates (bvnot (bvor s t))
+ (bvxor s t) abbreviates (bvor (bvand s (bvnot t)) (bvand (bvnot s) t))
+ (bvxnor s t) abbreviates (bvor (bvand s t) (bvand (bvnot s) (bvnot t)))
+ (bvcomp s t) abbreviates (bvxnor s t) if m = 1, and
+ (bvand (bvxnor ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvcomp ((_ extract |m-2| 0) s) ((_ extract |m-2| 0) t))) otherwise
+
+ - Arithmetic operators
+
+ For all terms s,t of sort (_ BitVec m), where 0 < m,
+
+ (bvsub s t) abbreviates (bvadd s (bvneg t))
+ (bvsdiv s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvudiv s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvneg (bvudiv (bvneg s) t))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvneg (bvudiv s (bvneg t)))
+ (bvudiv (bvneg s) (bvneg t))))))
+ (bvsrem s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvurem s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvneg (bvurem (bvneg s) t))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvurem s (bvneg t)))
+ (bvneg (bvurem (bvneg s) (bvneg t))))))
+ (bvsmod s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvurem s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvadd (bvneg (bvurem (bvneg s) t)) t)
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvadd (bvurem s (bvneg t)) t)
+ (bvneg (bvurem (bvneg s) (bvneg t)))))))
+ (bvule s t) abbreviates (or (bvult s t) (= s t))
+ (bvugt s t) abbreviates (bvult t s)
+ (bvuge s t) abbreviates (or (bvult t s) (= s t))
+ (bvslt s t) abbreviates:
+ (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
+ (= ((_ extract |m-1| |m-1|) t) #b0))
+ (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvult s t)))
+ (bvsle s t) abbreviates:
+ (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
+ (= ((_ extract |m-1| |m-1|) t) #b0))
+ (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvule s t)))
+ (bvsgt s t) abbreviates (bvslt t s)
+ (bvsge s t) abbreviates (bvsle t s)
+
+ - Other operations
+
+ For all numerals i > 0, j > 1 and 0 < m, and all terms s and t of
+ sort (_ BitVec m),
+
+ (bvashr s t) abbreviates
+ (ite (= ((_ extract |m-1| |m-1|) s) #b0)
+ (bvlshr s t)
+ (bvnot (bvlshr (bvnot s) t)))
+
+ ((_ repeat 1) t) stands for t
+ ((_ repeat j) t) abbreviates (concat t ((_ repeat |j-1|) t))
+
+ ((_ zero_extend 0) t) stands for t
+ ((_ zero_extend i) t) abbreviates (concat ((_ repeat i) #b0) t)
+
+ ((_ sign_extend 0) t) stands for t
+ ((_ sign_extend i) t) abbreviates
+ (concat ((_ repeat i) ((_ extract |m-1| |m-1|) t)) t)
+
+ ((_ rotate_left 0) t) stands for t
+ ((_ rotate_left i) t) abbreviates t if m = 1, and
+ ((_ rotate_left |i-1|)
+ (concat ((_ extract |m-2| 0) t) ((_ extract |m-1| |m-1|) t))
+ otherwise
+
+ ((_ rotate_right 0) t) stands for t
+ ((_ rotate_right i) t) abbreviates t if m = 1, and
+ ((_ rotate_right |i-1|)
+ (concat ((_ extract 0 0) t) ((_ extract |m-1| 1) t)))
+ otherwise
+ "
+)
+
diff --git a/SMT/logics/Core.smt2 b/SMT/logics/Core.smt2
index ef511a8..6bd2aef 100644
--- a/SMT/logics/Core.smt2
+++ b/SMT/logics/Core.smt2
@@ -1,44 +1,44 @@
-(theory Core
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-17"
- :last_modified "2010-08-15"
-
- :sorts ((Bool 0))
-
- :funs ((true Bool)
- (false Bool)
- (not Bool Bool)
- (=> Bool Bool Bool :right-assoc)
- (and Bool Bool Bool :left-assoc)
- (or Bool Bool Bool :left-assoc)
- (xor Bool Bool Bool :left-assoc)
- (par (A) (= A A Bool :chainable))
- (par (A) (distinct A A Bool :pairwise))
- (par (A) (ite Bool A A A))
- )
-
- :definition
- "For every expanded signature Sigma, the instance of Core with that signature
- is the theory consisting of all Sigma-models in which:
-
- - the sort Bool denotes the set {true, false} of Boolean values;
-
- - for all sorts s in Sigma,
- - (= s s Bool) denotes the function that
- returns true iff its two arguments are identical;
- - (distinct s s Bool) denotes the function that
- returns true iff its two arguments are not identical;
- - (ite Bool s s) denotes the function that
- returns its second argument or its third depending on whether
- its first argument is true or not;
-
- - the other function symbols of Core denote the standard Boolean operators
- as expected.
- "
- :values
- "The set of values for the sort Bool is {true, false}."
-)
-
-
+(theory Core
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-17"
+ :last_modified "2010-08-15"
+
+ :sorts ((Bool 0))
+
+ :funs ((true Bool)
+ (false Bool)
+ (not Bool Bool)
+ (=> Bool Bool Bool :right-assoc)
+ (and Bool Bool Bool :left-assoc)
+ (or Bool Bool Bool :left-assoc)
+ (xor Bool Bool Bool :left-assoc)
+ (par (A) (= A A Bool :chainable))
+ (par (A) (distinct A A Bool :pairwise))
+ (par (A) (ite Bool A A A))
+ )
+
+ :definition
+ "For every expanded signature Sigma, the instance of Core with that signature
+ is the theory consisting of all Sigma-models in which:
+
+ - the sort Bool denotes the set {true, false} of Boolean values;
+
+ - for all sorts s in Sigma,
+ - (= s s Bool) denotes the function that
+ returns true iff its two arguments are identical;
+ - (distinct s s Bool) denotes the function that
+ returns true iff its two arguments are not identical;
+ - (ite Bool s s) denotes the function that
+ returns its second argument or its third depending on whether
+ its first argument is true or not;
+
+ - the other function symbols of Core denote the standard Boolean operators
+ as expected.
+ "
+ :values
+ "The set of values for the sort Bool is {true, false}."
+)
+
+
diff --git a/SMT/logics/Core.smt2.saved b/SMT/logics/Core.smt2.saved
index 416489b..9a49cc7 100644
--- a/SMT/logics/Core.smt2.saved
+++ b/SMT/logics/Core.smt2.saved
@@ -1,44 +1,44 @@
-(theory Core
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-17"
- :last_modified "2010-08-15"
-
- :sorts ((Bool 0))
-
- :funs ((true Bool)
- (false Bool)
- (not Bool Bool)
- (=> Bool Bool Bool :right-assoc)
- (and Bool Bool Bool :left-assoc)
- (or Bool Bool Bool :left-assoc)
- (xor Bool Bool Bool :left-assoc)
- (par (A) (= A A Bool) :chainable)
- (par (A) (distinct A A Bool) :pairwise)
- (par (A) (ite Bool A A A))
- )
-
- :definition
- "For every expanded signature Sigma, the instance of Core with that signature
- is the theory consisting of all Sigma-models in which:
-
- - the sort Bool denotes the set {true, false} of Boolean values;
-
- - for all sorts s in Sigma,
- - (= s s Bool) denotes the function that
- returns true iff its two arguments are identical;
- - (distinct s s Bool) denotes the function that
- returns true iff its two arguments are not identical;
- - (ite Bool s s) denotes the function that
- returns its second argument or its third depending on whether
- its first argument is true or not;
-
- - the other function symbols of Core denote the standard Boolean operators
- as expected.
- "
- :values
- "The set of values for the sort Bool is {true, false}."
-)
-
-
+(theory Core
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-17"
+ :last_modified "2010-08-15"
+
+ :sorts ((Bool 0))
+
+ :funs ((true Bool)
+ (false Bool)
+ (not Bool Bool)
+ (=> Bool Bool Bool :right-assoc)
+ (and Bool Bool Bool :left-assoc)
+ (or Bool Bool Bool :left-assoc)
+ (xor Bool Bool Bool :left-assoc)
+ (par (A) (= A A Bool) :chainable)
+ (par (A) (distinct A A Bool) :pairwise)
+ (par (A) (ite Bool A A A))
+ )
+
+ :definition
+ "For every expanded signature Sigma, the instance of Core with that signature
+ is the theory consisting of all Sigma-models in which:
+
+ - the sort Bool denotes the set {true, false} of Boolean values;
+
+ - for all sorts s in Sigma,
+ - (= s s Bool) denotes the function that
+ returns true iff its two arguments are identical;
+ - (distinct s s Bool) denotes the function that
+ returns true iff its two arguments are not identical;
+ - (ite Bool s s) denotes the function that
+ returns its second argument or its third depending on whether
+ its first argument is true or not;
+
+ - the other function symbols of Core denote the standard Boolean operators
+ as expected.
+ "
+ :values
+ "The set of values for the sort Bool is {true, false}."
+)
+
+
diff --git a/SMT/logics/FixedSizeBitVectors2.smt2 b/SMT/logics/FixedSizeBitVectors2.smt2
index a2975a5..7fb79e0 100644
--- a/SMT/logics/FixedSizeBitVectors2.smt2
+++ b/SMT/logics/FixedSizeBitVectors2.smt2
@@ -1,194 +1,194 @@
-(theory FixedSizeBitVectors
-
- :smt-lib-version 2.6
- :written_by "Silvio Ranise, Cesare Tinelli, and Clark Barrett"
- :date "2010-05-02"
-
- :notes
- "This theory declaration defines a core theory for fixed-size bitvectors
- where the operations of concatenation and extraction of bitvectors as well
- as the usual logical and arithmetic operations are overloaded.
- "
-
- :sorts_description "
- All sort symbols of the form (_ BitVec m)
- where m is a numeral greater than 0.
- "
-
- :funs_description "
- All binaries #bX of sort (_ BitVec m) where m is the number of digits in X.
- All hexadeximals #xX of sort (_ BitVec m) where m is 4 times the number of
- digits in X.
- "
-
- :funs_description "
- All function symbols with declaration of the form
-
- (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
-
- where
- - i,j,m are numerals
- - i,j > 0
- - i + j = m
- "
-
- :funs_description "
- All function symbols with declaration of the form
-
- ((_ extract i j) (_ BitVec m) (_ BitVec n))
-
- where
- - i,j,m,n are numerals
- - m > i >= j >= 0,
- - n = i-j+1
- "
-
- :funs_description "
- All function symbols with declaration of the form
-
- (op1 (_ BitVec m) (_ BitVec m))
- or
- (op2 (_ BitVec m) (_ BitVec m) (_ BitVec m))
-
- where
- - op1 is from {bvnot, bvneg}
- - op2 is from {bvand, bvor, bvadd, bvmul, bvudiv, bvurem, bvshl, bvlshr}
- - m is a numeral greater than 0
- "
-
- :funs_description "
- All function symbols with declaration of the form
-
- (bvult (_ BitVec m) (_ BitVec m) Bool)
-
- where
- - m is a numeral greater than 0
- "
-
- :definition
- "For every expanded signature Sigma, the instance of Fixed_Size_BitVectors
- with that signature is the theory consisting of all Sigma-models that
- satisfy the constraints detailed below.
-
- The sort (_ BitVec m), for m > 0, is the set of finite functions
- whose domain is the initial segment of the naturals [0...m), meaning
- that 0 is included and m is excluded, and the co-domain is {0,1}.
-
- To define some of the semantics below, we need the following additional
- functions :
-
- o _ div _, which takes an integer x >= 0 and an integer y > 0 and returns
- the integer part of x divided by y (i.e., truncated integer division).
-
- o _ rem _, which takes an integer x >= 0 and y > 0 and returns the
- remainder when x is divided by y. Note that we always have the following
- equivalence (for y > 0): (x div y) * y + (x rem y) = x.
-
- o bv2nat, which takes a bitvector b: [0...m) --> {0,1}
- with 0 < m, and returns an integer in the range [0...2^m),
- and is defined as follows:
-
- bv2nat(b) := b(m-1)*2^{m-1} + b(m-2)*2^{m-2} + ... + b(0)*2^0
-
- o nat2bv[m], with 0 < m, which takes a non-negative integer
- n and returns the (unique) bitvector b: [0,...,m) -> {0,1}
- such that
-
- b(m-1)*2^{m-1} + ... + b(0)*2^0 = n rem 2^m
-
- The semantic interpretation [[_]] of well-sorted BitVec-terms is
- inductively defined as follows.
-
- - Variables
-
- If v is a variable of sort (_ BitVec m) with 0 < m, then
- [[v]] is some element of [{0,...,m-1} -> {0,1}], the set of total
- functions from {0,...,m-1} to {0,1}.
-
- - Constant symbols
-
- The constant symbols #b0 and #b1 of sort (_ BitVec 1) are defined as follows
-
- [[#b0]] := \lambda x : [0,1). 0
- [[#b1]] := \lambda x : [0,1). 1
-
- More generally, given a string #b followed by a sequence of 0's and 1's,
- if n is the numeral represented in base 2 by the sequence of 0's and 1's
- and m is the length of the sequence, then the term represents
- nat2bv[m](n).
-
- The string #x followed by a sequence of digits and/or letters from A to
- F is interpreted similarly: if n is the numeral represented in hexadecimal
- (base 16) by the sequence of digits and letters from A to F and m is four
- times the length of the sequence, then the term represents nat2bv[m](n).
- For example, #xFF is equivalent to #b11111111.
-
- - Function symbols for concatenation
-
- [[(concat s t)]] := \lambda x : [0...n+m).
- if (x 0.
-
- [[(bvneg s)]] := nat2bv[m](2^m - bv2nat([[s]]))
-
- [[(bvadd s t)]] := nat2bv[m](bv2nat([[s]]) + bv2nat([[t]]))
-
- [[(bvmul s t)]] := nat2bv[m](bv2nat([[s]]) * bv2nat([[t]]))
-
- [[(bvudiv s t)]] := if bv2nat([[t]]) != 0 then
- nat2bv[m](bv2nat([[s]]) div bv2nat([[t]]))
-
- [[(bvurem s t)]] := if bv2nat([[t]]) != 0 then
- nat2bv[m](bv2nat([[s]]) rem bv2nat([[t]]))
-
- - Shift operations
-
- Suppose s and t are both terms of sort (_ BitVec m), m > 0. We make use of
- the definitions given for the arithmetic operations, above.
-
- [[(bvshl s t)]] := nat2bv[m](bv2nat([[s]]) * 2^(bv2nat([[t]])))
-
- [[(bvlshr s t)]] := nat2bv[m](bv2nat([[s]]) div 2^(bv2nat([[t]])))
-
- Finally, we can define bvult:
-
- [[bvult s t]] := true iff bv2nat([[s]]) < bv2nat([[t]])
- "
-
-:notes
- "The constraints on the theory models do not specify the meaning of
- (bvudiv s t) or (bvurem s t) in case bv2nat([[t]]) is 0.
- Since the semantics of SMT-LIB's underlying logic associates *total*
- functions to function symbols, this means that we consider as models
- of this theory *any* interpretation conforming to the specifications
- in the definition field (and defining bvudiv and bvurem arbitrarily
- when the second argument evaluates to 0).
- Solvers supporting this theory then cannot make any any assumptions
- about the value of (bvudiv s t) or (bvurem s t) when t evaluates to 0.
- "
-
-)
+(theory FixedSizeBitVectors
+
+ :smt-lib-version 2.6
+ :written_by "Silvio Ranise, Cesare Tinelli, and Clark Barrett"
+ :date "2010-05-02"
+
+ :notes
+ "This theory declaration defines a core theory for fixed-size bitvectors
+ where the operations of concatenation and extraction of bitvectors as well
+ as the usual logical and arithmetic operations are overloaded.
+ "
+
+ :sorts_description "
+ All sort symbols of the form (_ BitVec m)
+ where m is a numeral greater than 0.
+ "
+
+ :funs_description "
+ All binaries #bX of sort (_ BitVec m) where m is the number of digits in X.
+ All hexadeximals #xX of sort (_ BitVec m) where m is 4 times the number of
+ digits in X.
+ "
+
+ :funs_description "
+ All function symbols with declaration of the form
+
+ (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
+
+ where
+ - i,j,m are numerals
+ - i,j > 0
+ - i + j = m
+ "
+
+ :funs_description "
+ All function symbols with declaration of the form
+
+ ((_ extract i j) (_ BitVec m) (_ BitVec n))
+
+ where
+ - i,j,m,n are numerals
+ - m > i >= j >= 0,
+ - n = i-j+1
+ "
+
+ :funs_description "
+ All function symbols with declaration of the form
+
+ (op1 (_ BitVec m) (_ BitVec m))
+ or
+ (op2 (_ BitVec m) (_ BitVec m) (_ BitVec m))
+
+ where
+ - op1 is from {bvnot, bvneg}
+ - op2 is from {bvand, bvor, bvadd, bvmul, bvudiv, bvurem, bvshl, bvlshr}
+ - m is a numeral greater than 0
+ "
+
+ :funs_description "
+ All function symbols with declaration of the form
+
+ (bvult (_ BitVec m) (_ BitVec m) Bool)
+
+ where
+ - m is a numeral greater than 0
+ "
+
+ :definition
+ "For every expanded signature Sigma, the instance of Fixed_Size_BitVectors
+ with that signature is the theory consisting of all Sigma-models that
+ satisfy the constraints detailed below.
+
+ The sort (_ BitVec m), for m > 0, is the set of finite functions
+ whose domain is the initial segment of the naturals [0...m), meaning
+ that 0 is included and m is excluded, and the co-domain is {0,1}.
+
+ To define some of the semantics below, we need the following additional
+ functions :
+
+ o _ div _, which takes an integer x >= 0 and an integer y > 0 and returns
+ the integer part of x divided by y (i.e., truncated integer division).
+
+ o _ rem _, which takes an integer x >= 0 and y > 0 and returns the
+ remainder when x is divided by y. Note that we always have the following
+ equivalence (for y > 0): (x div y) * y + (x rem y) = x.
+
+ o bv2nat, which takes a bitvector b: [0...m) --> {0,1}
+ with 0 < m, and returns an integer in the range [0...2^m),
+ and is defined as follows:
+
+ bv2nat(b) := b(m-1)*2^{m-1} + b(m-2)*2^{m-2} + ... + b(0)*2^0
+
+ o nat2bv[m], with 0 < m, which takes a non-negative integer
+ n and returns the (unique) bitvector b: [0,...,m) -> {0,1}
+ such that
+
+ b(m-1)*2^{m-1} + ... + b(0)*2^0 = n rem 2^m
+
+ The semantic interpretation [[_]] of well-sorted BitVec-terms is
+ inductively defined as follows.
+
+ - Variables
+
+ If v is a variable of sort (_ BitVec m) with 0 < m, then
+ [[v]] is some element of [{0,...,m-1} -> {0,1}], the set of total
+ functions from {0,...,m-1} to {0,1}.
+
+ - Constant symbols
+
+ The constant symbols #b0 and #b1 of sort (_ BitVec 1) are defined as follows
+
+ [[#b0]] := \lambda x : [0,1). 0
+ [[#b1]] := \lambda x : [0,1). 1
+
+ More generally, given a string #b followed by a sequence of 0's and 1's,
+ if n is the numeral represented in base 2 by the sequence of 0's and 1's
+ and m is the length of the sequence, then the term represents
+ nat2bv[m](n).
+
+ The string #x followed by a sequence of digits and/or letters from A to
+ F is interpreted similarly: if n is the numeral represented in hexadecimal
+ (base 16) by the sequence of digits and letters from A to F and m is four
+ times the length of the sequence, then the term represents nat2bv[m](n).
+ For example, #xFF is equivalent to #b11111111.
+
+ - Function symbols for concatenation
+
+ [[(concat s t)]] := \lambda x : [0...n+m).
+ if (x 0.
+
+ [[(bvneg s)]] := nat2bv[m](2^m - bv2nat([[s]]))
+
+ [[(bvadd s t)]] := nat2bv[m](bv2nat([[s]]) + bv2nat([[t]]))
+
+ [[(bvmul s t)]] := nat2bv[m](bv2nat([[s]]) * bv2nat([[t]]))
+
+ [[(bvudiv s t)]] := if bv2nat([[t]]) != 0 then
+ nat2bv[m](bv2nat([[s]]) div bv2nat([[t]]))
+
+ [[(bvurem s t)]] := if bv2nat([[t]]) != 0 then
+ nat2bv[m](bv2nat([[s]]) rem bv2nat([[t]]))
+
+ - Shift operations
+
+ Suppose s and t are both terms of sort (_ BitVec m), m > 0. We make use of
+ the definitions given for the arithmetic operations, above.
+
+ [[(bvshl s t)]] := nat2bv[m](bv2nat([[s]]) * 2^(bv2nat([[t]])))
+
+ [[(bvlshr s t)]] := nat2bv[m](bv2nat([[s]]) div 2^(bv2nat([[t]])))
+
+ Finally, we can define bvult:
+
+ [[bvult s t]] := true iff bv2nat([[s]]) < bv2nat([[t]])
+ "
+
+:notes
+ "The constraints on the theory models do not specify the meaning of
+ (bvudiv s t) or (bvurem s t) in case bv2nat([[t]]) is 0.
+ Since the semantics of SMT-LIB's underlying logic associates *total*
+ functions to function symbols, this means that we consider as models
+ of this theory *any* interpretation conforming to the specifications
+ in the definition field (and defining bvudiv and bvurem arbitrarily
+ when the second argument evaluates to 0).
+ Solvers supporting this theory then cannot make any any assumptions
+ about the value of (bvudiv s t) or (bvurem s t) when t evaluates to 0.
+ "
+
+)
diff --git a/SMT/logics/Fixed_Size_BitVectors.smt2 b/SMT/logics/Fixed_Size_BitVectors.smt2
index 399da33..8c8545b 100644
--- a/SMT/logics/Fixed_Size_BitVectors.smt2
+++ b/SMT/logics/Fixed_Size_BitVectors.smt2
@@ -1,194 +1,194 @@
-(theory Fixed_Size_BitVectors
-
- :smt-lib-version 2.0
- :written_by "Silvio Ranise, Cesare Tinelli, and Clark Barrett"
- :date "2010-05-02"
-
- :notes
- "This theory declaration defines a core theory for fixed-size bitvectors
- where the operations of concatenation and extraction of bitvectors as well
- as the usual logical and arithmetic operations are overloaded.
- "
-
- :sorts_description "
- All sort symbols of the form (_ BitVec m)
- where m is a numeral greater than 0.
- "
-
- :funs_description "
- All binaries #bX of sort (_ BitVec m) where m is the number of digits in X.
- All hexadeximals #xX of sort (_ BitVec m) where m is 4 times the number of
- digits in X.
- "
-
- :funs_description "
- All function symbols with declaration of the form
-
- (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
-
- where
- - i,j,m are numerals
- - i,j > 0
- - i + j = m
- "
-
- :funs_description "
- All function symbols with declaration of the form
-
- ((_ extract i j) (_ BitVec m) (_ BitVec n))
-
- where
- - i,j,m,n are numerals
- - m > i >= j >= 0,
- - n = i-j+1
- "
-
- :funs_description "
- All function symbols with declaration of the form
-
- (op1 (_ BitVec m) (_ BitVec m))
- or
- (op2 (_ BitVec m) (_ BitVec m) (_ BitVec m))
-
- where
- - op1 is from {bvnot, bvneg}
- - op2 is from {bvand, bvor, bvadd, bvmul, bvudiv, bvurem, bvshl, bvlshr}
- - m is a numeral greater than 0
- "
-
- :funs_description "
- All function symbols with declaration of the form
-
- (bvult (_ BitVec m) (_ BitVec m) Bool)
-
- where
- - m is a numeral greater than 0
- "
-
- :definition
- "For every expanded signature Sigma, the instance of Fixed_Size_BitVectors
- with that signature is the theory consisting of all Sigma-models that
- satisfy the constraints detailed below.
-
- The sort (_ BitVec m), for m > 0, is the set of finite functions
- whose domain is the initial segment of the naturals [0...m), meaning
- that 0 is included and m is excluded, and the co-domain is {0,1}.
-
- To define some of the semantics below, we need the following additional
- functions :
-
- o _ div _, which takes an integer x >= 0 and an integer y > 0 and returns
- the integer part of x divided by y (i.e., truncated integer division).
-
- o _ rem _, which takes an integer x >= 0 and y > 0 and returns the
- remainder when x is divided by y. Note that we always have the following
- equivalence (for y > 0): (x div y) * y + (x rem y) = x.
-
- o bv2nat, which takes a bitvector b: [0...m) --> {0,1}
- with 0 < m, and returns an integer in the range [0...2^m),
- and is defined as follows:
-
- bv2nat(b) := b(m-1)*2^{m-1} + b(m-2)*2^{m-2} + ... + b(0)*2^0
-
- o nat2bv[m], with 0 < m, which takes a non-negative integer
- n and returns the (unique) bitvector b: [0,...,m) -> {0,1}
- such that
-
- b(m-1)*2^{m-1} + ... + b(0)*2^0 = n rem 2^m
-
- The semantic interpretation [[_]] of well-sorted BitVec-terms is
- inductively defined as follows.
-
- - Variables
-
- If v is a variable of sort (_ BitVec m) with 0 < m, then
- [[v]] is some element of [{0,...,m-1} -> {0,1}], the set of total
- functions from {0,...,m-1} to {0,1}.
-
- - Constant symbols
-
- The constant symbols #b0 and #b1 of sort (_ BitVec 1) are defined as follows
-
- [[#b0]] := \lambda x : [0,1). 0
- [[#b1]] := \lambda x : [0,1). 1
-
- More generally, given a string #b followed by a sequence of 0's and 1's,
- if n is the numeral represented in base 2 by the sequence of 0's and 1's
- and m is the length of the sequence, then the term represents
- nat2bv[m](n).
-
- The string #x followed by a sequence of digits and/or letters from A to
- F is interpreted similarly: if n is the numeral represented in hexadecimal
- (base 16) by the sequence of digits and letters from A to F and m is four
- times the length of the sequence, then the term represents nat2bv[m](n).
- For example, #xFF is equivalent to #b11111111.
-
- - Function symbols for concatenation
-
- [[(concat s t)]] := \lambda x : [0...n+m).
- if (x 0.
-
- [[(bvneg s)]] := nat2bv[m](2^m - bv2nat([[s]]))
-
- [[(bvadd s t)]] := nat2bv[m](bv2nat([[s]]) + bv2nat([[t]]))
-
- [[(bvmul s t)]] := nat2bv[m](bv2nat([[s]]) * bv2nat([[t]]))
-
- [[(bvudiv s t)]] := if bv2nat([[t]]) != 0 then
- nat2bv[m](bv2nat([[s]]) div bv2nat([[t]]))
-
- [[(bvurem s t)]] := if bv2nat([[t]]) != 0 then
- nat2bv[m](bv2nat([[s]]) rem bv2nat([[t]]))
-
- - Shift operations
-
- Suppose s and t are both terms of sort (_ BitVec m), m > 0. We make use of
- the definitions given for the arithmetic operations, above.
-
- [[(bvshl s t)]] := nat2bv[m](bv2nat([[s]]) * 2^(bv2nat([[t]])))
-
- [[(bvlshr s t)]] := nat2bv[m](bv2nat([[s]]) div 2^(bv2nat([[t]])))
-
- Finally, we can define bvult:
-
- [[bvult s t]] := true iff bv2nat([[s]]) < bv2nat([[t]])
- "
-
-:notes
- "The constraints on the theory models do not specify the meaning of
- (bvudiv s t) or (bvurem s t) in case bv2nat([[t]]) is 0.
- Since the semantics of SMT-LIB's underlying logic associates *total*
- functions to function symbols, this means that we consider as models
- of this theory *any* interpretation conforming to the specifications
- in the definition field (and defining bvudiv and bvurem arbitrarily
- when the second argument evaluates to 0).
- Solvers supporting this theory then cannot make any any assumptions
- about the value of (bvudiv s t) or (bvurem s t) when t evaluates to 0.
- "
-
-)
+(theory Fixed_Size_BitVectors
+
+ :smt-lib-version 2.0
+ :written_by "Silvio Ranise, Cesare Tinelli, and Clark Barrett"
+ :date "2010-05-02"
+
+ :notes
+ "This theory declaration defines a core theory for fixed-size bitvectors
+ where the operations of concatenation and extraction of bitvectors as well
+ as the usual logical and arithmetic operations are overloaded.
+ "
+
+ :sorts_description "
+ All sort symbols of the form (_ BitVec m)
+ where m is a numeral greater than 0.
+ "
+
+ :funs_description "
+ All binaries #bX of sort (_ BitVec m) where m is the number of digits in X.
+ All hexadeximals #xX of sort (_ BitVec m) where m is 4 times the number of
+ digits in X.
+ "
+
+ :funs_description "
+ All function symbols with declaration of the form
+
+ (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
+
+ where
+ - i,j,m are numerals
+ - i,j > 0
+ - i + j = m
+ "
+
+ :funs_description "
+ All function symbols with declaration of the form
+
+ ((_ extract i j) (_ BitVec m) (_ BitVec n))
+
+ where
+ - i,j,m,n are numerals
+ - m > i >= j >= 0,
+ - n = i-j+1
+ "
+
+ :funs_description "
+ All function symbols with declaration of the form
+
+ (op1 (_ BitVec m) (_ BitVec m))
+ or
+ (op2 (_ BitVec m) (_ BitVec m) (_ BitVec m))
+
+ where
+ - op1 is from {bvnot, bvneg}
+ - op2 is from {bvand, bvor, bvadd, bvmul, bvudiv, bvurem, bvshl, bvlshr}
+ - m is a numeral greater than 0
+ "
+
+ :funs_description "
+ All function symbols with declaration of the form
+
+ (bvult (_ BitVec m) (_ BitVec m) Bool)
+
+ where
+ - m is a numeral greater than 0
+ "
+
+ :definition
+ "For every expanded signature Sigma, the instance of Fixed_Size_BitVectors
+ with that signature is the theory consisting of all Sigma-models that
+ satisfy the constraints detailed below.
+
+ The sort (_ BitVec m), for m > 0, is the set of finite functions
+ whose domain is the initial segment of the naturals [0...m), meaning
+ that 0 is included and m is excluded, and the co-domain is {0,1}.
+
+ To define some of the semantics below, we need the following additional
+ functions :
+
+ o _ div _, which takes an integer x >= 0 and an integer y > 0 and returns
+ the integer part of x divided by y (i.e., truncated integer division).
+
+ o _ rem _, which takes an integer x >= 0 and y > 0 and returns the
+ remainder when x is divided by y. Note that we always have the following
+ equivalence (for y > 0): (x div y) * y + (x rem y) = x.
+
+ o bv2nat, which takes a bitvector b: [0...m) --> {0,1}
+ with 0 < m, and returns an integer in the range [0...2^m),
+ and is defined as follows:
+
+ bv2nat(b) := b(m-1)*2^{m-1} + b(m-2)*2^{m-2} + ... + b(0)*2^0
+
+ o nat2bv[m], with 0 < m, which takes a non-negative integer
+ n and returns the (unique) bitvector b: [0,...,m) -> {0,1}
+ such that
+
+ b(m-1)*2^{m-1} + ... + b(0)*2^0 = n rem 2^m
+
+ The semantic interpretation [[_]] of well-sorted BitVec-terms is
+ inductively defined as follows.
+
+ - Variables
+
+ If v is a variable of sort (_ BitVec m) with 0 < m, then
+ [[v]] is some element of [{0,...,m-1} -> {0,1}], the set of total
+ functions from {0,...,m-1} to {0,1}.
+
+ - Constant symbols
+
+ The constant symbols #b0 and #b1 of sort (_ BitVec 1) are defined as follows
+
+ [[#b0]] := \lambda x : [0,1). 0
+ [[#b1]] := \lambda x : [0,1). 1
+
+ More generally, given a string #b followed by a sequence of 0's and 1's,
+ if n is the numeral represented in base 2 by the sequence of 0's and 1's
+ and m is the length of the sequence, then the term represents
+ nat2bv[m](n).
+
+ The string #x followed by a sequence of digits and/or letters from A to
+ F is interpreted similarly: if n is the numeral represented in hexadecimal
+ (base 16) by the sequence of digits and letters from A to F and m is four
+ times the length of the sequence, then the term represents nat2bv[m](n).
+ For example, #xFF is equivalent to #b11111111.
+
+ - Function symbols for concatenation
+
+ [[(concat s t)]] := \lambda x : [0...n+m).
+ if (x 0.
+
+ [[(bvneg s)]] := nat2bv[m](2^m - bv2nat([[s]]))
+
+ [[(bvadd s t)]] := nat2bv[m](bv2nat([[s]]) + bv2nat([[t]]))
+
+ [[(bvmul s t)]] := nat2bv[m](bv2nat([[s]]) * bv2nat([[t]]))
+
+ [[(bvudiv s t)]] := if bv2nat([[t]]) != 0 then
+ nat2bv[m](bv2nat([[s]]) div bv2nat([[t]]))
+
+ [[(bvurem s t)]] := if bv2nat([[t]]) != 0 then
+ nat2bv[m](bv2nat([[s]]) rem bv2nat([[t]]))
+
+ - Shift operations
+
+ Suppose s and t are both terms of sort (_ BitVec m), m > 0. We make use of
+ the definitions given for the arithmetic operations, above.
+
+ [[(bvshl s t)]] := nat2bv[m](bv2nat([[s]]) * 2^(bv2nat([[t]])))
+
+ [[(bvlshr s t)]] := nat2bv[m](bv2nat([[s]]) div 2^(bv2nat([[t]])))
+
+ Finally, we can define bvult:
+
+ [[bvult s t]] := true iff bv2nat([[s]]) < bv2nat([[t]])
+ "
+
+:notes
+ "The constraints on the theory models do not specify the meaning of
+ (bvudiv s t) or (bvurem s t) in case bv2nat([[t]]) is 0.
+ Since the semantics of SMT-LIB's underlying logic associates *total*
+ functions to function symbols, this means that we consider as models
+ of this theory *any* interpretation conforming to the specifications
+ in the definition field (and defining bvudiv and bvurem arbitrarily
+ when the second argument evaluates to 0).
+ Solvers supporting this theory then cannot make any any assumptions
+ about the value of (bvudiv s t) or (bvurem s t) when t evaluates to 0.
+ "
+
+)
diff --git a/SMT/logics/FloatingPoint.smt2 b/SMT/logics/FloatingPoint.smt2
index 17730e5..6bd021d 100644
--- a/SMT/logics/FloatingPoint.smt2
+++ b/SMT/logics/FloatingPoint.smt2
@@ -1,531 +1,531 @@
-(theory FloatingPoint
-
- :smt-lib-version 2.5
- :written-by "Cesare Tinelli and Martin Brain"
- :date "2014-05-27"
- :last-updated "2015-04-25"
- :update-history
- "2015-04-25 Updated to Version 2.5.
- Updated reference to tech report.
- "
-
- :notes
- "This is a theory of floating point numbers largely based on the IEEE standard
- 754-2008 for floating-point arithmetic (http://grouper.ieee.org/groups/754/)
- but restricted to the binary case only.
- A major extension over 754-2008 is that the theory has a sort for every
- possible exponent and significand length.
-
- Version 1 of the theory was based on proposal by P. Ruemmer and T. Wahl [RW10].
-
- [RW10] Philipp Ruemmer and Thomas Wahl.
- An SMT-LIB Theory of Binary Floating-Point Arithmetic.
- Proceedings of the 8th International Workshop on
- Satisfiability Modulo Theories (SMT'10), Edinburgh, UK, July 2010.
- (http://www.philipp.ruemmer.org/publications/smt-fpa.pdf)
-
- Version 2 was written by C. Tinelli using community feedback.
- Version 3, the current one, was written by C. Tinelli and M. Brain following
- further discussion within the SMT-LIB community, and then relaborated with
- P. Ruemmer and T. Wahl.
- A more detailed description of this version together with the rationale of
- several models decisions as well as a formal semantics of the theory can be
- found in
-
- [BTRW15] Martin Brain, Cesare Tinelli, Philipp Ruemmer, and Thomas Wahl.
- An Automatable Formal Semantics for IEEE-754 Floating-Point Arithmetic
- Technical Report, 2015.
- (http://smt-lib.org/papers/BTRW15.pdf)
-
- The following additional people provided substantial feedback and directions:
- François Bobot, David Cok, Alberto Griggio, Florian Lapschies, Leonardo de
- Moura, Gabriele Paganelli, Cody Roux, Christoph Wintersteiger.
- "
-
-;-------
-; Sorts
-;-------
-
- :sorts ((RoundingMode 0) (Real 0))
-
- ; Bit vector sorts, indexed by vector size
- :sorts_description "All sort symbols of the form
- (_ BitVec m)
- where m is a numeral greater than 0."
-
- ; Floating point sort, indexed by the length of the exponent and significand
- ; components of the number
- :sorts_description "All nullary sort symbols of the form
-
- (_ FloatingPoint eb sb),
-
- where eb and sb are numerals greater than 1."
-
- :note
- "eb defines the number of bits in the exponent;
- sb defines the number of bits in the significand, *including* the hidden bit.
- "
-
-; Short name for common floating point sorts
-:sort ((Float16 0) (Float32 0) (Float64 0) (Float128 0))
-
- :note "
- - Float16 is a synonym for (_ FloatingPoint 5 11)
- - Float32 is a synonym for (_ FloatingPoint 8 24)
- - Float64 is a synonym for (_ FloatingPoint 11 53)
- - Float128 is a synonym for (_ FloatingPoint 15 113)
-
- These correspond to the IEEE binary16, binary32, binary64 and binary128 formats.
- "
-
-;----------------
-; Rounding modes
-;----------------
-
- ; Constants for rounding modes, and their abbreviated version
- :funs ((roundNearestTiesToEven RoundingMode) (RNE RoundingMode)
- (roundNearestTiesToAway RoundingMode) (RNA RoundingMode)
- (roundTowardPositive RoundingMode) (RTP RoundingMode)
- (roundTowardNegative RoundingMode) (RTN RoundingMode)
- (roundTowardZero RoundingMode) (RTZ RoundingMode)
- )
-
-;--------------------
-; Value constructors
-;--------------------
-
- ; Bitvector literals
- :funs_description "
- All binaries #bX of sort (_ BitVec m) where m is the number of digits in X.
- All hexadecimals #xX of sort (_ BitVec m) where m is 4 times the number of
- digits in X.
- "
-
- ; FP literals as bit string triples, with the leading bit for the significand
- ; not represented (hidden bit)
- :funs_description "All function symbols with declaration of the form
-
- (fp (_ BitVec 1) (_ BitVec eb) (_ BitVec i) (_ FloatingPoint eb sb))
-
- where eb and sb are numerals greater than 1 and i = sb - 1."
-
- ; Plus and minus infinity
- :funs_description "All function symbols with declaration of the form
-
- ((_ +oo eb sb) (_ FloatingPoint eb sb))
- ((_ -oo eb sb) (_ FloatingPoint eb sb))
-
- where eb and sb are numerals greater than 1."
-
- :note
- "Semantically, for each eb and sb, there is exactly one +infinity value and
- exactly one -infinity value in the set denoted by (_ FloatingPoint eb sb),
- in agreement with the IEEE 754-2008 standard.
- However, +/-infinity can have two representations in this theory.
- E.g., +infinity for sort (_ FloatingPoint 2 3) is represented equivalently
- by (_ +oo 2 3) and (fp #b0 #b11 #b00).
- "
-
- ; Plus and minus zero
- :funs_description "All function symbols with declaration of the form
-
- ((_ +zero eb sb) (_ FloatingPoint eb sb))
- ((_ -zero eb sb) (_ FloatingPoint eb sb))
-
- where eb and sb are numerals greater than 1."
-
- :note
- "The +zero and -zero symbols are abbreviations for the corresponding fp literals.
- E.g., (_ +zero 2 4) abbreviates (fp #b0 #b00 #b000)
- (_ -zero 3 2) abbreviates (fp #b1 #b000 #b0)
- "
-
- ; Non-numbers
- :funs_description "All function symbols with declaration of the form
-
- ((_ NaN eb sb) (_ FloatingPoint eb sb))
-
- where eb and sb are numerals greater than 1."
-
- :note
- "For each eb and sb, there is exactly one NaN in the set denoted by
- (_ FloatingPoint eb sb), in agreeement with Level 2 of IEEE 754-2008
- (floating-point data). There is no distinction in this theory between
- a ``quiet'' and a ``signaling'' NaN.
- NaN has several representations, e.g.,(_ NaN eb sb) and any term of
- the form (fp t #b1..1 s) where s is a binary containing at least a 1
- and t is either #b0 or #b1.
- "
-
-;-----------
-; Operators
-;-----------
-
- :funs_description "All function symbols with declarations of the form below
- where eb and sb are numerals greater than 1.
-
- ; absolute value
- (fp.abs (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
-
- ; negation (no rounding needed)
- (fp.neg (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
-
- ; addition
- (fp.add RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb)
- (_ FloatingPoint eb sb))
-
- ; subtraction
- (fp.sub RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb)
- (_ FloatingPoint eb sb))
-
- ; multiplication
- (fp.mul RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb)
- (_ FloatingPoint eb sb))
-
- ; division
- (fp.div RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb)
- (_ FloatingPoint eb sb))
-
- ; fused multiplication and addition; (x * y) + z
- (fp.fma RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) (_ FloatingPoint eb sb)
- (_ FloatingPoint eb sb))
-
- ; square root
- (fp.sqrt RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
-
- ; remainder: x - y * n, where n in Z is nearest to x/y
- (fp.rem (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
-
- ; rounding to integral
- (fp.roundToIntegral RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
-
- ; minimum and maximum
- (fp.min (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
- (fp.max (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
-
- ; comparison operators
- ; Note that all comparisons evaluate to false if either argument is NaN
- (fp.leq (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) Bool :chainable)
- (fp.lt (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) Bool :chainable)
- (fp.geq (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) Bool :chainable)
- (fp.gt (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) Bool :chainable)
-
- ; IEEE 754-2008 equality (as opposed to SMT-LIB =)
- (fp.eq (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) Bool :chainable)
-
- ; Classification of numbers
- (fp.isNormal (_ FloatingPoint eb sb) Bool)
- (fp.isSubnormal (_ FloatingPoint eb sb) Bool)
- (fp.isZero (_ FloatingPoint eb sb) Bool)
- (fp.isInfinite (_ FloatingPoint eb sb) Bool)
- (fp.isNaN (_ FloatingPoint eb sb) Bool)
- (fp.isNegative (_ FloatingPoint eb sb) Bool)
- (fp.isPositive (_ FloatingPoint eb sb) Bool)
- "
-
- :note
- "(fq.eq x y) evaluates to true if x evaluates to -zero and y to +zero, or vice versa.
- fq.eq and all the other comparison operators evaluate to false if one of their
- arguments is NaN.
- "
-
-
-;------------------------------
-; Conversions from other sorts
-;------------------------------
-
- :funs_description "All function symbols with declarations of the form below
- where m is a numerals greater than 0 and eb, sb, mb and nb are numerals
- greater than 1.
-
- ; from single bitstring representation in IEEE 754-2008 interchange format,
- ; with m = eb + sb
- ((_ to_fp eb sb) (_ BitVec m) (_ FloatingPoint eb sb))
-
- ; from another floating point sort
- ((_ to_fp eb sb) RoundingMode (_ FloatingPoint mb nb) (_ FloatingPoint eb sb))
-
- ; from real
- ((_ to_fp eb sb) RoundingMode Real (_ FloatingPoint eb sb))
-
- ; from signed machine integer, represented as a 2's complement bit vector
- ((_ to_fp eb sb) RoundingMode (_ BitVec m) (_ FloatingPoint eb sb))
-
- ; from unsigned machine integer, represented as bit vector
- ((_ to_fp_unsigned eb sb) RoundingMode (_ BitVec m) (_ FloatingPoint eb sb))
- "
-
-
-;----------------------------
-; Conversions to other sorts
-;----------------------------
-
- :funs_description "All function symbols with declarations of the form below
- where m is a numeral greater than 0 and eb and sb are numerals greater than 1.
-
- ; to unsigned machine integer, represented as a bit vector
- ((_ fp.to_ubv m) RoundingMode (_ FloatingPoint eb sb) (_ BitVec m))
-
- ; to signed machine integer, represented as a 2's complement bit vector
- ((_ fp.to_sbv m) RoundingMode (_ FloatingPoint eb sb) (_ BitVec m))
-
- ; to real
- (fp.to_real (_ FloatingPoint eb sb) Real)
- "
- :note
- "All fp.to_* functions are unspecified for NaN and infinity input values.
- In addition, fp.to_ubv and fp.to_sbv are unspecified for finite number inputs
- that are out of range (which includes all negative numbers for fp.to_ubv).
-
- This means for instance that the formula
-
- (= (fp.to_real (_ NaN 8 24)) (fp.to_real (fp c1 c2 c3)))
-
- is satisfiable in this theory for all binary constants c1, c2, and c3
- (of the proper sort).
- "
-
- :note
- "There is no function for converting from (_ FloatingPoint eb sb) to the
- corresponding IEEE 754-2008 binary format, as a bit vector (_ BitVec m) with
- m = eb + sb, because (_ NaN eb sb) has multiple, well-defined representations.
- Instead, an encoding of the kind below is recommended, where f is a term
- of sort (_ FloatingPoint eb sb):
-
- (declare-fun b () (_ BitVec m))
- (assert (= ((_ to_fp eb sb) b) f))
- "
-
-;--------
-; Values
-;--------
-
- :values "For all m,n > 1, the values of sort (_ FloatingPoint m n) are
- - (_ +oo m n)
- - (_ -oo m n)
- - (_ NaN m n)
- - all terms of the form (fp c1 c2 c3) where
- - c1 is the binary #b0 or #b1
- - c2 is a binary of size m other than #b1...1 (all 1s)
- - c3 is a binary of size n-1
-
- The set of values for RoundingMode is {RNE, RNA, RTP, RTN, RTZ}.
- "
-
- :note
- "No values are specified for the sorts Real and (_ BitVec n) in this theory.
- They are specified in the theory declarations Reals and FixedSizeBitVectors,
- respectively.
- "
-
-;-----------
-; Semantics
-;-----------
-
- :note
- "The semantics of this theory is described somewhat informally here.
- A rigorous, self-contained specification can be found in [BTRW14]:
- 'An Automatable Formal Semantics for IEEE-754 Floating-Point Arithmetic'
- and it takes precedence in the case of any (unintended) inconsistencies.
- "
-
- :definition
- "For every expanded signature Sigma, the instance of FloatingPoints with
- that signature is the theory consisting of all Sigma-models that satisfy
- the constraints detailed below.
-
- We use [[ _ ]] to denote the meaning of a sort or function symbol in
- a given Sigma-model.
-
-
- o (_ FloatingPoint eb sb)
-
- [[(_ FloatingPoint eb sb)]] is the set of all the binary floating point
- numbers with eb bits for the exponent and sb bits for the significand,
- as defined by IEEE 754-2008.
-
- Technically, [[(_ FloatingPoint eb sb)]] is the union of the set
- {not_a_number} with four sets N, S, Z, I of bit-vector triples
- (corresponding to normal numbers, subnormal numbers, zeros and
- infinities) of the form (s, e, m) where s, e, and m correspond
- respectively to the sign, the exponent and the significand (see
- the paper for more details).
-
- Note that the (semantic) value not_a_number is shared across all
- [[(_ FloatingPoint eb sb)]].
-
-
- o (_ BitVec m), binary and hexadecimal constants
-
- These are interpreted as in the theory FixedSizeBitVectors.
-
-
- o Real
-
- [[Real]] is the set of real numbers.
-
-
- o RoundingMode
-
- [[RoundingMode]] is the set of the 5 rounding modes defined by IEEE 754-2008.
-
-
- o (roundNearestTiesToEven RoundingMode), (roundNearestTiesToAway RoundingMode), ...
-
- [[roundNearestTiesToEven]], [[roundNearestTiesToAway]], [[roundTowardPositive]],
- [[roundTowardNegative]], and [[roundTowardZero]] are the 5 distinct elements
- of [[RoundingMode]], and each corresponds to the rounding mode suggested by
- the symbol's name.
-
-
- o (RNE RoundingMode), (RNA RoundingMode), ...
-
- [[RNE]] = [[roundNearestTiesToEven]];
- [[RNA]] = [[roundNearestTiesToAway]];
- [[RTP]] = [[roundTowardPositive]];
- [[RTN]] = [[roundTowardNegative]];
- [[RTZ]] = [[roundTowardZero]].
-
-
- o (fp (_ BitVec 1) (_ BitVec eb) (_ BitVec i) (_ FloatingPoint eb sb))
-
- [[fp]] returns the element of [[(_ FloatingPoint eb sb)]] whose IEEE 754-2008
- binary encoding matches the input bit strings:
- for all bitvectors
- b1 in [[(_ BitVec 1)]], b2 in [[(_ BitVec eb)]] and b3 in [[(_ BitVec i)]],
- [[fp]](b1, b2 ,b3) is the binary floating point number encoded in the IEEE
- 754-2008 standard with sign bit b1, exponent bits b2, and significant bit b3
- (with 1 hidden bit).
-
- Note that not_a_number can be denoted with fp terms as well. For instance, in
- (_ FloatingPoint 2 2),
- [[(_ NaN 2 2)]] = [[fp]]([[#b0]], [[#b11]], [[#b1]])
- = [[fp]]([[#b1]], [[#b11]], [[#b1]])
-
- Similarly,
- [[(_ +oo 2 2)]] = [[fp]]([[#b0]], [[#b11]], [[#b0]])
- [[(_ -oo 2 2)]] = [[fp]]([[#b1]], [[#b11]], [[#b0]])
-
-
- o ((_ +oo eb sb) (_ FloatingPoint eb sb))
- ((_ -oo eb sb) (_ FloatingPoint eb sb))
- ((_ NaN eb sb) (_ FloatingPoint eb sb))
- ((_ +zero eb sb) (_ FloatingPoint eb sb))
- ((_ -zero eb sb) (_ FloatingPoint eb sb))
-
- [[(_ +oo eb sb)]] is +infinity
- [[(_ -oo eb sb)]] is -infinity
- [[(_ NaN eb sb)]] is not_a_number
- [[(_ +zero eb sb)]] is [[fp]]([[#b0]], [[#b0..0]], [[#b0..0]]) where
- the first bitvector literal has eb 0s and
- the second has sb - 1 0s
- [[(_ -zero eb sb)]] is [[fp]]([[#b1]], [[#b0..0]], [[#b0..0]]) where
- the first bitvector literal has eb 0s and
- the second has sb - 1 0s
-
-
- o ((_ to_fp eb sb) (_ BitVec m) (_ FloatingPoint eb sb))
-
- [[(_ to_fp eb sb)]](b) = [[fp]](b[m-1:m-1], b[eb+sb-1:sb], b[sb-1:0])
- where b[p:q] denotes the subvector of bitvector b between positions p and q.
-
-
- o (fp.to_real (_ FloatingPoint eb sb) Real)
-
- [[fp.to_real]](x) is the real number represented by x if x is not in
- {-infinity, -infinity, not_a_number}. Otherwise, it is unspecified.
-
-
- o ((_ to_fp eb sb) RoundingMode (_ FloatingPoint m n) (_ FloatingPoint eb sb))
-
- [[(_ to_fp eb sb)]](r, x) = x if x in {+infinity, -infinity, not_a_number}.
- [[(_ to_fp eb sb)]](r, x) = +/-infinity if [[fp.to_real]](x) is too large/too
- small to be represented as a finite number of [[(_ FloatingPoint eb sb)]];
- [[(_ to_fp eb sb)]](r, x) = y otherwise, where y is the finite number
- such that [[fp.to_real]](y) is closest to [[fp.to_real]](x) according to
- rounding mode r.
-
-
- o ((_ to_fp eb sb) RoundingMode Real (_ FloatingPoint eb sb))
-
- [[(_ to_fp eb sb)]](r, x) = +/-infinity if x is too large/too small
- to be represented as a finite number of [[(_ FloatingPoint eb sb)]];
- [[(_ to_fp eb sb)]](r, x) = y otherwise, where y is the finite number
- such that [[fp.to_real]](y) is closest to x according to rounding mode r.
-
-
- o ((_ to_fp eb sb) RoundingMode (_ BitVec m) (_ FloatingPoint eb sb))
-
- Let b in [[(_ BitVec m)]] and let n be the signed integer represented by b
- (in 2's complement format).
- [[(_ to_fp eb sb)]](r, b) = +/-infinity if n is too large/too small to be
- represented as a finite number of [[(_ FloatingPoint eb sb)]];
- [[(_ to_fp eb sb)]](r, x) = y otherwise, where y is the finite number
- such that [[fp.to_real]](y) is closest to n according to rounding mode r.
-
-
- o ((_ to_fp_unsigned eb sb) RoundingMode (_ BitVec m) (_ FloatingPoint eb sb))
-
- Let b in [[(_ BitVec m)]] and let n be the unsigned integer represented by b.
- [[(_ to_fp_unsigned eb sb)]](r, x) = +infinity if n is too large to be
- represented as a finite number of [[(_ FloatingPoint eb sb)]];
- [[(_ to_fp_unsigned eb sb)]](r, x) = y otherwise, where y is the finite number
- such that [[fp.to_real]](y) is closest to n according to rounding mode r.
-
-
- o ((_ fp.to_ubv m) RoundingMode (_ FloatingPoint eb sb) (_ BitVec m))
-
- [[(_ fp.to_ubv m)]](r, x) = b if the unsigned integer n represented by b is
- the closest integer according to rounding mode r to the real number
- represented by x, and n is in the range [0, 2^m - 1].
- [[(_ fp.to_ubv m)]](r, x) is unspecified in all other cases (including when
- x is in {-infinity, -infinity, not_a_number}).
-
-
- o ((_ fp.to_sbv m) RoundingMode (_ FloatingPoint eb sb) (_ BitVec m))
-
- [[(_ fp.to_sbv m)]](r, x) = b if the signed integer n represented by b
- (in 2's complement format) is the closest integer according to rounding mode
- r to the real number represented by x, and n is in the range
- [-2^{m-1}, 2^{m-1} - 1].
- [[(_ fp.to_sbv m)]](r, x) is unspecified in all other cases (including when
- x is in {-infinity, -infinity, not_a_number}).
-
-
- o (fp.isNormal (_ FloatingPoint eb sb) Bool)
-
- [[fp.isNormal]](x) = true iff x is a normal number.
-
-
- o (fp.isSubnormal (_ FloatingPoint eb sb) Bool)
-
- [[fp.isSubnormal]](x) = true iff x is a subnormal number.
-
-
- o (fp.isZero (_ FloatingPoint eb sb) Bool)
-
- [[fp.isZero]](x) = true iff x is positive or negative zero.
-
-
- o (fp.isInfinite (_ FloatingPoint eb sb) Bool)
-
- [[fp.isInfinite]](x) = true iff x is +infinity or -infinity.
-
-
- o (fp.isNaN (_ FloatingPoint eb sb) Bool)
-
- [[fp.isNaN]](x) = true iff x = not_a_number.
-
-
- o (fp.isNegative (_ FloatingPoint eb sb) Bool)
-
- [[fp.isNegative]](x) = true iff x is [[-zero]] or [[fp.lt]](x, [[-zero]]) holds.
-
- o (fp.isPositive (_ FloatingPoint eb sb) Bool)
-
- [[fp.isPositive]](x) = true iff x is [[+zero]] or [[fp.lt]]([[+zero]], x) holds.
-
-
- o all the other function symbols are interpreted as described in [BTRW15].
- "
-)
+(theory FloatingPoint
+
+ :smt-lib-version 2.5
+ :written-by "Cesare Tinelli and Martin Brain"
+ :date "2014-05-27"
+ :last-updated "2015-04-25"
+ :update-history
+ "2015-04-25 Updated to Version 2.5.
+ Updated reference to tech report.
+ "
+
+ :notes
+ "This is a theory of floating point numbers largely based on the IEEE standard
+ 754-2008 for floating-point arithmetic (http://grouper.ieee.org/groups/754/)
+ but restricted to the binary case only.
+ A major extension over 754-2008 is that the theory has a sort for every
+ possible exponent and significand length.
+
+ Version 1 of the theory was based on proposal by P. Ruemmer and T. Wahl [RW10].
+
+ [RW10] Philipp Ruemmer and Thomas Wahl.
+ An SMT-LIB Theory of Binary Floating-Point Arithmetic.
+ Proceedings of the 8th International Workshop on
+ Satisfiability Modulo Theories (SMT'10), Edinburgh, UK, July 2010.
+ (http://www.philipp.ruemmer.org/publications/smt-fpa.pdf)
+
+ Version 2 was written by C. Tinelli using community feedback.
+ Version 3, the current one, was written by C. Tinelli and M. Brain following
+ further discussion within the SMT-LIB community, and then relaborated with
+ P. Ruemmer and T. Wahl.
+ A more detailed description of this version together with the rationale of
+ several models decisions as well as a formal semantics of the theory can be
+ found in
+
+ [BTRW15] Martin Brain, Cesare Tinelli, Philipp Ruemmer, and Thomas Wahl.
+ An Automatable Formal Semantics for IEEE-754 Floating-Point Arithmetic
+ Technical Report, 2015.
+ (http://smt-lib.org/papers/BTRW15.pdf)
+
+ The following additional people provided substantial feedback and directions:
+ François Bobot, David Cok, Alberto Griggio, Florian Lapschies, Leonardo de
+ Moura, Gabriele Paganelli, Cody Roux, Christoph Wintersteiger.
+ "
+
+;-------
+; Sorts
+;-------
+
+ :sorts ((RoundingMode 0) (Real 0))
+
+ ; Bit vector sorts, indexed by vector size
+ :sorts_description "All sort symbols of the form
+ (_ BitVec m)
+ where m is a numeral greater than 0."
+
+ ; Floating point sort, indexed by the length of the exponent and significand
+ ; components of the number
+ :sorts_description "All nullary sort symbols of the form
+
+ (_ FloatingPoint eb sb),
+
+ where eb and sb are numerals greater than 1."
+
+ :note
+ "eb defines the number of bits in the exponent;
+ sb defines the number of bits in the significand, *including* the hidden bit.
+ "
+
+; Short name for common floating point sorts
+:sort ((Float16 0) (Float32 0) (Float64 0) (Float128 0))
+
+ :note "
+ - Float16 is a synonym for (_ FloatingPoint 5 11)
+ - Float32 is a synonym for (_ FloatingPoint 8 24)
+ - Float64 is a synonym for (_ FloatingPoint 11 53)
+ - Float128 is a synonym for (_ FloatingPoint 15 113)
+
+ These correspond to the IEEE binary16, binary32, binary64 and binary128 formats.
+ "
+
+;----------------
+; Rounding modes
+;----------------
+
+ ; Constants for rounding modes, and their abbreviated version
+ :funs ((roundNearestTiesToEven RoundingMode) (RNE RoundingMode)
+ (roundNearestTiesToAway RoundingMode) (RNA RoundingMode)
+ (roundTowardPositive RoundingMode) (RTP RoundingMode)
+ (roundTowardNegative RoundingMode) (RTN RoundingMode)
+ (roundTowardZero RoundingMode) (RTZ RoundingMode)
+ )
+
+;--------------------
+; Value constructors
+;--------------------
+
+ ; Bitvector literals
+ :funs_description "
+ All binaries #bX of sort (_ BitVec m) where m is the number of digits in X.
+ All hexadecimals #xX of sort (_ BitVec m) where m is 4 times the number of
+ digits in X.
+ "
+
+ ; FP literals as bit string triples, with the leading bit for the significand
+ ; not represented (hidden bit)
+ :funs_description "All function symbols with declaration of the form
+
+ (fp (_ BitVec 1) (_ BitVec eb) (_ BitVec i) (_ FloatingPoint eb sb))
+
+ where eb and sb are numerals greater than 1 and i = sb - 1."
+
+ ; Plus and minus infinity
+ :funs_description "All function symbols with declaration of the form
+
+ ((_ +oo eb sb) (_ FloatingPoint eb sb))
+ ((_ -oo eb sb) (_ FloatingPoint eb sb))
+
+ where eb and sb are numerals greater than 1."
+
+ :note
+ "Semantically, for each eb and sb, there is exactly one +infinity value and
+ exactly one -infinity value in the set denoted by (_ FloatingPoint eb sb),
+ in agreement with the IEEE 754-2008 standard.
+ However, +/-infinity can have two representations in this theory.
+ E.g., +infinity for sort (_ FloatingPoint 2 3) is represented equivalently
+ by (_ +oo 2 3) and (fp #b0 #b11 #b00).
+ "
+
+ ; Plus and minus zero
+ :funs_description "All function symbols with declaration of the form
+
+ ((_ +zero eb sb) (_ FloatingPoint eb sb))
+ ((_ -zero eb sb) (_ FloatingPoint eb sb))
+
+ where eb and sb are numerals greater than 1."
+
+ :note
+ "The +zero and -zero symbols are abbreviations for the corresponding fp literals.
+ E.g., (_ +zero 2 4) abbreviates (fp #b0 #b00 #b000)
+ (_ -zero 3 2) abbreviates (fp #b1 #b000 #b0)
+ "
+
+ ; Non-numbers
+ :funs_description "All function symbols with declaration of the form
+
+ ((_ NaN eb sb) (_ FloatingPoint eb sb))
+
+ where eb and sb are numerals greater than 1."
+
+ :note
+ "For each eb and sb, there is exactly one NaN in the set denoted by
+ (_ FloatingPoint eb sb), in agreeement with Level 2 of IEEE 754-2008
+ (floating-point data). There is no distinction in this theory between
+ a ``quiet'' and a ``signaling'' NaN.
+ NaN has several representations, e.g.,(_ NaN eb sb) and any term of
+ the form (fp t #b1..1 s) where s is a binary containing at least a 1
+ and t is either #b0 or #b1.
+ "
+
+;-----------
+; Operators
+;-----------
+
+ :funs_description "All function symbols with declarations of the form below
+ where eb and sb are numerals greater than 1.
+
+ ; absolute value
+ (fp.abs (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
+
+ ; negation (no rounding needed)
+ (fp.neg (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
+
+ ; addition
+ (fp.add RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb)
+ (_ FloatingPoint eb sb))
+
+ ; subtraction
+ (fp.sub RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb)
+ (_ FloatingPoint eb sb))
+
+ ; multiplication
+ (fp.mul RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb)
+ (_ FloatingPoint eb sb))
+
+ ; division
+ (fp.div RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb)
+ (_ FloatingPoint eb sb))
+
+ ; fused multiplication and addition; (x * y) + z
+ (fp.fma RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) (_ FloatingPoint eb sb)
+ (_ FloatingPoint eb sb))
+
+ ; square root
+ (fp.sqrt RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
+
+ ; remainder: x - y * n, where n in Z is nearest to x/y
+ (fp.rem (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
+
+ ; rounding to integral
+ (fp.roundToIntegral RoundingMode (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
+
+ ; minimum and maximum
+ (fp.min (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
+ (fp.max (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) (_ FloatingPoint eb sb))
+
+ ; comparison operators
+ ; Note that all comparisons evaluate to false if either argument is NaN
+ (fp.leq (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) Bool :chainable)
+ (fp.lt (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) Bool :chainable)
+ (fp.geq (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) Bool :chainable)
+ (fp.gt (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) Bool :chainable)
+
+ ; IEEE 754-2008 equality (as opposed to SMT-LIB =)
+ (fp.eq (_ FloatingPoint eb sb) (_ FloatingPoint eb sb) Bool :chainable)
+
+ ; Classification of numbers
+ (fp.isNormal (_ FloatingPoint eb sb) Bool)
+ (fp.isSubnormal (_ FloatingPoint eb sb) Bool)
+ (fp.isZero (_ FloatingPoint eb sb) Bool)
+ (fp.isInfinite (_ FloatingPoint eb sb) Bool)
+ (fp.isNaN (_ FloatingPoint eb sb) Bool)
+ (fp.isNegative (_ FloatingPoint eb sb) Bool)
+ (fp.isPositive (_ FloatingPoint eb sb) Bool)
+ "
+
+ :note
+ "(fq.eq x y) evaluates to true if x evaluates to -zero and y to +zero, or vice versa.
+ fq.eq and all the other comparison operators evaluate to false if one of their
+ arguments is NaN.
+ "
+
+
+;------------------------------
+; Conversions from other sorts
+;------------------------------
+
+ :funs_description "All function symbols with declarations of the form below
+ where m is a numerals greater than 0 and eb, sb, mb and nb are numerals
+ greater than 1.
+
+ ; from single bitstring representation in IEEE 754-2008 interchange format,
+ ; with m = eb + sb
+ ((_ to_fp eb sb) (_ BitVec m) (_ FloatingPoint eb sb))
+
+ ; from another floating point sort
+ ((_ to_fp eb sb) RoundingMode (_ FloatingPoint mb nb) (_ FloatingPoint eb sb))
+
+ ; from real
+ ((_ to_fp eb sb) RoundingMode Real (_ FloatingPoint eb sb))
+
+ ; from signed machine integer, represented as a 2's complement bit vector
+ ((_ to_fp eb sb) RoundingMode (_ BitVec m) (_ FloatingPoint eb sb))
+
+ ; from unsigned machine integer, represented as bit vector
+ ((_ to_fp_unsigned eb sb) RoundingMode (_ BitVec m) (_ FloatingPoint eb sb))
+ "
+
+
+;----------------------------
+; Conversions to other sorts
+;----------------------------
+
+ :funs_description "All function symbols with declarations of the form below
+ where m is a numeral greater than 0 and eb and sb are numerals greater than 1.
+
+ ; to unsigned machine integer, represented as a bit vector
+ ((_ fp.to_ubv m) RoundingMode (_ FloatingPoint eb sb) (_ BitVec m))
+
+ ; to signed machine integer, represented as a 2's complement bit vector
+ ((_ fp.to_sbv m) RoundingMode (_ FloatingPoint eb sb) (_ BitVec m))
+
+ ; to real
+ (fp.to_real (_ FloatingPoint eb sb) Real)
+ "
+ :note
+ "All fp.to_* functions are unspecified for NaN and infinity input values.
+ In addition, fp.to_ubv and fp.to_sbv are unspecified for finite number inputs
+ that are out of range (which includes all negative numbers for fp.to_ubv).
+
+ This means for instance that the formula
+
+ (= (fp.to_real (_ NaN 8 24)) (fp.to_real (fp c1 c2 c3)))
+
+ is satisfiable in this theory for all binary constants c1, c2, and c3
+ (of the proper sort).
+ "
+
+ :note
+ "There is no function for converting from (_ FloatingPoint eb sb) to the
+ corresponding IEEE 754-2008 binary format, as a bit vector (_ BitVec m) with
+ m = eb + sb, because (_ NaN eb sb) has multiple, well-defined representations.
+ Instead, an encoding of the kind below is recommended, where f is a term
+ of sort (_ FloatingPoint eb sb):
+
+ (declare-fun b () (_ BitVec m))
+ (assert (= ((_ to_fp eb sb) b) f))
+ "
+
+;--------
+; Values
+;--------
+
+ :values "For all m,n > 1, the values of sort (_ FloatingPoint m n) are
+ - (_ +oo m n)
+ - (_ -oo m n)
+ - (_ NaN m n)
+ - all terms of the form (fp c1 c2 c3) where
+ - c1 is the binary #b0 or #b1
+ - c2 is a binary of size m other than #b1...1 (all 1s)
+ - c3 is a binary of size n-1
+
+ The set of values for RoundingMode is {RNE, RNA, RTP, RTN, RTZ}.
+ "
+
+ :note
+ "No values are specified for the sorts Real and (_ BitVec n) in this theory.
+ They are specified in the theory declarations Reals and FixedSizeBitVectors,
+ respectively.
+ "
+
+;-----------
+; Semantics
+;-----------
+
+ :note
+ "The semantics of this theory is described somewhat informally here.
+ A rigorous, self-contained specification can be found in [BTRW14]:
+ 'An Automatable Formal Semantics for IEEE-754 Floating-Point Arithmetic'
+ and it takes precedence in the case of any (unintended) inconsistencies.
+ "
+
+ :definition
+ "For every expanded signature Sigma, the instance of FloatingPoints with
+ that signature is the theory consisting of all Sigma-models that satisfy
+ the constraints detailed below.
+
+ We use [[ _ ]] to denote the meaning of a sort or function symbol in
+ a given Sigma-model.
+
+
+ o (_ FloatingPoint eb sb)
+
+ [[(_ FloatingPoint eb sb)]] is the set of all the binary floating point
+ numbers with eb bits for the exponent and sb bits for the significand,
+ as defined by IEEE 754-2008.
+
+ Technically, [[(_ FloatingPoint eb sb)]] is the union of the set
+ {not_a_number} with four sets N, S, Z, I of bit-vector triples
+ (corresponding to normal numbers, subnormal numbers, zeros and
+ infinities) of the form (s, e, m) where s, e, and m correspond
+ respectively to the sign, the exponent and the significand (see
+ the paper for more details).
+
+ Note that the (semantic) value not_a_number is shared across all
+ [[(_ FloatingPoint eb sb)]].
+
+
+ o (_ BitVec m), binary and hexadecimal constants
+
+ These are interpreted as in the theory FixedSizeBitVectors.
+
+
+ o Real
+
+ [[Real]] is the set of real numbers.
+
+
+ o RoundingMode
+
+ [[RoundingMode]] is the set of the 5 rounding modes defined by IEEE 754-2008.
+
+
+ o (roundNearestTiesToEven RoundingMode), (roundNearestTiesToAway RoundingMode), ...
+
+ [[roundNearestTiesToEven]], [[roundNearestTiesToAway]], [[roundTowardPositive]],
+ [[roundTowardNegative]], and [[roundTowardZero]] are the 5 distinct elements
+ of [[RoundingMode]], and each corresponds to the rounding mode suggested by
+ the symbol's name.
+
+
+ o (RNE RoundingMode), (RNA RoundingMode), ...
+
+ [[RNE]] = [[roundNearestTiesToEven]];
+ [[RNA]] = [[roundNearestTiesToAway]];
+ [[RTP]] = [[roundTowardPositive]];
+ [[RTN]] = [[roundTowardNegative]];
+ [[RTZ]] = [[roundTowardZero]].
+
+
+ o (fp (_ BitVec 1) (_ BitVec eb) (_ BitVec i) (_ FloatingPoint eb sb))
+
+ [[fp]] returns the element of [[(_ FloatingPoint eb sb)]] whose IEEE 754-2008
+ binary encoding matches the input bit strings:
+ for all bitvectors
+ b1 in [[(_ BitVec 1)]], b2 in [[(_ BitVec eb)]] and b3 in [[(_ BitVec i)]],
+ [[fp]](b1, b2 ,b3) is the binary floating point number encoded in the IEEE
+ 754-2008 standard with sign bit b1, exponent bits b2, and significant bit b3
+ (with 1 hidden bit).
+
+ Note that not_a_number can be denoted with fp terms as well. For instance, in
+ (_ FloatingPoint 2 2),
+ [[(_ NaN 2 2)]] = [[fp]]([[#b0]], [[#b11]], [[#b1]])
+ = [[fp]]([[#b1]], [[#b11]], [[#b1]])
+
+ Similarly,
+ [[(_ +oo 2 2)]] = [[fp]]([[#b0]], [[#b11]], [[#b0]])
+ [[(_ -oo 2 2)]] = [[fp]]([[#b1]], [[#b11]], [[#b0]])
+
+
+ o ((_ +oo eb sb) (_ FloatingPoint eb sb))
+ ((_ -oo eb sb) (_ FloatingPoint eb sb))
+ ((_ NaN eb sb) (_ FloatingPoint eb sb))
+ ((_ +zero eb sb) (_ FloatingPoint eb sb))
+ ((_ -zero eb sb) (_ FloatingPoint eb sb))
+
+ [[(_ +oo eb sb)]] is +infinity
+ [[(_ -oo eb sb)]] is -infinity
+ [[(_ NaN eb sb)]] is not_a_number
+ [[(_ +zero eb sb)]] is [[fp]]([[#b0]], [[#b0..0]], [[#b0..0]]) where
+ the first bitvector literal has eb 0s and
+ the second has sb - 1 0s
+ [[(_ -zero eb sb)]] is [[fp]]([[#b1]], [[#b0..0]], [[#b0..0]]) where
+ the first bitvector literal has eb 0s and
+ the second has sb - 1 0s
+
+
+ o ((_ to_fp eb sb) (_ BitVec m) (_ FloatingPoint eb sb))
+
+ [[(_ to_fp eb sb)]](b) = [[fp]](b[m-1:m-1], b[eb+sb-1:sb], b[sb-1:0])
+ where b[p:q] denotes the subvector of bitvector b between positions p and q.
+
+
+ o (fp.to_real (_ FloatingPoint eb sb) Real)
+
+ [[fp.to_real]](x) is the real number represented by x if x is not in
+ {-infinity, -infinity, not_a_number}. Otherwise, it is unspecified.
+
+
+ o ((_ to_fp eb sb) RoundingMode (_ FloatingPoint m n) (_ FloatingPoint eb sb))
+
+ [[(_ to_fp eb sb)]](r, x) = x if x in {+infinity, -infinity, not_a_number}.
+ [[(_ to_fp eb sb)]](r, x) = +/-infinity if [[fp.to_real]](x) is too large/too
+ small to be represented as a finite number of [[(_ FloatingPoint eb sb)]];
+ [[(_ to_fp eb sb)]](r, x) = y otherwise, where y is the finite number
+ such that [[fp.to_real]](y) is closest to [[fp.to_real]](x) according to
+ rounding mode r.
+
+
+ o ((_ to_fp eb sb) RoundingMode Real (_ FloatingPoint eb sb))
+
+ [[(_ to_fp eb sb)]](r, x) = +/-infinity if x is too large/too small
+ to be represented as a finite number of [[(_ FloatingPoint eb sb)]];
+ [[(_ to_fp eb sb)]](r, x) = y otherwise, where y is the finite number
+ such that [[fp.to_real]](y) is closest to x according to rounding mode r.
+
+
+ o ((_ to_fp eb sb) RoundingMode (_ BitVec m) (_ FloatingPoint eb sb))
+
+ Let b in [[(_ BitVec m)]] and let n be the signed integer represented by b
+ (in 2's complement format).
+ [[(_ to_fp eb sb)]](r, b) = +/-infinity if n is too large/too small to be
+ represented as a finite number of [[(_ FloatingPoint eb sb)]];
+ [[(_ to_fp eb sb)]](r, x) = y otherwise, where y is the finite number
+ such that [[fp.to_real]](y) is closest to n according to rounding mode r.
+
+
+ o ((_ to_fp_unsigned eb sb) RoundingMode (_ BitVec m) (_ FloatingPoint eb sb))
+
+ Let b in [[(_ BitVec m)]] and let n be the unsigned integer represented by b.
+ [[(_ to_fp_unsigned eb sb)]](r, x) = +infinity if n is too large to be
+ represented as a finite number of [[(_ FloatingPoint eb sb)]];
+ [[(_ to_fp_unsigned eb sb)]](r, x) = y otherwise, where y is the finite number
+ such that [[fp.to_real]](y) is closest to n according to rounding mode r.
+
+
+ o ((_ fp.to_ubv m) RoundingMode (_ FloatingPoint eb sb) (_ BitVec m))
+
+ [[(_ fp.to_ubv m)]](r, x) = b if the unsigned integer n represented by b is
+ the closest integer according to rounding mode r to the real number
+ represented by x, and n is in the range [0, 2^m - 1].
+ [[(_ fp.to_ubv m)]](r, x) is unspecified in all other cases (including when
+ x is in {-infinity, -infinity, not_a_number}).
+
+
+ o ((_ fp.to_sbv m) RoundingMode (_ FloatingPoint eb sb) (_ BitVec m))
+
+ [[(_ fp.to_sbv m)]](r, x) = b if the signed integer n represented by b
+ (in 2's complement format) is the closest integer according to rounding mode
+ r to the real number represented by x, and n is in the range
+ [-2^{m-1}, 2^{m-1} - 1].
+ [[(_ fp.to_sbv m)]](r, x) is unspecified in all other cases (including when
+ x is in {-infinity, -infinity, not_a_number}).
+
+
+ o (fp.isNormal (_ FloatingPoint eb sb) Bool)
+
+ [[fp.isNormal]](x) = true iff x is a normal number.
+
+
+ o (fp.isSubnormal (_ FloatingPoint eb sb) Bool)
+
+ [[fp.isSubnormal]](x) = true iff x is a subnormal number.
+
+
+ o (fp.isZero (_ FloatingPoint eb sb) Bool)
+
+ [[fp.isZero]](x) = true iff x is positive or negative zero.
+
+
+ o (fp.isInfinite (_ FloatingPoint eb sb) Bool)
+
+ [[fp.isInfinite]](x) = true iff x is +infinity or -infinity.
+
+
+ o (fp.isNaN (_ FloatingPoint eb sb) Bool)
+
+ [[fp.isNaN]](x) = true iff x = not_a_number.
+
+
+ o (fp.isNegative (_ FloatingPoint eb sb) Bool)
+
+ [[fp.isNegative]](x) = true iff x is [[-zero]] or [[fp.lt]](x, [[-zero]]) holds.
+
+ o (fp.isPositive (_ FloatingPoint eb sb) Bool)
+
+ [[fp.isPositive]](x) = true iff x is [[+zero]] or [[fp.lt]]([[+zero]], x) holds.
+
+
+ o all the other function symbols are interpreted as described in [BTRW15].
+ "
+)
diff --git a/SMT/logics/Ints.smt2 b/SMT/logics/Ints.smt2
index 37d4f11..4d2cf62 100644
--- a/SMT/logics/Ints.smt2
+++ b/SMT/logics/Ints.smt2
@@ -1,82 +1,82 @@
-(theory Ints
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-17"
-
- :sorts ((Int 0))
-
- :funs ((NUMERAL Int)
- (- Int Int) ; negation
- (- Int Int Int :left-assoc) ; subtraction
- (+ Int Int Int :left-assoc)
- (* Int Int Int :left-assoc)
- (div Int Int Int :left-assoc)
- (mod Int Int Int)
- (abs Int Int)
- (<= Int Int Bool :chainable)
- (< Int Int Bool :chainable)
- (>= Int Int Bool :chainable)
- (> Int Int Bool :chainable)
- )
-
- :funs_description
- "All ranked function symbols of the form
- ((_ divisible n) Int Bool)
- where n is a positive numeral.
- "
-
- :values
- "The set of values for the sort Int consists of
- - all numerals,
- - all terms of the form (- n) where n is a numeral other than 0.
- "
-
- :definition
- "For every expanded signature, the instance of Ints with that
- signature is the theory consisting of all Sigma-models that interpret:
-
- - the sort Int as the set of all integer numbers,
-
- - each numeral as the corresponding natural number,
-
- - (_ divisible n) as the function mapping to true all and only
- the integers that are divisible by n,
-
- - abs as the absolute value function,
-
- - div and mod according to Boute's Euclidean definition [1], that is,
- so as to satify the formula
-
- (for all ((m Int) (n Int))
- (=> (distinct n 0)
- (let ((q (div m n)) (r (mod m n)))
- (and (= m (+ (* n q) r))
- (<= 0 r (- (abs n) 1))))))
-
- - the other function symbols of Ints as expected.
-
- References:
- [1] Boute, Raymond T. (April 1992).
- The Euclidean definition of the functions div and mod.
- ACM Transactions on Programming Languages and Systems (TOPLAS)
- ACM Press. 14 (2): 127 - 144. doi:10.1145/128861.128862.
- "
-
- :notes
- "Regardless of sign of m,
- when n is positive, (div m n) is the floor of the rational number m/n;
- when n is negative, (div m n) is the ceiling of m/n.
-
- This contrasts with alternative but less robust definitions of / and mod
- where (div m n) is
- - always the integer part of m/n (rounding towards 0), or
- - always the floor of x/y (rounding towards -infinity).
- "
-
- :notes
- "See note in the Reals theory declaration about terms of the form (/ t 0).
- The same observation applies here to terms of the form (div t 0) and
- (mod t 0).
- "
-)
+(theory Ints
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-17"
+
+ :sorts ((Int 0))
+
+ :funs ((NUMERAL Int)
+ (- Int Int) ; negation
+ (- Int Int Int :left-assoc) ; subtraction
+ (+ Int Int Int :left-assoc)
+ (* Int Int Int :left-assoc)
+ (div Int Int Int :left-assoc)
+ (mod Int Int Int)
+ (abs Int Int)
+ (<= Int Int Bool :chainable)
+ (< Int Int Bool :chainable)
+ (>= Int Int Bool :chainable)
+ (> Int Int Bool :chainable)
+ )
+
+ :funs_description
+ "All ranked function symbols of the form
+ ((_ divisible n) Int Bool)
+ where n is a positive numeral.
+ "
+
+ :values
+ "The set of values for the sort Int consists of
+ - all numerals,
+ - all terms of the form (- n) where n is a numeral other than 0.
+ "
+
+ :definition
+ "For every expanded signature, the instance of Ints with that
+ signature is the theory consisting of all Sigma-models that interpret:
+
+ - the sort Int as the set of all integer numbers,
+
+ - each numeral as the corresponding natural number,
+
+ - (_ divisible n) as the function mapping to true all and only
+ the integers that are divisible by n,
+
+ - abs as the absolute value function,
+
+ - div and mod according to Boute's Euclidean definition [1], that is,
+ so as to satify the formula
+
+ (for all ((m Int) (n Int))
+ (=> (distinct n 0)
+ (let ((q (div m n)) (r (mod m n)))
+ (and (= m (+ (* n q) r))
+ (<= 0 r (- (abs n) 1))))))
+
+ - the other function symbols of Ints as expected.
+
+ References:
+ [1] Boute, Raymond T. (April 1992).
+ The Euclidean definition of the functions div and mod.
+ ACM Transactions on Programming Languages and Systems (TOPLAS)
+ ACM Press. 14 (2): 127 - 144. doi:10.1145/128861.128862.
+ "
+
+ :notes
+ "Regardless of sign of m,
+ when n is positive, (div m n) is the floor of the rational number m/n;
+ when n is negative, (div m n) is the ceiling of m/n.
+
+ This contrasts with alternative but less robust definitions of / and mod
+ where (div m n) is
+ - always the integer part of m/n (rounding towards 0), or
+ - always the floor of x/y (rounding towards -infinity).
+ "
+
+ :notes
+ "See note in the Reals theory declaration about terms of the form (/ t 0).
+ The same observation applies here to terms of the form (div t 0) and
+ (mod t 0).
+ "
+)
diff --git a/SMT/logics/LIA.smt2 b/SMT/logics/LIA.smt2
index b9c1b01..8fce8d6 100644
--- a/SMT/logics/LIA.smt2
+++ b/SMT/logics/LIA.smt2
@@ -1,22 +1,22 @@
-(logic LIA
-
- :smt-lib-version 2.0
- :written_by "David COK, from QF_LIA"
- :date "2015-06-27"
-
- :theories (Ints)
-
- :language
- "Closed formulas built over an arbitrary expansion of the
- Ints signature with free constant symbols, but whose terms of sort Int
- are all linear, that is, have no occurrences of the function symbols
- *, /, div, mod, and abs, except as specified the :extensions attribute.
- "
-
- :extensions
- "Terms with _concrete_ coefficients are also allowed, that is, terms
- of the form c, (* c x), or (* x c) where x is a free constant and
- c is a term of the form n or (- n) for some numeral n.
- "
-)
-
+(logic LIA
+
+ :smt-lib-version 2.0
+ :written_by "David COK, from QF_LIA"
+ :date "2015-06-27"
+
+ :theories (Ints)
+
+ :language
+ "Closed formulas built over an arbitrary expansion of the
+ Ints signature with free constant symbols, but whose terms of sort Int
+ are all linear, that is, have no occurrences of the function symbols
+ *, /, div, mod, and abs, except as specified the :extensions attribute.
+ "
+
+ :extensions
+ "Terms with _concrete_ coefficients are also allowed, that is, terms
+ of the form c, (* c x), or (* x c) where x is a free constant and
+ c is a term of the form n or (- n) for some numeral n.
+ "
+)
+
diff --git a/SMT/logics/LRA.smt2 b/SMT/logics/LRA.smt2
index 84ff9d9..367e3e6 100644
--- a/SMT/logics/LRA.smt2
+++ b/SMT/logics/LRA.smt2
@@ -1,29 +1,29 @@
-(logic LRA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-05-11"
-
- :theories (Reals)
-
- :language
- "Closed formulas built over arbitrary expansions of the Reals signature
- with free constant symbols, but containing only linear atoms, that is,
- atoms with no occurrences of the function symbols * and /, except as
- specified the :extensions attribute.
- "
-
- :extensions
- "Terms with _concrete_ coefficients are also allowed, that is, terms
- of the form (* c x), or (* x c) where x is a free constant and
- c is an integer or rational coefficient.
- - An integer coefficient is a term of the form m or (- m) for some
- numeral m.
- - A rational coefficient is a term of the form d, (- d) or (/ c n)
- for some decimal d, integer coefficient c and numeral n other than 0.
- "
-
-:notes
- "This logic properly extends the logic QF_LRA by allowing quantifiers."
-)
-
+(logic LRA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-05-11"
+
+ :theories (Reals)
+
+ :language
+ "Closed formulas built over arbitrary expansions of the Reals signature
+ with free constant symbols, but containing only linear atoms, that is,
+ atoms with no occurrences of the function symbols * and /, except as
+ specified the :extensions attribute.
+ "
+
+ :extensions
+ "Terms with _concrete_ coefficients are also allowed, that is, terms
+ of the form (* c x), or (* x c) where x is a free constant and
+ c is an integer or rational coefficient.
+ - An integer coefficient is a term of the form m or (- m) for some
+ numeral m.
+ - A rational coefficient is a term of the form d, (- d) or (/ c n)
+ for some decimal d, integer coefficient c and numeral n other than 0.
+ "
+
+:notes
+ "This logic properly extends the logic QF_LRA by allowing quantifiers."
+)
+
diff --git a/SMT/logics/NIA.smt2 b/SMT/logics/NIA.smt2
index 974be4e..47adab6 100644
--- a/SMT/logics/NIA.smt2
+++ b/SMT/logics/NIA.smt2
@@ -1,13 +1,13 @@
-(logic NIA
-
- :smt-lib-version 2.0
- :written_by "David Cok, from QF_NIA"
- :date "2015-06-27"
-
- :theories (Ints)
-
- :language
- "Closed formulas built over an arbitrary expansion of the
- Ints signature with free constant symbols.
- "
-)
+(logic NIA
+
+ :smt-lib-version 2.0
+ :written_by "David Cok, from QF_NIA"
+ :date "2015-06-27"
+
+ :theories (Ints)
+
+ :language
+ "Closed formulas built over an arbitrary expansion of the
+ Ints signature with free constant symbols.
+ "
+)
diff --git a/SMT/logics/NRA.smt2 b/SMT/logics/NRA.smt2
index f464bf0..fff76a2 100644
--- a/SMT/logics/NRA.smt2
+++ b/SMT/logics/NRA.smt2
@@ -1,16 +1,16 @@
-(logic NRA
-
- :smt-lib-version 2.0
- :written_by "David Cok, from QF_NRA"
- :date "2015-06-27"
-
- :theories (Reals)
-
- :language
- "Closed formulas built over arbitrary expansions of
- the Reals signature with free constant symbols.
- "
-
-)
-
-
+(logic NRA
+
+ :smt-lib-version 2.0
+ :written_by "David Cok, from QF_NRA"
+ :date "2015-06-27"
+
+ :theories (Reals)
+
+ :language
+ "Closed formulas built over arbitrary expansions of
+ the Reals signature with free constant symbols.
+ "
+
+)
+
+
diff --git a/SMT/logics/QF_ABV.smt2 b/SMT/logics/QF_ABV.smt2
index f98c876..d0b12e7 100644
--- a/SMT/logics/QF_ABV.smt2
+++ b/SMT/logics/QF_ABV.smt2
@@ -1,19 +1,19 @@
-(logic QF_ABV
-
-:smt-lib-version 2.0
-:written_by "Cesare Tinelli and Clark Barrett"
-:date "2010-07-05"
-
-:theories (Fixed_Size_BitVectors ArraysEx)
-
-:language
- "Closed quantifier-free formulas built over the Fixed_Size_BitVectors and
- ArraysEx signatures, with the restriction that all array terms have sort of
- the form (Array (_ BitVec i) (_ BitVec j)) for some i, j > 0.
- "
-
-:extensions
- "As in the logic QF_BV."
-)
-
-
+(logic QF_ABV
+
+:smt-lib-version 2.0
+:written_by "Cesare Tinelli and Clark Barrett"
+:date "2010-07-05"
+
+:theories (Fixed_Size_BitVectors ArraysEx)
+
+:language
+ "Closed quantifier-free formulas built over the Fixed_Size_BitVectors and
+ ArraysEx signatures, with the restriction that all array terms have sort of
+ the form (Array (_ BitVec i) (_ BitVec j)) for some i, j > 0.
+ "
+
+:extensions
+ "As in the logic QF_BV."
+)
+
+
diff --git a/SMT/logics/QF_ALIA.smt2 b/SMT/logics/QF_ALIA.smt2
index ed1bfbb..689862b 100644
--- a/SMT/logics/QF_ALIA.smt2
+++ b/SMT/logics/QF_ALIA.smt2
@@ -1,22 +1,22 @@
-(logic QF_ALIA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-30"
-
- :theories (Ints ArraysEx)
-
- :language
- "Closed quantifier-free formulas built over arbitrary expansions of the
- Ints and ArraysEx signatures with free constant symbols, but
- with the following restrictions:
- - all terms of sort Int are linear, that is, have no occurrences of the
- function symbols *, /, div, mod, and abs, except as specified in the
- :extensions attributes;
- - all array terms have sort (Array Int Int).
- "
-
- :extensions
- "As in the logic QF_LIA."
-)
-
+(logic QF_ALIA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-30"
+
+ :theories (Ints ArraysEx)
+
+ :language
+ "Closed quantifier-free formulas built over arbitrary expansions of the
+ Ints and ArraysEx signatures with free constant symbols, but
+ with the following restrictions:
+ - all terms of sort Int are linear, that is, have no occurrences of the
+ function symbols *, /, div, mod, and abs, except as specified in the
+ :extensions attributes;
+ - all array terms have sort (Array Int Int).
+ "
+
+ :extensions
+ "As in the logic QF_LIA."
+)
+
diff --git a/SMT/logics/QF_ANIA.smt2 b/SMT/logics/QF_ANIA.smt2
index d7bd202..7eb60ef 100644
--- a/SMT/logics/QF_ANIA.smt2
+++ b/SMT/logics/QF_ANIA.smt2
@@ -1,15 +1,15 @@
-(logic QF_ANIA
-
- :smt-lib-version 2.0
- :written_by "David COk, based on others"
- :date "2015-06-27"
-
- :theories (Ints ArraysEx)
-
- :language
- "Closed quantifier-free formulas built over an arbitrary expansion of the
- Ints and ArraysEx signatures with free constant symbols, with the
- restriction
- - all array terms have sort (Array Int Int).
- "
+(logic QF_ANIA
+
+ :smt-lib-version 2.0
+ :written_by "David COk, based on others"
+ :date "2015-06-27"
+
+ :theories (Ints ArraysEx)
+
+ :language
+ "Closed quantifier-free formulas built over an arbitrary expansion of the
+ Ints and ArraysEx signatures with free constant symbols, with the
+ restriction
+ - all array terms have sort (Array Int Int).
+ "
)
\ No newline at end of file
diff --git a/SMT/logics/QF_AUFBV.smt2 b/SMT/logics/QF_AUFBV.smt2
index 85a8799..b3c6f28 100644
--- a/SMT/logics/QF_AUFBV.smt2
+++ b/SMT/logics/QF_AUFBV.smt2
@@ -1,20 +1,20 @@
-(logic QF_AUFBV
-
-:smt-lib-version 2.0
-:written_by "Cesare Tinelli and Clark Barrett"
-:date "2010-05-11"
-
-:theories (Fixed_Size_BitVectors ArraysEx)
-
-:language
- "Closed quantifier-free formulas built over an arbitrary expansion of the
- Fixed_Size_BitVectors and ArraysEx signatures with free sort and function
- symbols, but with the restriction that all array terms have sort of the
- form (Array (_ BitVec i) (_ BitVec j)) for some i, j > 0.
- "
-
-:extensions
- "As in the logic QF_BV."
-)
-
-
+(logic QF_AUFBV
+
+:smt-lib-version 2.0
+:written_by "Cesare Tinelli and Clark Barrett"
+:date "2010-05-11"
+
+:theories (Fixed_Size_BitVectors ArraysEx)
+
+:language
+ "Closed quantifier-free formulas built over an arbitrary expansion of the
+ Fixed_Size_BitVectors and ArraysEx signatures with free sort and function
+ symbols, but with the restriction that all array terms have sort of the
+ form (Array (_ BitVec i) (_ BitVec j)) for some i, j > 0.
+ "
+
+:extensions
+ "As in the logic QF_BV."
+)
+
+
diff --git a/SMT/logics/QF_AUFLIA.smt2 b/SMT/logics/QF_AUFLIA.smt2
index 77a7d1b..b61a250 100644
--- a/SMT/logics/QF_AUFLIA.smt2
+++ b/SMT/logics/QF_AUFLIA.smt2
@@ -1,22 +1,22 @@
-(logic QF_AUFLIA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-30"
-
- :theories (Ints ArraysEx)
-
- :language
- "Closed quantifier-free formulas built over arbitrary expansions of the
- Ints and ArraysEx signatures with free sort and function symbols, but
- with the following restrictions:
- - all terms of sort Int are linear, that is, have no occurrences of the
- function symbols *, /, div, mod, and abs, except as specified in the
- :extensions attributes;
- - all array terms have sort (Array Int Int).
- "
-
- :extensions
- "As in the logic QF_LIA."
-)
-
+(logic QF_AUFLIA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-30"
+
+ :theories (Ints ArraysEx)
+
+ :language
+ "Closed quantifier-free formulas built over arbitrary expansions of the
+ Ints and ArraysEx signatures with free sort and function symbols, but
+ with the following restrictions:
+ - all terms of sort Int are linear, that is, have no occurrences of the
+ function symbols *, /, div, mod, and abs, except as specified in the
+ :extensions attributes;
+ - all array terms have sort (Array Int Int).
+ "
+
+ :extensions
+ "As in the logic QF_LIA."
+)
+
diff --git a/SMT/logics/QF_AUFNIA.smt2 b/SMT/logics/QF_AUFNIA.smt2
index 165556a..4e26c5f 100644
--- a/SMT/logics/QF_AUFNIA.smt2
+++ b/SMT/logics/QF_AUFNIA.smt2
@@ -1,15 +1,15 @@
-(logic QF_AUFNIA
-
- :smt-lib-version 2.0
- :written_by "David COk, based on others"
- :date "2015-06-27"
-
- :theories (Ints ArraysEx)
-
- :language
- "Closed quantifier-free formulas built over an arbitrary expansion of the
- Ints and ArraysEx signatures with free sort and function symbols, with the
- restriction
- - all array terms have sort (Array Int Int).
- "
+(logic QF_AUFNIA
+
+ :smt-lib-version 2.0
+ :written_by "David COk, based on others"
+ :date "2015-06-27"
+
+ :theories (Ints ArraysEx)
+
+ :language
+ "Closed quantifier-free formulas built over an arbitrary expansion of the
+ Ints and ArraysEx signatures with free sort and function symbols, with the
+ restriction
+ - all array terms have sort (Array Int Int).
+ "
)
\ No newline at end of file
diff --git a/SMT/logics/QF_AX.smt2 b/SMT/logics/QF_AX.smt2
index 7f1cf87..e0f0a06 100644
--- a/SMT/logics/QF_AX.smt2
+++ b/SMT/logics/QF_AX.smt2
@@ -1,19 +1,19 @@
-(logic QF_AX
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-30"
-
- :theories (ArraysEx)
-
- :language
- "Closed quantifier-free formulas built over an arbitrary expansion of
- the ArraysEx signature with free sort and constant symbols.
- "
-
- :notes
- "Formulas can contain variables as long as they are bound by a let binder."
-
-)
-
-
+(logic QF_AX
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-30"
+
+ :theories (ArraysEx)
+
+ :language
+ "Closed quantifier-free formulas built over an arbitrary expansion of
+ the ArraysEx signature with free sort and constant symbols.
+ "
+
+ :notes
+ "Formulas can contain variables as long as they are bound by a let binder."
+
+)
+
+
diff --git a/SMT/logics/QF_BV.smt2 b/SMT/logics/QF_BV.smt2
index 1aa5c82..e6efe95 100644
--- a/SMT/logics/QF_BV.smt2
+++ b/SMT/logics/QF_BV.smt2
@@ -1,237 +1,237 @@
-(logic QF_BV
-
-:smt-lib-version 2.0
-:written_by "Silvio Ranise, Cesare Tinelli, and Clark Barrett"
-:date "2010-05-02"
-
-:theories (Fixed_Size_BitVectors)
-
-:language
- "Closed quantifier-free formulas built over an arbitrary expansion of the
- Fixed_Size_BitVectors signature with free constant symbols over the sorts
- (_ BitVec m) for 0 < m. Formulas in ite terms must satisfy the same
- restriction as well, with the exception that they need not be closed
- (because they may be in the scope of a let binder).
- "
-
-:notes
- "For quick reference, the following is a brief and informal summary of the
- legal symbols in this logic and their meaning (formal definitions are found
- either in the Fixed_Size_Bitvectors theory, or in the extensions below).
-
- Defined in theory Fixed_Size_Bitvectors:
-
-
- Bitvector constants:
-
- - #bX where X is a binary numeral of length m defines the
- bitvector constant with value X and size m.
- - #xX where X is a hexadecimal numeral of length m defines the
- bitvector constant with value X and size 4*m.
-
- Functions:
-
- (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
- - concatenation of bitvectors of size i and j to get a new bitvector of
- size m, where m = i + j
- ((_ extract i j) (_ BitVec m) (_ BitVec n))
- - extraction of bits i down to j from a bitvector of size m to yield a
- new bitvector of size n, where n = i - j + 1
- (bvnot (_ BitVec m) (_ BitVec m))
- - bitwise negation
- (bvand (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise and
- (bvor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise or
- (bvneg (_ BitVec m) (_ BitVec m))
- - 2's complement unary minus
- (bvadd (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - addition modulo 2^m
- (bvmul (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - multiplication modulo 2^m
- (bvudiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - unsigned division, truncating towards 0 (undefined if divisor is 0)
- (bvurem (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - unsigned remainder from truncating division (undefined if divisor is 0)
- (bvshl (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - shift left (equivalent to multiplication by 2^x where x is the value of
- the second argument)
- (bvlshr (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - logical shift right (equivalent to unsigned division by 2^x where x is
- the value of the second argument)
- (bvult (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned less-than
-
- Defined below:
-
- Functions:
-
- (bvnand (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise nand (negation of and)
- (bvnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise nor (negation of or)
- (bvxor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise exclusive or
- (bvxnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise equivalence (equivalently, negation of bitwise exclusive or)
- (bvcomp (_ BitVec m) (_ BitVec m) (_ BitVec 1))
- - bit comparator: equals #b1 iff all bits are equal
- (bvsub (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement subtraction modulo 2^m
- (bvsdiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed division
- (bvsrem (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed remainder (sign follows dividend)
- (bvsmod (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed remainder (sign follows divisor)
- (bvashr (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - Arithmetic shift right, like logical shift right except that the most
- significant bits of the result always copy the most significant
- bit of the first argument.
-
- The following symbols are parameterized by the numeral i, where i >= 1.
-
- ((_ repeat i) (_ BitVec m) (_ BitVec i*m))
- - ((_ repeat i) x) means concatenate i copies of x
-
- The following symbols are parameterized by the numeral i, where i >= 0.
-
- ((_ zero_extend i) (_ BitVec m) (_ BitVec m+i))
- - ((_ zero_extend i) x) means extend x with zeroes to the (unsigned)
- equivalent bitvector of size m+i
- ((_ sign_extend i) (_ BitVec m) (_ BitVec m+i))
- - ((_ sign_extend i) x) means extend x to the (signed) equivalent bitvector
- of size m+i
- ((_ rotate_left i) (_ BitVec m) (_ BitVec m))
- - ((_ rotate_left i) x) means rotate bits of x to the left i times
- ((_ rotate_right i) (_ BitVec m) (_ BitVec m))
- - ((_ rotate_right i) x) means rotate bits of x to the right i times
-
- (bvule (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned less than or equal
- (bvugt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned greater than
- (bvuge (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned greater than or equal
- (bvslt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed less than
- (bvsle (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed less than or equal
- (bvsgt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed greater than
- (bvsge (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed greater than or equal
-
- "
-
-:extensions
- "Below, let |exp| denote the integer resulting from the evaluation
- of the arithmetic expression exp.
-
- - Bitvector Constants:
- (_ bvX n) where X and n are numerals, i.e. (_ bv13 32),
- abbreviates the term #bY of sort (_ BitVec n) such that
-
- [[#bY]] = nat2bv[n](X) for X=0, ..., 2^n - 1.
-
- See the specification of the theory's semantics for a definition
- of the functions [[_]] and nat2bv. Note that this convention implicitly
- considers the numeral X as a number written in base 10.
-
- - Bitwise operators
-
- For all terms s,t of sort (_ BitVec m), where 0 < m,
-
- (bvnand s t) abbreviates (bvnot (bvand s t))
- (bvnor s t) abbreviates (bvnot (bvor s t))
- (bvxor s t) abbreviates (bvor (bvand s (bvnot t)) (bvand (bvnot s) t))
- (bvxnor s t) abbreviates (bvor (bvand s t) (bvand (bvnot s) (bvnot t)))
- (bvcomp s t) abbreviates (bvxnor s t) if m = 1, and
- (bvand (bvxnor ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvcomp ((_ extract |m-2| 0) s) ((_ extract |m-2| 0) t))) otherwise
-
- - Arithmetic operators
-
- For all terms s,t of sort (_ BitVec m), where 0 < m,
-
- (bvsub s t) abbreviates (bvadd s (bvneg t))
- (bvsdiv s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvudiv s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvneg (bvudiv (bvneg s) t))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvneg (bvudiv s (bvneg t)))
- (bvudiv (bvneg s) (bvneg t))))))
- (bvsrem s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvurem s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvneg (bvurem (bvneg s) t))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvurem s (bvneg t)))
- (bvneg (bvurem (bvneg s) (bvneg t))))))
- (bvsmod s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvurem s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvadd (bvneg (bvurem (bvneg s) t)) t)
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvadd (bvurem s (bvneg t)) t)
- (bvneg (bvurem (bvneg s) (bvneg t)))))))
- (bvule s t) abbreviates (or (bvult s t) (= s t))
- (bvugt s t) abbreviates (bvult t s)
- (bvuge s t) abbreviates (or (bvult t s) (= s t))
- (bvslt s t) abbreviates:
- (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
- (= ((_ extract |m-1| |m-1|) t) #b0))
- (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvult s t)))
- (bvsle s t) abbreviates:
- (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
- (= ((_ extract |m-1| |m-1|) t) #b0))
- (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvule s t)))
- (bvsgt s t) abbreviates (bvslt t s)
- (bvsge s t) abbreviates (bvsle t s)
-
- - Other operations
-
- For all numerals i > 0, j > 1 and 0 < m, and all terms s and t of
- sort (_ BitVec m),
-
- (bvashr s t) abbreviates
- (ite (= ((_ extract |m-1| |m-1|) s) #b0)
- (bvlshr s t)
- (bvnot (bvlshr (bvnot s) t)))
-
- ((_ repeat 1) t) stands for t
- ((_ repeat j) t) abbreviates (concat t ((_ repeat |j-1|) t))
-
- ((_ zero_extend 0) t) stands for t
- ((_ zero_extend i) t) abbreviates (concat ((_ repeat i) #b0) t)
-
- ((_ sign_extend 0) t) stands for t
- ((_ sign_extend i) t) abbreviates
- (concat ((_ repeat i) ((_ extract |m-1| |m-1|) t)) t)
-
- ((_ rotate_left 0) t) stands for t
- ((_ rotate_left i) t) abbreviates t if m = 1, and
- ((_ rotate_left |i-1|)
- (concat ((_ extract |m-2| 0) t) ((_ extract |m-1| |m-1|) t))
- otherwise
-
- ((_ rotate_right 0) t) stands for t
- ((_ rotate_right i) t) abbreviates t if m = 1, and
- ((_ rotate_right |i-1|)
- (concat ((_ extract 0 0) t) ((_ extract |m-1| 1) t)))
- otherwise
- "
-)
-
+(logic QF_BV
+
+:smt-lib-version 2.0
+:written_by "Silvio Ranise, Cesare Tinelli, and Clark Barrett"
+:date "2010-05-02"
+
+:theories (Fixed_Size_BitVectors)
+
+:language
+ "Closed quantifier-free formulas built over an arbitrary expansion of the
+ Fixed_Size_BitVectors signature with free constant symbols over the sorts
+ (_ BitVec m) for 0 < m. Formulas in ite terms must satisfy the same
+ restriction as well, with the exception that they need not be closed
+ (because they may be in the scope of a let binder).
+ "
+
+:notes
+ "For quick reference, the following is a brief and informal summary of the
+ legal symbols in this logic and their meaning (formal definitions are found
+ either in the Fixed_Size_Bitvectors theory, or in the extensions below).
+
+ Defined in theory Fixed_Size_Bitvectors:
+
+
+ Bitvector constants:
+
+ - #bX where X is a binary numeral of length m defines the
+ bitvector constant with value X and size m.
+ - #xX where X is a hexadecimal numeral of length m defines the
+ bitvector constant with value X and size 4*m.
+
+ Functions:
+
+ (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
+ - concatenation of bitvectors of size i and j to get a new bitvector of
+ size m, where m = i + j
+ ((_ extract i j) (_ BitVec m) (_ BitVec n))
+ - extraction of bits i down to j from a bitvector of size m to yield a
+ new bitvector of size n, where n = i - j + 1
+ (bvnot (_ BitVec m) (_ BitVec m))
+ - bitwise negation
+ (bvand (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise and
+ (bvor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise or
+ (bvneg (_ BitVec m) (_ BitVec m))
+ - 2's complement unary minus
+ (bvadd (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - addition modulo 2^m
+ (bvmul (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - multiplication modulo 2^m
+ (bvudiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - unsigned division, truncating towards 0 (undefined if divisor is 0)
+ (bvurem (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - unsigned remainder from truncating division (undefined if divisor is 0)
+ (bvshl (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - shift left (equivalent to multiplication by 2^x where x is the value of
+ the second argument)
+ (bvlshr (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - logical shift right (equivalent to unsigned division by 2^x where x is
+ the value of the second argument)
+ (bvult (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned less-than
+
+ Defined below:
+
+ Functions:
+
+ (bvnand (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise nand (negation of and)
+ (bvnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise nor (negation of or)
+ (bvxor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise exclusive or
+ (bvxnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise equivalence (equivalently, negation of bitwise exclusive or)
+ (bvcomp (_ BitVec m) (_ BitVec m) (_ BitVec 1))
+ - bit comparator: equals #b1 iff all bits are equal
+ (bvsub (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement subtraction modulo 2^m
+ (bvsdiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed division
+ (bvsrem (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed remainder (sign follows dividend)
+ (bvsmod (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed remainder (sign follows divisor)
+ (bvashr (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - Arithmetic shift right, like logical shift right except that the most
+ significant bits of the result always copy the most significant
+ bit of the first argument.
+
+ The following symbols are parameterized by the numeral i, where i >= 1.
+
+ ((_ repeat i) (_ BitVec m) (_ BitVec i*m))
+ - ((_ repeat i) x) means concatenate i copies of x
+
+ The following symbols are parameterized by the numeral i, where i >= 0.
+
+ ((_ zero_extend i) (_ BitVec m) (_ BitVec m+i))
+ - ((_ zero_extend i) x) means extend x with zeroes to the (unsigned)
+ equivalent bitvector of size m+i
+ ((_ sign_extend i) (_ BitVec m) (_ BitVec m+i))
+ - ((_ sign_extend i) x) means extend x to the (signed) equivalent bitvector
+ of size m+i
+ ((_ rotate_left i) (_ BitVec m) (_ BitVec m))
+ - ((_ rotate_left i) x) means rotate bits of x to the left i times
+ ((_ rotate_right i) (_ BitVec m) (_ BitVec m))
+ - ((_ rotate_right i) x) means rotate bits of x to the right i times
+
+ (bvule (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned less than or equal
+ (bvugt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned greater than
+ (bvuge (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned greater than or equal
+ (bvslt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed less than
+ (bvsle (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed less than or equal
+ (bvsgt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed greater than
+ (bvsge (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed greater than or equal
+
+ "
+
+:extensions
+ "Below, let |exp| denote the integer resulting from the evaluation
+ of the arithmetic expression exp.
+
+ - Bitvector Constants:
+ (_ bvX n) where X and n are numerals, i.e. (_ bv13 32),
+ abbreviates the term #bY of sort (_ BitVec n) such that
+
+ [[#bY]] = nat2bv[n](X) for X=0, ..., 2^n - 1.
+
+ See the specification of the theory's semantics for a definition
+ of the functions [[_]] and nat2bv. Note that this convention implicitly
+ considers the numeral X as a number written in base 10.
+
+ - Bitwise operators
+
+ For all terms s,t of sort (_ BitVec m), where 0 < m,
+
+ (bvnand s t) abbreviates (bvnot (bvand s t))
+ (bvnor s t) abbreviates (bvnot (bvor s t))
+ (bvxor s t) abbreviates (bvor (bvand s (bvnot t)) (bvand (bvnot s) t))
+ (bvxnor s t) abbreviates (bvor (bvand s t) (bvand (bvnot s) (bvnot t)))
+ (bvcomp s t) abbreviates (bvxnor s t) if m = 1, and
+ (bvand (bvxnor ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvcomp ((_ extract |m-2| 0) s) ((_ extract |m-2| 0) t))) otherwise
+
+ - Arithmetic operators
+
+ For all terms s,t of sort (_ BitVec m), where 0 < m,
+
+ (bvsub s t) abbreviates (bvadd s (bvneg t))
+ (bvsdiv s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvudiv s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvneg (bvudiv (bvneg s) t))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvneg (bvudiv s (bvneg t)))
+ (bvudiv (bvneg s) (bvneg t))))))
+ (bvsrem s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvurem s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvneg (bvurem (bvneg s) t))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvurem s (bvneg t)))
+ (bvneg (bvurem (bvneg s) (bvneg t))))))
+ (bvsmod s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvurem s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvadd (bvneg (bvurem (bvneg s) t)) t)
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvadd (bvurem s (bvneg t)) t)
+ (bvneg (bvurem (bvneg s) (bvneg t)))))))
+ (bvule s t) abbreviates (or (bvult s t) (= s t))
+ (bvugt s t) abbreviates (bvult t s)
+ (bvuge s t) abbreviates (or (bvult t s) (= s t))
+ (bvslt s t) abbreviates:
+ (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
+ (= ((_ extract |m-1| |m-1|) t) #b0))
+ (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvult s t)))
+ (bvsle s t) abbreviates:
+ (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
+ (= ((_ extract |m-1| |m-1|) t) #b0))
+ (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvule s t)))
+ (bvsgt s t) abbreviates (bvslt t s)
+ (bvsge s t) abbreviates (bvsle t s)
+
+ - Other operations
+
+ For all numerals i > 0, j > 1 and 0 < m, and all terms s and t of
+ sort (_ BitVec m),
+
+ (bvashr s t) abbreviates
+ (ite (= ((_ extract |m-1| |m-1|) s) #b0)
+ (bvlshr s t)
+ (bvnot (bvlshr (bvnot s) t)))
+
+ ((_ repeat 1) t) stands for t
+ ((_ repeat j) t) abbreviates (concat t ((_ repeat |j-1|) t))
+
+ ((_ zero_extend 0) t) stands for t
+ ((_ zero_extend i) t) abbreviates (concat ((_ repeat i) #b0) t)
+
+ ((_ sign_extend 0) t) stands for t
+ ((_ sign_extend i) t) abbreviates
+ (concat ((_ repeat i) ((_ extract |m-1| |m-1|) t)) t)
+
+ ((_ rotate_left 0) t) stands for t
+ ((_ rotate_left i) t) abbreviates t if m = 1, and
+ ((_ rotate_left |i-1|)
+ (concat ((_ extract |m-2| 0) t) ((_ extract |m-1| |m-1|) t))
+ otherwise
+
+ ((_ rotate_right 0) t) stands for t
+ ((_ rotate_right i) t) abbreviates t if m = 1, and
+ ((_ rotate_right |i-1|)
+ (concat ((_ extract 0 0) t) ((_ extract |m-1| 1) t)))
+ otherwise
+ "
+)
+
diff --git a/SMT/logics/QF_BVFP.smt2 b/SMT/logics/QF_BVFP.smt2
index 8c0901e..5ee9ef6 100644
--- a/SMT/logics/QF_BVFP.smt2
+++ b/SMT/logics/QF_BVFP.smt2
@@ -1,237 +1,237 @@
-(logic QF_BVFP
-
-:smt-lib-version 2.0
-:written_by "David Cok, from QF_BV"
-:date "2015-06-27"
-
-:theories (Fixed_Size_BitVectors FloatingPoint)
-
-:language
- "Closed quantifier-free formulas built over an arbitrary expansion of the
- Fixed_Size_BitVectors signature with free constant symbols over the sorts
- (_ BitVec m) for 0 < m. Formulas in ite terms must satisfy the same
- restriction as well, with the exception that they need not be closed
- (because they may be in the scope of a let binder).
- "
-
-:notes
- "For quick reference, the following is a brief and informal summary of the
- legal symbols in this logic and their meaning (formal definitions are found
- either in the Fixed_Size_Bitvectors theory, or in the extensions below).
-
- Defined in theory Fixed_Size_Bitvectors:
-
-
- Bitvector constants:
-
- - #bX where X is a binary numeral of length m defines the
- bitvector constant with value X and size m.
- - #xX where X is a hexadecimal numeral of length m defines the
- bitvector constant with value X and size 4*m.
-
- Functions:
-
- (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
- - concatenation of bitvectors of size i and j to get a new bitvector of
- size m, where m = i + j
- ((_ extract i j) (_ BitVec m) (_ BitVec n))
- - extraction of bits i down to j from a bitvector of size m to yield a
- new bitvector of size n, where n = i - j + 1
- (bvnot (_ BitVec m) (_ BitVec m))
- - bitwise negation
- (bvand (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise and
- (bvor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise or
- (bvneg (_ BitVec m) (_ BitVec m))
- - 2's complement unary minus
- (bvadd (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - addition modulo 2^m
- (bvmul (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - multiplication modulo 2^m
- (bvudiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - unsigned division, truncating towards 0 (undefined if divisor is 0)
- (bvurem (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - unsigned remainder from truncating division (undefined if divisor is 0)
- (bvshl (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - shift left (equivalent to multiplication by 2^x where x is the value of
- the second argument)
- (bvlshr (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - logical shift right (equivalent to unsigned division by 2^x where x is
- the value of the second argument)
- (bvult (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned less-than
-
- Defined below:
-
- Functions:
-
- (bvnand (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise nand (negation of and)
- (bvnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise nor (negation of or)
- (bvxor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise exclusive or
- (bvxnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise equivalence (equivalently, negation of bitwise exclusive or)
- (bvcomp (_ BitVec m) (_ BitVec m) (_ BitVec 1))
- - bit comparator: equals #b1 iff all bits are equal
- (bvsub (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement subtraction modulo 2^m
- (bvsdiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed division
- (bvsrem (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed remainder (sign follows dividend)
- (bvsmod (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed remainder (sign follows divisor)
- (bvashr (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - Arithmetic shift right, like logical shift right except that the most
- significant bits of the result always copy the most significant
- bit of the first argument.
-
- The following symbols are parameterized by the numeral i, where i >= 1.
-
- ((_ repeat i) (_ BitVec m) (_ BitVec i*m))
- - ((_ repeat i) x) means concatenate i copies of x
-
- The following symbols are parameterized by the numeral i, where i >= 0.
-
- ((_ zero_extend i) (_ BitVec m) (_ BitVec m+i))
- - ((_ zero_extend i) x) means extend x with zeroes to the (unsigned)
- equivalent bitvector of size m+i
- ((_ sign_extend i) (_ BitVec m) (_ BitVec m+i))
- - ((_ sign_extend i) x) means extend x to the (signed) equivalent bitvector
- of size m+i
- ((_ rotate_left i) (_ BitVec m) (_ BitVec m))
- - ((_ rotate_left i) x) means rotate bits of x to the left i times
- ((_ rotate_right i) (_ BitVec m) (_ BitVec m))
- - ((_ rotate_right i) x) means rotate bits of x to the right i times
-
- (bvule (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned less than or equal
- (bvugt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned greater than
- (bvuge (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned greater than or equal
- (bvslt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed less than
- (bvsle (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed less than or equal
- (bvsgt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed greater than
- (bvsge (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed greater than or equal
-
- "
-
-:extensions
- "Below, let |exp| denote the integer resulting from the evaluation
- of the arithmetic expression exp.
-
- - Bitvector Constants:
- (_ bvX n) where X and n are numerals, i.e. (_ bv13 32),
- abbreviates the term #bY of sort (_ BitVec n) such that
-
- [[#bY]] = nat2bv[n](X) for X=0, ..., 2^n - 1.
-
- See the specification of the theory's semantics for a definition
- of the functions [[_]] and nat2bv. Note that this convention implicitly
- considers the numeral X as a number written in base 10.
-
- - Bitwise operators
-
- For all terms s,t of sort (_ BitVec m), where 0 < m,
-
- (bvnand s t) abbreviates (bvnot (bvand s t))
- (bvnor s t) abbreviates (bvnot (bvor s t))
- (bvxor s t) abbreviates (bvor (bvand s (bvnot t)) (bvand (bvnot s) t))
- (bvxnor s t) abbreviates (bvor (bvand s t) (bvand (bvnot s) (bvnot t)))
- (bvcomp s t) abbreviates (bvxnor s t) if m = 1, and
- (bvand (bvxnor ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvcomp ((_ extract |m-2| 0) s) ((_ extract |m-2| 0) t))) otherwise
-
- - Arithmetic operators
-
- For all terms s,t of sort (_ BitVec m), where 0 < m,
-
- (bvsub s t) abbreviates (bvadd s (bvneg t))
- (bvsdiv s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvudiv s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvneg (bvudiv (bvneg s) t))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvneg (bvudiv s (bvneg t)))
- (bvudiv (bvneg s) (bvneg t))))))
- (bvsrem s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvurem s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvneg (bvurem (bvneg s) t))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvurem s (bvneg t)))
- (bvneg (bvurem (bvneg s) (bvneg t))))))
- (bvsmod s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvurem s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvadd (bvneg (bvurem (bvneg s) t)) t)
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvadd (bvurem s (bvneg t)) t)
- (bvneg (bvurem (bvneg s) (bvneg t)))))))
- (bvule s t) abbreviates (or (bvult s t) (= s t))
- (bvugt s t) abbreviates (bvult t s)
- (bvuge s t) abbreviates (or (bvult t s) (= s t))
- (bvslt s t) abbreviates:
- (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
- (= ((_ extract |m-1| |m-1|) t) #b0))
- (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvult s t)))
- (bvsle s t) abbreviates:
- (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
- (= ((_ extract |m-1| |m-1|) t) #b0))
- (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvule s t)))
- (bvsgt s t) abbreviates (bvslt t s)
- (bvsge s t) abbreviates (bvsle t s)
-
- - Other operations
-
- For all numerals i > 0, j > 1 and 0 < m, and all terms s and t of
- sort (_ BitVec m),
-
- (bvashr s t) abbreviates
- (ite (= ((_ extract |m-1| |m-1|) s) #b0)
- (bvlshr s t)
- (bvnot (bvlshr (bvnot s) t)))
-
- ((_ repeat 1) t) stands for t
- ((_ repeat j) t) abbreviates (concat t ((_ repeat |j-1|) t))
-
- ((_ zero_extend 0) t) stands for t
- ((_ zero_extend i) t) abbreviates (concat ((_ repeat i) #b0) t)
-
- ((_ sign_extend 0) t) stands for t
- ((_ sign_extend i) t) abbreviates
- (concat ((_ repeat i) ((_ extract |m-1| |m-1|) t)) t)
-
- ((_ rotate_left 0) t) stands for t
- ((_ rotate_left i) t) abbreviates t if m = 1, and
- ((_ rotate_left |i-1|)
- (concat ((_ extract |m-2| 0) t) ((_ extract |m-1| |m-1|) t))
- otherwise
-
- ((_ rotate_right 0) t) stands for t
- ((_ rotate_right i) t) abbreviates t if m = 1, and
- ((_ rotate_right |i-1|)
- (concat ((_ extract 0 0) t) ((_ extract |m-1| 1) t)))
- otherwise
- "
-)
-
+(logic QF_BVFP
+
+:smt-lib-version 2.0
+:written_by "David Cok, from QF_BV"
+:date "2015-06-27"
+
+:theories (Fixed_Size_BitVectors FloatingPoint)
+
+:language
+ "Closed quantifier-free formulas built over an arbitrary expansion of the
+ Fixed_Size_BitVectors signature with free constant symbols over the sorts
+ (_ BitVec m) for 0 < m. Formulas in ite terms must satisfy the same
+ restriction as well, with the exception that they need not be closed
+ (because they may be in the scope of a let binder).
+ "
+
+:notes
+ "For quick reference, the following is a brief and informal summary of the
+ legal symbols in this logic and their meaning (formal definitions are found
+ either in the Fixed_Size_Bitvectors theory, or in the extensions below).
+
+ Defined in theory Fixed_Size_Bitvectors:
+
+
+ Bitvector constants:
+
+ - #bX where X is a binary numeral of length m defines the
+ bitvector constant with value X and size m.
+ - #xX where X is a hexadecimal numeral of length m defines the
+ bitvector constant with value X and size 4*m.
+
+ Functions:
+
+ (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
+ - concatenation of bitvectors of size i and j to get a new bitvector of
+ size m, where m = i + j
+ ((_ extract i j) (_ BitVec m) (_ BitVec n))
+ - extraction of bits i down to j from a bitvector of size m to yield a
+ new bitvector of size n, where n = i - j + 1
+ (bvnot (_ BitVec m) (_ BitVec m))
+ - bitwise negation
+ (bvand (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise and
+ (bvor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise or
+ (bvneg (_ BitVec m) (_ BitVec m))
+ - 2's complement unary minus
+ (bvadd (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - addition modulo 2^m
+ (bvmul (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - multiplication modulo 2^m
+ (bvudiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - unsigned division, truncating towards 0 (undefined if divisor is 0)
+ (bvurem (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - unsigned remainder from truncating division (undefined if divisor is 0)
+ (bvshl (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - shift left (equivalent to multiplication by 2^x where x is the value of
+ the second argument)
+ (bvlshr (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - logical shift right (equivalent to unsigned division by 2^x where x is
+ the value of the second argument)
+ (bvult (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned less-than
+
+ Defined below:
+
+ Functions:
+
+ (bvnand (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise nand (negation of and)
+ (bvnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise nor (negation of or)
+ (bvxor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise exclusive or
+ (bvxnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise equivalence (equivalently, negation of bitwise exclusive or)
+ (bvcomp (_ BitVec m) (_ BitVec m) (_ BitVec 1))
+ - bit comparator: equals #b1 iff all bits are equal
+ (bvsub (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement subtraction modulo 2^m
+ (bvsdiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed division
+ (bvsrem (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed remainder (sign follows dividend)
+ (bvsmod (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed remainder (sign follows divisor)
+ (bvashr (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - Arithmetic shift right, like logical shift right except that the most
+ significant bits of the result always copy the most significant
+ bit of the first argument.
+
+ The following symbols are parameterized by the numeral i, where i >= 1.
+
+ ((_ repeat i) (_ BitVec m) (_ BitVec i*m))
+ - ((_ repeat i) x) means concatenate i copies of x
+
+ The following symbols are parameterized by the numeral i, where i >= 0.
+
+ ((_ zero_extend i) (_ BitVec m) (_ BitVec m+i))
+ - ((_ zero_extend i) x) means extend x with zeroes to the (unsigned)
+ equivalent bitvector of size m+i
+ ((_ sign_extend i) (_ BitVec m) (_ BitVec m+i))
+ - ((_ sign_extend i) x) means extend x to the (signed) equivalent bitvector
+ of size m+i
+ ((_ rotate_left i) (_ BitVec m) (_ BitVec m))
+ - ((_ rotate_left i) x) means rotate bits of x to the left i times
+ ((_ rotate_right i) (_ BitVec m) (_ BitVec m))
+ - ((_ rotate_right i) x) means rotate bits of x to the right i times
+
+ (bvule (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned less than or equal
+ (bvugt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned greater than
+ (bvuge (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned greater than or equal
+ (bvslt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed less than
+ (bvsle (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed less than or equal
+ (bvsgt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed greater than
+ (bvsge (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed greater than or equal
+
+ "
+
+:extensions
+ "Below, let |exp| denote the integer resulting from the evaluation
+ of the arithmetic expression exp.
+
+ - Bitvector Constants:
+ (_ bvX n) where X and n are numerals, i.e. (_ bv13 32),
+ abbreviates the term #bY of sort (_ BitVec n) such that
+
+ [[#bY]] = nat2bv[n](X) for X=0, ..., 2^n - 1.
+
+ See the specification of the theory's semantics for a definition
+ of the functions [[_]] and nat2bv. Note that this convention implicitly
+ considers the numeral X as a number written in base 10.
+
+ - Bitwise operators
+
+ For all terms s,t of sort (_ BitVec m), where 0 < m,
+
+ (bvnand s t) abbreviates (bvnot (bvand s t))
+ (bvnor s t) abbreviates (bvnot (bvor s t))
+ (bvxor s t) abbreviates (bvor (bvand s (bvnot t)) (bvand (bvnot s) t))
+ (bvxnor s t) abbreviates (bvor (bvand s t) (bvand (bvnot s) (bvnot t)))
+ (bvcomp s t) abbreviates (bvxnor s t) if m = 1, and
+ (bvand (bvxnor ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvcomp ((_ extract |m-2| 0) s) ((_ extract |m-2| 0) t))) otherwise
+
+ - Arithmetic operators
+
+ For all terms s,t of sort (_ BitVec m), where 0 < m,
+
+ (bvsub s t) abbreviates (bvadd s (bvneg t))
+ (bvsdiv s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvudiv s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvneg (bvudiv (bvneg s) t))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvneg (bvudiv s (bvneg t)))
+ (bvudiv (bvneg s) (bvneg t))))))
+ (bvsrem s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvurem s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvneg (bvurem (bvneg s) t))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvurem s (bvneg t)))
+ (bvneg (bvurem (bvneg s) (bvneg t))))))
+ (bvsmod s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvurem s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvadd (bvneg (bvurem (bvneg s) t)) t)
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvadd (bvurem s (bvneg t)) t)
+ (bvneg (bvurem (bvneg s) (bvneg t)))))))
+ (bvule s t) abbreviates (or (bvult s t) (= s t))
+ (bvugt s t) abbreviates (bvult t s)
+ (bvuge s t) abbreviates (or (bvult t s) (= s t))
+ (bvslt s t) abbreviates:
+ (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
+ (= ((_ extract |m-1| |m-1|) t) #b0))
+ (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvult s t)))
+ (bvsle s t) abbreviates:
+ (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
+ (= ((_ extract |m-1| |m-1|) t) #b0))
+ (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvule s t)))
+ (bvsgt s t) abbreviates (bvslt t s)
+ (bvsge s t) abbreviates (bvsle t s)
+
+ - Other operations
+
+ For all numerals i > 0, j > 1 and 0 < m, and all terms s and t of
+ sort (_ BitVec m),
+
+ (bvashr s t) abbreviates
+ (ite (= ((_ extract |m-1| |m-1|) s) #b0)
+ (bvlshr s t)
+ (bvnot (bvlshr (bvnot s) t)))
+
+ ((_ repeat 1) t) stands for t
+ ((_ repeat j) t) abbreviates (concat t ((_ repeat |j-1|) t))
+
+ ((_ zero_extend 0) t) stands for t
+ ((_ zero_extend i) t) abbreviates (concat ((_ repeat i) #b0) t)
+
+ ((_ sign_extend 0) t) stands for t
+ ((_ sign_extend i) t) abbreviates
+ (concat ((_ repeat i) ((_ extract |m-1| |m-1|) t)) t)
+
+ ((_ rotate_left 0) t) stands for t
+ ((_ rotate_left i) t) abbreviates t if m = 1, and
+ ((_ rotate_left |i-1|)
+ (concat ((_ extract |m-2| 0) t) ((_ extract |m-1| |m-1|) t))
+ otherwise
+
+ ((_ rotate_right 0) t) stands for t
+ ((_ rotate_right i) t) abbreviates t if m = 1, and
+ ((_ rotate_right |i-1|)
+ (concat ((_ extract 0 0) t) ((_ extract |m-1| 1) t)))
+ otherwise
+ "
+)
+
diff --git a/SMT/logics/QF_FP.smt2 b/SMT/logics/QF_FP.smt2
index 2d4b079..c97b705 100644
--- a/SMT/logics/QF_FP.smt2
+++ b/SMT/logics/QF_FP.smt2
@@ -1,18 +1,18 @@
-(logic QF_FP
-
-:smt-lib-version 2.0
-:written_by "David Cok, from QF_BV"
-:date "2015-06-27"
-
-:theories (FloatingPoint)
-
-:language
- " "
-
-:notes
- ""
-
-:extensions ""
-
-)
-
+(logic QF_FP
+
+:smt-lib-version 2.0
+:written_by "David Cok, from QF_BV"
+:date "2015-06-27"
+
+:theories (FloatingPoint)
+
+:language
+ " "
+
+:notes
+ ""
+
+:extensions ""
+
+)
+
diff --git a/SMT/logics/QF_IDL.smt2 b/SMT/logics/QF_IDL.smt2
index 154d8c7..3e460f1 100644
--- a/SMT/logics/QF_IDL.smt2
+++ b/SMT/logics/QF_IDL.smt2
@@ -1,23 +1,23 @@
-(logic QF_IDL
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-30"
-
- :theories (Ints)
-
- :language
- "Closed quantifier-free formulas with atoms of the form:
- - p
- - (op (- x y) n),
- - (op (- x y) (- n)),
- - (op x y), or
- where
- - p is a variable or free constant symbol of sort Bool,
- - op is <, <=, >, >=, =, or distinct,
- - x, y are free constant symbols of sort Ints,
- - n is a numeral.
- "
-)
-
-
+(logic QF_IDL
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-30"
+
+ :theories (Ints)
+
+ :language
+ "Closed quantifier-free formulas with atoms of the form:
+ - p
+ - (op (- x y) n),
+ - (op (- x y) (- n)),
+ - (op x y), or
+ where
+ - p is a variable or free constant symbol of sort Bool,
+ - op is <, <=, >, >=, =, or distinct,
+ - x, y are free constant symbols of sort Ints,
+ - n is a numeral.
+ "
+)
+
+
diff --git a/SMT/logics/QF_LIA.smt2 b/SMT/logics/QF_LIA.smt2
index b8f1c32..026c15d 100644
--- a/SMT/logics/QF_LIA.smt2
+++ b/SMT/logics/QF_LIA.smt2
@@ -1,23 +1,23 @@
-(logic QF_LIA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-30"
-
- :theories (Ints)
-
- :language
- "Closed quantifier-free formulas built over an arbitrary expansion of the
- Ints signature with free constant symbols, but whose terms of sort Int
- are all linear, that is, have no occurrences of the function symbols
- *, /, div, mod, and abs, except as specified the :extensions attribute.
- "
-
- :extensions
- "Terms with _concrete_ coefficients are also allowed, that is, terms
- of the form c, (* c x), or (* x c) where x is a free constant and
- c is a term of the form n or (- n) for some numeral n.
- "
-)
-
-
+(logic QF_LIA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-30"
+
+ :theories (Ints)
+
+ :language
+ "Closed quantifier-free formulas built over an arbitrary expansion of the
+ Ints signature with free constant symbols, but whose terms of sort Int
+ are all linear, that is, have no occurrences of the function symbols
+ *, /, div, mod, and abs, except as specified the :extensions attribute.
+ "
+
+ :extensions
+ "Terms with _concrete_ coefficients are also allowed, that is, terms
+ of the form c, (* c x), or (* x c) where x is a free constant and
+ c is a term of the form n or (- n) for some numeral n.
+ "
+)
+
+
diff --git a/SMT/logics/QF_LIRA.smt2 b/SMT/logics/QF_LIRA.smt2
index 0efcfd2..29dd20b 100644
--- a/SMT/logics/QF_LIRA.smt2
+++ b/SMT/logics/QF_LIRA.smt2
@@ -1,42 +1,42 @@
-(logic QF_LIRA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli and Clark Barrett"
- :date "2010-05-05"
-
- :theories (Reals_Ints)
-
-:language
- "Closed formulas built over arbitrary expansions of the Reals_Ints and
- ArraysEx signatures with free constant symbols, but with the
- following restrictions:
- - all terms of sort Int are linear, that is, have no occurrences of the
- function symbols *, /, div, mod, and abs, except as specified in the
- :extensions attributes;
- - all terms of sort Real are linear, that is, have no occurrences of the
- function symbols * and /, except as specified in the
- :extensions attribute;
- - all array terms have sort
- (Array Int Real) or
- (Array Int (Array Int Real)).
- "
-
-:extensions
- "For every operator op with declaration (op Real Real s) for some sort s,
- and every term t1, t2 of sort Int and t of sort Real, the expression
- - (op t1 t) is syntactic sugar for (op (to_real t1) t)
- - (op t t1) is syntactic sugar for (op t (to_real t1))
- - (/ t1 t2) is syntactic sugar for (/ (to_real t1) (to_real t2))
- "
-
- :extensions
- "Real or Int terms with _concrete_ coefficients are also allowed, that is,
- terms of the form (* c x), or (* x c) where
- x is a free constant of sort Int or Real and
- c is an integer or rational coefficient, respectively.
- - An integer coefficient is a term of the form m or (- m) for some
- numeral m.
- - A rational coefficient is a term of the form d, (- d) or (/ c n)
- for some decimal d, integer coefficient c and numeral n other than 0.
- "
+(logic QF_LIRA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli and Clark Barrett"
+ :date "2010-05-05"
+
+ :theories (Reals_Ints)
+
+:language
+ "Closed formulas built over arbitrary expansions of the Reals_Ints and
+ ArraysEx signatures with free constant symbols, but with the
+ following restrictions:
+ - all terms of sort Int are linear, that is, have no occurrences of the
+ function symbols *, /, div, mod, and abs, except as specified in the
+ :extensions attributes;
+ - all terms of sort Real are linear, that is, have no occurrences of the
+ function symbols * and /, except as specified in the
+ :extensions attribute;
+ - all array terms have sort
+ (Array Int Real) or
+ (Array Int (Array Int Real)).
+ "
+
+:extensions
+ "For every operator op with declaration (op Real Real s) for some sort s,
+ and every term t1, t2 of sort Int and t of sort Real, the expression
+ - (op t1 t) is syntactic sugar for (op (to_real t1) t)
+ - (op t t1) is syntactic sugar for (op t (to_real t1))
+ - (/ t1 t2) is syntactic sugar for (/ (to_real t1) (to_real t2))
+ "
+
+ :extensions
+ "Real or Int terms with _concrete_ coefficients are also allowed, that is,
+ terms of the form (* c x), or (* x c) where
+ x is a free constant of sort Int or Real and
+ c is an integer or rational coefficient, respectively.
+ - An integer coefficient is a term of the form m or (- m) for some
+ numeral m.
+ - A rational coefficient is a term of the form d, (- d) or (/ c n)
+ for some decimal d, integer coefficient c and numeral n other than 0.
+ "
)
\ No newline at end of file
diff --git a/SMT/logics/QF_LRA.smt2 b/SMT/logics/QF_LRA.smt2
index abcb02c..ce10c4d 100644
--- a/SMT/logics/QF_LRA.smt2
+++ b/SMT/logics/QF_LRA.smt2
@@ -1,27 +1,27 @@
-(logic QF_LRA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-14"
-
- :theories (Reals)
-
- :language
- "Closed quantifier-free formulas built over arbitrary expansions of
- the Reals signature with free constant symbols, but containing only
- linear atoms, that is, atoms with no occurrences of the function
- symbols * and /, except as specified the :extensions attribute.
- "
-
- :extensions
- "Terms with _concrete_ coefficients are also allowed, that is, terms
- of the form (* c x), or (* x c) where x is a free constant and
- c is an integer or rational coefficient.
- - An integer coefficient is a term of the form m or (- m) for some
- numeral m.
- - A rational coefficient is a term of the form d, (- d) or (/ c n)
- for some decimal d, integer coefficient c and numeral n other than 0.
- "
-)
-
-
+(logic QF_LRA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-14"
+
+ :theories (Reals)
+
+ :language
+ "Closed quantifier-free formulas built over arbitrary expansions of
+ the Reals signature with free constant symbols, but containing only
+ linear atoms, that is, atoms with no occurrences of the function
+ symbols * and /, except as specified the :extensions attribute.
+ "
+
+ :extensions
+ "Terms with _concrete_ coefficients are also allowed, that is, terms
+ of the form (* c x), or (* x c) where x is a free constant and
+ c is an integer or rational coefficient.
+ - An integer coefficient is a term of the form m or (- m) for some
+ numeral m.
+ - A rational coefficient is a term of the form d, (- d) or (/ c n)
+ for some decimal d, integer coefficient c and numeral n other than 0.
+ "
+)
+
+
diff --git a/SMT/logics/QF_NIA.smt2 b/SMT/logics/QF_NIA.smt2
index d8ae565..caec200 100644
--- a/SMT/logics/QF_NIA.smt2
+++ b/SMT/logics/QF_NIA.smt2
@@ -1,13 +1,13 @@
-(logic QF_NIA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-05-12"
-
- :theories (Ints)
-
- :language
- "Closed quantifier-free formulas built over an arbitrary expansion of the
- Ints signature with free constant symbols.
- "
-)
+(logic QF_NIA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-05-12"
+
+ :theories (Ints)
+
+ :language
+ "Closed quantifier-free formulas built over an arbitrary expansion of the
+ Ints signature with free constant symbols.
+ "
+)
diff --git a/SMT/logics/QF_NIRA.smt2 b/SMT/logics/QF_NIRA.smt2
index f503831..c43381f 100644
--- a/SMT/logics/QF_NIRA.smt2
+++ b/SMT/logics/QF_NIRA.smt2
@@ -1,26 +1,26 @@
-(logic QF_NIRA
-
- :smt-lib-version 2.0
- :written_by "David Cok, from AUFNIRA"
- :date "2015-06-27"
-
- :theories (Reals_Ints)
-
-:language
- "Closed quantifier-free formulas built over arbitrary expansions of the Reals_Ints
- signatures with free constant symbols.
- "
-
-:extensions
- "For every operator op with declaration (op Real Real s) for some sort s,
- and every term t1, t2 of sort Int and t of sort Real, the expression
- - (op t1 t) is syntactic sugar for (op (to_real t1) t)
- - (op t t1) is syntactic sugar for (op t (to_real t1))
- - (/ t1 t2) is syntactic sugar for (/ (to_real t1) (to_real t2))
- "
-
-:notes
- "This logic properly extends the logic AUFLIRA by allowing non-linear
- (integer/real) operators such as *, /, div, mod, and abs.
- "
-)
+(logic QF_NIRA
+
+ :smt-lib-version 2.0
+ :written_by "David Cok, from AUFNIRA"
+ :date "2015-06-27"
+
+ :theories (Reals_Ints)
+
+:language
+ "Closed quantifier-free formulas built over arbitrary expansions of the Reals_Ints
+ signatures with free constant symbols.
+ "
+
+:extensions
+ "For every operator op with declaration (op Real Real s) for some sort s,
+ and every term t1, t2 of sort Int and t of sort Real, the expression
+ - (op t1 t) is syntactic sugar for (op (to_real t1) t)
+ - (op t t1) is syntactic sugar for (op t (to_real t1))
+ - (/ t1 t2) is syntactic sugar for (/ (to_real t1) (to_real t2))
+ "
+
+:notes
+ "This logic properly extends the logic AUFLIRA by allowing non-linear
+ (integer/real) operators such as *, /, div, mod, and abs.
+ "
+)
diff --git a/SMT/logics/QF_NRA.smt2 b/SMT/logics/QF_NRA.smt2
index da34487..1743f3e 100644
--- a/SMT/logics/QF_NRA.smt2
+++ b/SMT/logics/QF_NRA.smt2
@@ -1,16 +1,16 @@
-(logic QF_NRA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli, David Cok"
- :date "2011-05-25"
-
- :theories (Reals)
-
- :language
- "Closed quantifier-free formulas built over arbitrary expansions of
- the Reals signature with free constant symbols.
- "
-
-)
-
-
+(logic QF_NRA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli, David Cok"
+ :date "2011-05-25"
+
+ :theories (Reals)
+
+ :language
+ "Closed quantifier-free formulas built over arbitrary expansions of
+ the Reals signature with free constant symbols.
+ "
+
+)
+
+
diff --git a/SMT/logics/QF_RDL.smt2 b/SMT/logics/QF_RDL.smt2
index 5403e61..71a9230 100644
--- a/SMT/logics/QF_RDL.smt2
+++ b/SMT/logics/QF_RDL.smt2
@@ -1,35 +1,35 @@
-(logic QF_RDL
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-30"
-
- :updated "2010-12-16"
- :update_log
- "2010-12-16 Replaced erroneous ''n > 0'' with ''n > 1'' in language attribute.
- "
-
- :theories (Reals)
-
- :language
- "Closed quantifier-free formulas with atoms of the form:
- - p
- - (op (- x y) c),
- - (op x y),
- - (op (- (+ x ... x) (+ y ... y)) c) with n > 1 occurrences of x and of y,
- where
- - p is a variable or free constant symbol of sort Bool,
- - c is an expression of the form m or (- m) for some numeral m,
- - op is <, <=, >, >=, =, or distinct,
- - x, y are free constant symbols of sort Real.
- "
-
- :extensions
- "The expression (op (- x y) (/ c n)) where n is a numeral other than 0 and
- c is an expression of the form m or (- m) for some numeral m,
- abbreviates the expression
- (op (- (+ x ... x) (+ y ... y)) c) with n occurrences of x and y.
- "
-)
-
-
+(logic QF_RDL
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-30"
+
+ :updated "2010-12-16"
+ :update_log
+ "2010-12-16 Replaced erroneous ''n > 0'' with ''n > 1'' in language attribute.
+ "
+
+ :theories (Reals)
+
+ :language
+ "Closed quantifier-free formulas with atoms of the form:
+ - p
+ - (op (- x y) c),
+ - (op x y),
+ - (op (- (+ x ... x) (+ y ... y)) c) with n > 1 occurrences of x and of y,
+ where
+ - p is a variable or free constant symbol of sort Bool,
+ - c is an expression of the form m or (- m) for some numeral m,
+ - op is <, <=, >, >=, =, or distinct,
+ - x, y are free constant symbols of sort Real.
+ "
+
+ :extensions
+ "The expression (op (- x y) (/ c n)) where n is a numeral other than 0 and
+ c is an expression of the form m or (- m) for some numeral m,
+ abbreviates the expression
+ (op (- (+ x ... x) (+ y ... y)) c) with n occurrences of x and y.
+ "
+)
+
+
diff --git a/SMT/logics/QF_UF.smt2 b/SMT/logics/QF_UF.smt2
index c18cc0a..38d7b14 100644
--- a/SMT/logics/QF_UF.smt2
+++ b/SMT/logics/QF_UF.smt2
@@ -1,26 +1,26 @@
-(logic QF_UF
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-14"
-
- :theories (Core)
-
- :language
- "Closed quantifier-free formulas built over an arbitrary expansion of
- the Core signature with free sort and function symbols.
- "
- :values
- "For each sort other than Bool the set of values is abstract.
- For Bool it is defined as in the Core theory declaration.
- "
- :notes
- "Formulas can contain variables as long as they are bound by a let binder.
- "
- :notes
- "All the free symbols used in scripts for this logic must be declared in
- the scripts themselves.
- "
-)
-
-
+(logic QF_UF
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-14"
+
+ :theories (Core)
+
+ :language
+ "Closed quantifier-free formulas built over an arbitrary expansion of
+ the Core signature with free sort and function symbols.
+ "
+ :values
+ "For each sort other than Bool the set of values is abstract.
+ For Bool it is defined as in the Core theory declaration.
+ "
+ :notes
+ "Formulas can contain variables as long as they are bound by a let binder.
+ "
+ :notes
+ "All the free symbols used in scripts for this logic must be declared in
+ the scripts themselves.
+ "
+)
+
+
diff --git a/SMT/logics/QF_UFBV.smt2 b/SMT/logics/QF_UFBV.smt2
index 20c9681..b2da17e 100644
--- a/SMT/logics/QF_UFBV.smt2
+++ b/SMT/logics/QF_UFBV.smt2
@@ -1,237 +1,237 @@
-(logic QF_UFBV
-
-:smt-lib-version 2.0
-:written_by "Silvio Ranise, Cesare Tinelli, and Clark Barrett; and David Cok"
-:date "2011-05-25"
-
-:theories (Fixed_Size_BitVectors)
-
-:language
- "Closed quantifier-free formulas built over an arbitrary expansion of the
- Fixed_Size_BitVectors signature with free sort and function symbols over the sorts
- (_ BitVec m) for 0 < m. Formulas in ite terms must satisfy the same
- restriction as well, with the exception that they need not be closed
- (because they may be in the scope of a let binder).
- "
-
-:notes
- "For quick reference, the following is a brief and informal summary of the
- legal symbols in this logic and their meaning (formal definitions are found
- either in the Fixed_Size_Bitvectors theory, or in the extensions below).
-
- Defined in theory Fixed_Size_Bitvectors:
-
-
- Bitvector constants:
-
- - #bX where X is a binary numeral of length m defines the
- bitvector constant with value X and size m.
- - #xX where X is a hexadecimal numeral of length m defines the
- bitvector constant with value X and size 4*m.
-
- Functions:
-
- (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
- - concatenation of bitvectors of size i and j to get a new bitvector of
- size m, where m = i + j
- ((_ extract i j) (_ BitVec m) (_ BitVec n))
- - extraction of bits i down to j from a bitvector of size m to yield a
- new bitvector of size n, where n = i - j + 1
- (bvnot (_ BitVec m) (_ BitVec m))
- - bitwise negation
- (bvand (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise and
- (bvor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise or
- (bvneg (_ BitVec m) (_ BitVec m))
- - 2's complement unary minus
- (bvadd (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - addition modulo 2^m
- (bvmul (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - multiplication modulo 2^m
- (bvudiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - unsigned division, truncating towards 0 (undefined if divisor is 0)
- (bvurem (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - unsigned remainder from truncating division (undefined if divisor is 0)
- (bvshl (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - shift left (equivalent to multiplication by 2^x where x is the value of
- the second argument)
- (bvlshr (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - logical shift right (equivalent to unsigned division by 2^x where x is
- the value of the second argument)
- (bvult (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned less-than
-
- Defined below:
-
- Functions:
-
- (bvnand (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise nand (negation of and)
- (bvnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise nor (negation of or)
- (bvxor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise exclusive or
- (bvxnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise equivalence (equivalently, negation of bitwise exclusive or)
- (bvcomp (_ BitVec m) (_ BitVec m) (_ BitVec 1))
- - bit comparator: equals #b1 iff all bits are equal
- (bvsub (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement subtraction modulo 2^m
- (bvsdiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed division
- (bvsrem (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed remainder (sign follows dividend)
- (bvsmod (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed remainder (sign follows divisor)
- (bvashr (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - Arithmetic shift right, like logical shift right except that the most
- significant bits of the result always copy the most significant
- bit of the first argument.
-
- The following symbols are parameterized by the numeral i, where i >= 1.
-
- ((_ repeat i) (_ BitVec m) (_ BitVec i*m))
- - ((_ repeat i) x) means concatenate i copies of x
-
- The following symbols are parameterized by the numeral i, where i >= 0.
-
- ((_ zero_extend i) (_ BitVec m) (_ BitVec m+i))
- - ((_ zero_extend i) x) means extend x with zeroes to the (unsigned)
- equivalent bitvector of size m+i
- ((_ sign_extend i) (_ BitVec m) (_ BitVec m+i))
- - ((_ sign_extend i) x) means extend x to the (signed) equivalent bitvector
- of size m+i
- ((_ rotate_left i) (_ BitVec m) (_ BitVec m))
- - ((_ rotate_left i) x) means rotate bits of x to the left i times
- ((_ rotate_right i) (_ BitVec m) (_ BitVec m))
- - ((_ rotate_right i) x) means rotate bits of x to the right i times
-
- (bvule (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned less than or equal
- (bvugt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned greater than
- (bvuge (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned greater than or equal
- (bvslt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed less than
- (bvsle (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed less than or equal
- (bvsgt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed greater than
- (bvsge (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed greater than or equal
-
- "
-
-:extensions
- "Below, let |exp| denote the integer resulting from the evaluation
- of the arithmetic expression exp.
-
- - Bitvector Constants:
- (_ bvX n) where X and n are numerals, i.e. (_ bv13 32),
- abbreviates the term #bY of sort (_ BitVec n) such that
-
- [[#bY]] = nat2bv[n](X) for X=0, ..., 2^n - 1.
-
- See the specification of the theory's semantics for a definition
- of the functions [[_]] and nat2bv. Note that this convention implicitly
- considers the numeral X as a number written in base 10.
-
- - Bitwise operators
-
- For all terms s,t of sort (_ BitVec m), where 0 < m,
-
- (bvnand s t) abbreviates (bvnot (bvand s t))
- (bvnor s t) abbreviates (bvnot (bvor s t))
- (bvxor s t) abbreviates (bvor (bvand s (bvnot t)) (bvand (bvnot s) t))
- (bvxnor s t) abbreviates (bvor (bvand s t) (bvand (bvnot s) (bvnot t)))
- (bvcomp s t) abbreviates (bvxnor s t) if m = 1, and
- (bvand (bvxnor ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvcomp ((_ extract |m-2| 0) s) ((_ extract |m-2| 0) t))) otherwise
-
- - Arithmetic operators
-
- For all terms s,t of sort (_ BitVec m), where 0 < m,
-
- (bvsub s t) abbreviates (bvadd s (bvneg t))
- (bvsdiv s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvudiv s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvneg (bvudiv (bvneg s) t))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvneg (bvudiv s (bvneg t)))
- (bvudiv (bvneg s) (bvneg t))))))
- (bvsrem s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvurem s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvneg (bvurem (bvneg s) t))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvurem s (bvneg t)))
- (bvneg (bvurem (bvneg s) (bvneg t))))))
- (bvsmod s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvurem s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvadd (bvneg (bvurem (bvneg s) t)) t)
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvadd (bvurem s (bvneg t)) t)
- (bvneg (bvurem (bvneg s) (bvneg t)))))))
- (bvule s t) abbreviates (or (bvult s t) (= s t))
- (bvugt s t) abbreviates (bvult t s)
- (bvuge s t) abbreviates (or (bvult t s) (= s t))
- (bvslt s t) abbreviates:
- (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
- (= ((_ extract |m-1| |m-1|) t) #b0))
- (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvult s t)))
- (bvsle s t) abbreviates:
- (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
- (= ((_ extract |m-1| |m-1|) t) #b0))
- (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvule s t)))
- (bvsgt s t) abbreviates (bvslt t s)
- (bvsge s t) abbreviates (bvsle t s)
-
- - Other operations
-
- For all numerals i > 0, j > 1 and 0 < m, and all terms s and t of
- sort (_ BitVec m),
-
- (bvashr s t) abbreviates
- (ite (= ((_ extract |m-1| |m-1|) s) #b0)
- (bvlshr s t)
- (bvnot (bvlshr (bvnot s) t)))
-
- ((_ repeat 1) t) stands for t
- ((_ repeat j) t) abbreviates (concat t ((_ repeat |j-1|) t))
-
- ((_ zero_extend 0) t) stands for t
- ((_ zero_extend i) t) abbreviates (concat ((_ repeat i) #b0) t)
-
- ((_ sign_extend 0) t) stands for t
- ((_ sign_extend i) t) abbreviates
- (concat ((_ repeat i) ((_ extract |m-1| |m-1|) t)) t)
-
- ((_ rotate_left 0) t) stands for t
- ((_ rotate_left i) t) abbreviates t if m = 1, and
- ((_ rotate_left |i-1|)
- (concat ((_ extract |m-2| 0) t) ((_ extract |m-1| |m-1|) t))
- otherwise
-
- ((_ rotate_right 0) t) stands for t
- ((_ rotate_right i) t) abbreviates t if m = 1, and
- ((_ rotate_right |i-1|)
- (concat ((_ extract 0 0) t) ((_ extract |m-1| 1) t)))
- otherwise
- "
-)
-
+(logic QF_UFBV
+
+:smt-lib-version 2.0
+:written_by "Silvio Ranise, Cesare Tinelli, and Clark Barrett; and David Cok"
+:date "2011-05-25"
+
+:theories (Fixed_Size_BitVectors)
+
+:language
+ "Closed quantifier-free formulas built over an arbitrary expansion of the
+ Fixed_Size_BitVectors signature with free sort and function symbols over the sorts
+ (_ BitVec m) for 0 < m. Formulas in ite terms must satisfy the same
+ restriction as well, with the exception that they need not be closed
+ (because they may be in the scope of a let binder).
+ "
+
+:notes
+ "For quick reference, the following is a brief and informal summary of the
+ legal symbols in this logic and their meaning (formal definitions are found
+ either in the Fixed_Size_Bitvectors theory, or in the extensions below).
+
+ Defined in theory Fixed_Size_Bitvectors:
+
+
+ Bitvector constants:
+
+ - #bX where X is a binary numeral of length m defines the
+ bitvector constant with value X and size m.
+ - #xX where X is a hexadecimal numeral of length m defines the
+ bitvector constant with value X and size 4*m.
+
+ Functions:
+
+ (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
+ - concatenation of bitvectors of size i and j to get a new bitvector of
+ size m, where m = i + j
+ ((_ extract i j) (_ BitVec m) (_ BitVec n))
+ - extraction of bits i down to j from a bitvector of size m to yield a
+ new bitvector of size n, where n = i - j + 1
+ (bvnot (_ BitVec m) (_ BitVec m))
+ - bitwise negation
+ (bvand (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise and
+ (bvor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise or
+ (bvneg (_ BitVec m) (_ BitVec m))
+ - 2's complement unary minus
+ (bvadd (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - addition modulo 2^m
+ (bvmul (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - multiplication modulo 2^m
+ (bvudiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - unsigned division, truncating towards 0 (undefined if divisor is 0)
+ (bvurem (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - unsigned remainder from truncating division (undefined if divisor is 0)
+ (bvshl (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - shift left (equivalent to multiplication by 2^x where x is the value of
+ the second argument)
+ (bvlshr (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - logical shift right (equivalent to unsigned division by 2^x where x is
+ the value of the second argument)
+ (bvult (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned less-than
+
+ Defined below:
+
+ Functions:
+
+ (bvnand (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise nand (negation of and)
+ (bvnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise nor (negation of or)
+ (bvxor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise exclusive or
+ (bvxnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise equivalence (equivalently, negation of bitwise exclusive or)
+ (bvcomp (_ BitVec m) (_ BitVec m) (_ BitVec 1))
+ - bit comparator: equals #b1 iff all bits are equal
+ (bvsub (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement subtraction modulo 2^m
+ (bvsdiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed division
+ (bvsrem (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed remainder (sign follows dividend)
+ (bvsmod (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed remainder (sign follows divisor)
+ (bvashr (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - Arithmetic shift right, like logical shift right except that the most
+ significant bits of the result always copy the most significant
+ bit of the first argument.
+
+ The following symbols are parameterized by the numeral i, where i >= 1.
+
+ ((_ repeat i) (_ BitVec m) (_ BitVec i*m))
+ - ((_ repeat i) x) means concatenate i copies of x
+
+ The following symbols are parameterized by the numeral i, where i >= 0.
+
+ ((_ zero_extend i) (_ BitVec m) (_ BitVec m+i))
+ - ((_ zero_extend i) x) means extend x with zeroes to the (unsigned)
+ equivalent bitvector of size m+i
+ ((_ sign_extend i) (_ BitVec m) (_ BitVec m+i))
+ - ((_ sign_extend i) x) means extend x to the (signed) equivalent bitvector
+ of size m+i
+ ((_ rotate_left i) (_ BitVec m) (_ BitVec m))
+ - ((_ rotate_left i) x) means rotate bits of x to the left i times
+ ((_ rotate_right i) (_ BitVec m) (_ BitVec m))
+ - ((_ rotate_right i) x) means rotate bits of x to the right i times
+
+ (bvule (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned less than or equal
+ (bvugt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned greater than
+ (bvuge (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned greater than or equal
+ (bvslt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed less than
+ (bvsle (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed less than or equal
+ (bvsgt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed greater than
+ (bvsge (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed greater than or equal
+
+ "
+
+:extensions
+ "Below, let |exp| denote the integer resulting from the evaluation
+ of the arithmetic expression exp.
+
+ - Bitvector Constants:
+ (_ bvX n) where X and n are numerals, i.e. (_ bv13 32),
+ abbreviates the term #bY of sort (_ BitVec n) such that
+
+ [[#bY]] = nat2bv[n](X) for X=0, ..., 2^n - 1.
+
+ See the specification of the theory's semantics for a definition
+ of the functions [[_]] and nat2bv. Note that this convention implicitly
+ considers the numeral X as a number written in base 10.
+
+ - Bitwise operators
+
+ For all terms s,t of sort (_ BitVec m), where 0 < m,
+
+ (bvnand s t) abbreviates (bvnot (bvand s t))
+ (bvnor s t) abbreviates (bvnot (bvor s t))
+ (bvxor s t) abbreviates (bvor (bvand s (bvnot t)) (bvand (bvnot s) t))
+ (bvxnor s t) abbreviates (bvor (bvand s t) (bvand (bvnot s) (bvnot t)))
+ (bvcomp s t) abbreviates (bvxnor s t) if m = 1, and
+ (bvand (bvxnor ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvcomp ((_ extract |m-2| 0) s) ((_ extract |m-2| 0) t))) otherwise
+
+ - Arithmetic operators
+
+ For all terms s,t of sort (_ BitVec m), where 0 < m,
+
+ (bvsub s t) abbreviates (bvadd s (bvneg t))
+ (bvsdiv s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvudiv s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvneg (bvudiv (bvneg s) t))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvneg (bvudiv s (bvneg t)))
+ (bvudiv (bvneg s) (bvneg t))))))
+ (bvsrem s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvurem s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvneg (bvurem (bvneg s) t))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvurem s (bvneg t)))
+ (bvneg (bvurem (bvneg s) (bvneg t))))))
+ (bvsmod s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvurem s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvadd (bvneg (bvurem (bvneg s) t)) t)
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvadd (bvurem s (bvneg t)) t)
+ (bvneg (bvurem (bvneg s) (bvneg t)))))))
+ (bvule s t) abbreviates (or (bvult s t) (= s t))
+ (bvugt s t) abbreviates (bvult t s)
+ (bvuge s t) abbreviates (or (bvult t s) (= s t))
+ (bvslt s t) abbreviates:
+ (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
+ (= ((_ extract |m-1| |m-1|) t) #b0))
+ (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvult s t)))
+ (bvsle s t) abbreviates:
+ (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
+ (= ((_ extract |m-1| |m-1|) t) #b0))
+ (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvule s t)))
+ (bvsgt s t) abbreviates (bvslt t s)
+ (bvsge s t) abbreviates (bvsle t s)
+
+ - Other operations
+
+ For all numerals i > 0, j > 1 and 0 < m, and all terms s and t of
+ sort (_ BitVec m),
+
+ (bvashr s t) abbreviates
+ (ite (= ((_ extract |m-1| |m-1|) s) #b0)
+ (bvlshr s t)
+ (bvnot (bvlshr (bvnot s) t)))
+
+ ((_ repeat 1) t) stands for t
+ ((_ repeat j) t) abbreviates (concat t ((_ repeat |j-1|) t))
+
+ ((_ zero_extend 0) t) stands for t
+ ((_ zero_extend i) t) abbreviates (concat ((_ repeat i) #b0) t)
+
+ ((_ sign_extend 0) t) stands for t
+ ((_ sign_extend i) t) abbreviates
+ (concat ((_ repeat i) ((_ extract |m-1| |m-1|) t)) t)
+
+ ((_ rotate_left 0) t) stands for t
+ ((_ rotate_left i) t) abbreviates t if m = 1, and
+ ((_ rotate_left |i-1|)
+ (concat ((_ extract |m-2| 0) t) ((_ extract |m-1| |m-1|) t))
+ otherwise
+
+ ((_ rotate_right 0) t) stands for t
+ ((_ rotate_right i) t) abbreviates t if m = 1, and
+ ((_ rotate_right |i-1|)
+ (concat ((_ extract 0 0) t) ((_ extract |m-1| 1) t)))
+ otherwise
+ "
+)
+
diff --git a/SMT/logics/QF_UFIDL.smt2 b/SMT/logics/QF_UFIDL.smt2
index 53c0ddd..44e269c 100644
--- a/SMT/logics/QF_UFIDL.smt2
+++ b/SMT/logics/QF_UFIDL.smt2
@@ -1,31 +1,31 @@
-(logic QF_UFIDL
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-05-12"
-
- :theories (Ints)
-
-
- :language
- "Closed quantifier-free formulas built over an arbitrary expansion with
- free sort and function symbols of the signature consisting of
- - all the sort and function symbols of Core and
- - the following symbols of Int:
-
- :sorts ((Int 0))
- :funs ((NUMERAL Int)
- (- Int Int Int)
- (+ Int Int Int)
- (<= Int Int Bool)
- (< Int Int Bool)
- (>= Int Int Bool)
- (> Int Int Bool)
- )
-
- Additionally, for every term of the form (op t1 t2) with op in {+, -},
- at least one of t1 and t2 is a numeral.
- "
-)
-
-
+(logic QF_UFIDL
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-05-12"
+
+ :theories (Ints)
+
+
+ :language
+ "Closed quantifier-free formulas built over an arbitrary expansion with
+ free sort and function symbols of the signature consisting of
+ - all the sort and function symbols of Core and
+ - the following symbols of Int:
+
+ :sorts ((Int 0))
+ :funs ((NUMERAL Int)
+ (- Int Int Int)
+ (+ Int Int Int)
+ (<= Int Int Bool)
+ (< Int Int Bool)
+ (>= Int Int Bool)
+ (> Int Int Bool)
+ )
+
+ Additionally, for every term of the form (op t1 t2) with op in {+, -},
+ at least one of t1 and t2 is a numeral.
+ "
+)
+
+
diff --git a/SMT/logics/QF_UFLIA.smt2 b/SMT/logics/QF_UFLIA.smt2
index 038e784..0aeba11 100644
--- a/SMT/logics/QF_UFLIA.smt2
+++ b/SMT/logics/QF_UFLIA.smt2
@@ -1,23 +1,23 @@
-(logic QF_UFLIA
-
- :smt-lib-version 2.0
- :written_by "Cesare TInelli, David Cok"
- :date "2011-05-25"
-
- :theories (Ints)
-
- :language
- "Closed quantifier-free formulas built over an arbitrary expansion of the
- Ints signature with free sort and function symbols, but whose terms of sort Int
- are all linear, that is, have no occurrences of the function symbols
- *, /, div, mod, and abs, except as specified the :extensions attribute.
- "
-
- :extensions
- "Terms with _concrete_ coefficients are also allowed, that is, terms
- of the form c, (* c x), or (* x c) where x is a free constant and
- c is a term of the form n or (- n) for some numeral n.
- "
-)
-
-
+(logic QF_UFLIA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare TInelli, David Cok"
+ :date "2011-05-25"
+
+ :theories (Ints)
+
+ :language
+ "Closed quantifier-free formulas built over an arbitrary expansion of the
+ Ints signature with free sort and function symbols, but whose terms of sort Int
+ are all linear, that is, have no occurrences of the function symbols
+ *, /, div, mod, and abs, except as specified the :extensions attribute.
+ "
+
+ :extensions
+ "Terms with _concrete_ coefficients are also allowed, that is, terms
+ of the form c, (* c x), or (* x c) where x is a free constant and
+ c is a term of the form n or (- n) for some numeral n.
+ "
+)
+
+
diff --git a/SMT/logics/QF_UFLRA.smt2 b/SMT/logics/QF_UFLRA.smt2
index f448c71..9757aab 100644
--- a/SMT/logics/QF_UFLRA.smt2
+++ b/SMT/logics/QF_UFLRA.smt2
@@ -1,27 +1,27 @@
-(logic QF_UFLRA
-
- :smt-lib-version 2.0
- :written_by "Cesare TInelli, David Cok"
- :date "2011-05-25"
-
- :theories (Reals)
-
- :language
- "Closed quantifier-free formulas built over arbitrary expansions of
- the Reals signature with free sort and function symbols, but containing only
- linear atoms, that is, atoms with no occurrences of the function
- symbols * and /, except as specified the :extensions attribute.
- "
-
- :extensions
- "Terms with _concrete_ coefficients are also allowed, that is, terms
- of the form (* c x), or (* x c) where x is a free constant and
- c is an integer or rational coefficient.
- - An integer coefficient is a term of the form m or (- m) for some
- numeral m.
- - A rational coefficient is a term of the form d, (- d) or (/ c n)
- for some decimal d, integer coefficient c and numeral n other than 0.
- "
-)
-
-
+(logic QF_UFLRA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare TInelli, David Cok"
+ :date "2011-05-25"
+
+ :theories (Reals)
+
+ :language
+ "Closed quantifier-free formulas built over arbitrary expansions of
+ the Reals signature with free sort and function symbols, but containing only
+ linear atoms, that is, atoms with no occurrences of the function
+ symbols * and /, except as specified the :extensions attribute.
+ "
+
+ :extensions
+ "Terms with _concrete_ coefficients are also allowed, that is, terms
+ of the form (* c x), or (* x c) where x is a free constant and
+ c is an integer or rational coefficient.
+ - An integer coefficient is a term of the form m or (- m) for some
+ numeral m.
+ - A rational coefficient is a term of the form d, (- d) or (/ c n)
+ for some decimal d, integer coefficient c and numeral n other than 0.
+ "
+)
+
+
diff --git a/SMT/logics/QF_UFNIA.smt2 b/SMT/logics/QF_UFNIA.smt2
index 7d4fdac..9659841 100644
--- a/SMT/logics/QF_UFNIA.smt2
+++ b/SMT/logics/QF_UFNIA.smt2
@@ -1,13 +1,13 @@
-(logic QF_UFNIA
-
- :smt-lib-version 2.0
- :written_by "David Cok, from AUFNIA"
- :date "2015-06-27"
-
- :theories (Ints)
-
- :language
- "Closed quantifier-free formulas built over an arbitrary expansion of the
- Ints signature with free sort and function symbols.
- "
+(logic QF_UFNIA
+
+ :smt-lib-version 2.0
+ :written_by "David Cok, from AUFNIA"
+ :date "2015-06-27"
+
+ :theories (Ints)
+
+ :language
+ "Closed quantifier-free formulas built over an arbitrary expansion of the
+ Ints signature with free sort and function symbols.
+ "
)
\ No newline at end of file
diff --git a/SMT/logics/QF_UFNRA.smt2 b/SMT/logics/QF_UFNRA.smt2
index 18d587f..7681826 100644
--- a/SMT/logics/QF_UFNRA.smt2
+++ b/SMT/logics/QF_UFNRA.smt2
@@ -1,16 +1,16 @@
-(logic QF_UFNRA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli, David Cok"
- :date "2011-05-25"
-
- :theories (Reals)
-
- :language
- "Closed quantifier-free formulas built over arbitrary expansions of
- the Reals signature with free sort and function symbols.
- "
-
-)
-
-
+(logic QF_UFNRA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli, David Cok"
+ :date "2011-05-25"
+
+ :theories (Reals)
+
+ :language
+ "Closed quantifier-free formulas built over arbitrary expansions of
+ the Reals signature with free sort and function symbols.
+ "
+
+)
+
+
diff --git a/SMT/logics/Reals.smt2 b/SMT/logics/Reals.smt2
index d214e96..3549309 100644
--- a/SMT/logics/Reals.smt2
+++ b/SMT/logics/Reals.smt2
@@ -1,160 +1,160 @@
-(theory Reals
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-17"
-
- :sorts ((Real 0))
-
- :funs ((NUMERAL Real)
- (DECIMAL Real)
- (- Real Real) ; negation
- (- Real Real Real :left-assoc) ; subtraction
- (+ Real Real Real :left-assoc)
- (* Real Real Real :left-assoc)
- (/ Real Real Real :left-assoc)
- (<= Real Real Bool :chainable)
- (< Real Real Bool :chainable)
- (>= Real Real Bool :chainable)
- (> Real Real Bool :chainable)
- )
-
- :values
- "The set of values for the sort Real consists of
- - all numerals
- - all terms of the form (- n) where n is a numeral other than 0
- - all terms of the form (/ m n) or (/ (- m) n) where
- - m is a numeral other than 0,
- - n is a numeral other than 0 and 1,
- - as integers, m and n have no common factors besides 1.
- "
- :definition
- "For every expanded signature Sigma, the instance of Reals with that
- signature is the theory consisting of all Sigma-models that interpret
-
- - the sort Real as the set of all real numbers,
-
- - each numeral as the corresponding real number,
-
- - each decimal as the corresponding real number,
-
- - / as a total function that coincides with the real division function
- for all inputs x and y where y is non-zero,
-
- - the other function symbols of Reals as expected.
- "
-
- :notes
- "Since in SMT-LIB logic all function symbols are interpreted as total
- functions, terms of the form (/ t 0) *are* meaningful in every
- instance of Reals. However, the declaration imposes no constraints
- on their value. This means in particular that
- - for every instance theory T and
- - for every closed terms t1 and t2 of sort Real,
- there is a model of T that satisfies (= t1 (/ t2 0)).
- "
-
- :notes
- "The restriction of Reals over the signature having just the symbols
- (0 Real)
- (1 Real)
- (- Real Real)
- (+ Real Real Real)
- (* Real Real Real)
- (<= Real Real Bool)
- (< Real Real Bool)
- coincides with the theory of real closed fields, axiomatized by
- the formulas below:
-
- - associativity of +
- (forall ((x Real) (y Real) (z Real))
- (= (+ (+ x y) z) (+ x (+ y z))))
-
- - commutativity of +
- (forall ((x Real) (y Real))
- (= (* x y) (* y x)))
-
- - 0 is the right (and by commutativity, left) unit of +
- (forall ((x Real)) (= (+ x 0) x))
-
- - right (and left) inverse wrt +
- (forall ((x Real)) (= (+ x (- x)) 0))
-
- - associativity of *
- (forall ((x Real) (y Real) (z Real))
- (= (* (* x y) z) (* x (* y z))))
-
- - commutativity of *
- (forall ((x Real) (y Real)) (= (* x y) (* y x)))
-
- - 1 is the right (and by commutativity, left) unit of *
- (forall ((x Real)) (= (* x 1) x))
-
- - existence of right (and left) inverse wrt *
- (forall ((x Real))
- (or (= x 0) (exists (y Real) (= (* x y) 1))))
-
- - left distributivity of * over +
- (forall ((x Real) (y Real) (z Real))
- (= (* x (+ y z)) (+ (* x y) (* x z))))
-
- - right distributivity of * over +
- (forall ((x Real) (y Real) (z Real))
- (= (* (+ x y) z) (+ (* x z) (* y z))))
-
- - non-triviality
- (distinct 0 1)
-
- - all positive elements have a square root
- (forall (x Real)
- (exists (y Real) (or (= x (* y y)) (= (- x) (* y y)))))
-
- - axiom schemas for all n > 0
- (forall (x_1 Real) ... (x_n Real)
- (distinct (+ (* x_1 x_1) (+ ... (* x_n x_n)))
- (- 1)))
-
- - axiom schemas for all odd n > 0 where
- (^ y n) abbreviates the n-fold product of y with itself
- (forall (x_1 Real) ... (x_n Real)
- (exists (y Real)
- (= 0
- (+ (^ y n) (+ (* x_1 (^ y n-1)) (+ ... (+ (* x_{n-1} y) x_n)))))))
-
- - reflexivity of <=
- (forall (x Real) (<= x x))
-
- - antisymmetry of <=
- (forall (x Real) (y Real)
- (implies (and (<= x y) (<= y x))
- (= x y)))
-
- - transitivity of <=
- (forall (x Real) (y Real) (z Real)
- (implies (and (<= x y) (<= y z))
- (<= x z)))
-
- - totality of <=
- (forall (x Real) (y Real)
- (or (<= x y) (<= y x)))
-
- - monotonicity of <= wrt +
- (forall (x Real) (y Real) (z Real)
- (implies (<= x y) (<= (+ x z) (+ y z))))
-
- - monotonicity of <= wrt *
- (forall (x Real) (y Real) (z Real)
- (implies (and (<= x y) (<= 0 z))
- (<= (* z x) (* z y))))
-
- - definition of <
- (forall (x Real) (y Real)
- (iff (< x y)
- (and (<= x y) (distinct x y)))
- )
-
- References:
- 1) W. Hodges. Model theory. Cambridge University Press, 1993.
- 2) PlanetMath, http://planetmath.org/encyclopedia/RealClosedFields.html
- "
-)
+(theory Reals
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-17"
+
+ :sorts ((Real 0))
+
+ :funs ((NUMERAL Real)
+ (DECIMAL Real)
+ (- Real Real) ; negation
+ (- Real Real Real :left-assoc) ; subtraction
+ (+ Real Real Real :left-assoc)
+ (* Real Real Real :left-assoc)
+ (/ Real Real Real :left-assoc)
+ (<= Real Real Bool :chainable)
+ (< Real Real Bool :chainable)
+ (>= Real Real Bool :chainable)
+ (> Real Real Bool :chainable)
+ )
+
+ :values
+ "The set of values for the sort Real consists of
+ - all numerals
+ - all terms of the form (- n) where n is a numeral other than 0
+ - all terms of the form (/ m n) or (/ (- m) n) where
+ - m is a numeral other than 0,
+ - n is a numeral other than 0 and 1,
+ - as integers, m and n have no common factors besides 1.
+ "
+ :definition
+ "For every expanded signature Sigma, the instance of Reals with that
+ signature is the theory consisting of all Sigma-models that interpret
+
+ - the sort Real as the set of all real numbers,
+
+ - each numeral as the corresponding real number,
+
+ - each decimal as the corresponding real number,
+
+ - / as a total function that coincides with the real division function
+ for all inputs x and y where y is non-zero,
+
+ - the other function symbols of Reals as expected.
+ "
+
+ :notes
+ "Since in SMT-LIB logic all function symbols are interpreted as total
+ functions, terms of the form (/ t 0) *are* meaningful in every
+ instance of Reals. However, the declaration imposes no constraints
+ on their value. This means in particular that
+ - for every instance theory T and
+ - for every closed terms t1 and t2 of sort Real,
+ there is a model of T that satisfies (= t1 (/ t2 0)).
+ "
+
+ :notes
+ "The restriction of Reals over the signature having just the symbols
+ (0 Real)
+ (1 Real)
+ (- Real Real)
+ (+ Real Real Real)
+ (* Real Real Real)
+ (<= Real Real Bool)
+ (< Real Real Bool)
+ coincides with the theory of real closed fields, axiomatized by
+ the formulas below:
+
+ - associativity of +
+ (forall ((x Real) (y Real) (z Real))
+ (= (+ (+ x y) z) (+ x (+ y z))))
+
+ - commutativity of +
+ (forall ((x Real) (y Real))
+ (= (* x y) (* y x)))
+
+ - 0 is the right (and by commutativity, left) unit of +
+ (forall ((x Real)) (= (+ x 0) x))
+
+ - right (and left) inverse wrt +
+ (forall ((x Real)) (= (+ x (- x)) 0))
+
+ - associativity of *
+ (forall ((x Real) (y Real) (z Real))
+ (= (* (* x y) z) (* x (* y z))))
+
+ - commutativity of *
+ (forall ((x Real) (y Real)) (= (* x y) (* y x)))
+
+ - 1 is the right (and by commutativity, left) unit of *
+ (forall ((x Real)) (= (* x 1) x))
+
+ - existence of right (and left) inverse wrt *
+ (forall ((x Real))
+ (or (= x 0) (exists (y Real) (= (* x y) 1))))
+
+ - left distributivity of * over +
+ (forall ((x Real) (y Real) (z Real))
+ (= (* x (+ y z)) (+ (* x y) (* x z))))
+
+ - right distributivity of * over +
+ (forall ((x Real) (y Real) (z Real))
+ (= (* (+ x y) z) (+ (* x z) (* y z))))
+
+ - non-triviality
+ (distinct 0 1)
+
+ - all positive elements have a square root
+ (forall (x Real)
+ (exists (y Real) (or (= x (* y y)) (= (- x) (* y y)))))
+
+ - axiom schemas for all n > 0
+ (forall (x_1 Real) ... (x_n Real)
+ (distinct (+ (* x_1 x_1) (+ ... (* x_n x_n)))
+ (- 1)))
+
+ - axiom schemas for all odd n > 0 where
+ (^ y n) abbreviates the n-fold product of y with itself
+ (forall (x_1 Real) ... (x_n Real)
+ (exists (y Real)
+ (= 0
+ (+ (^ y n) (+ (* x_1 (^ y n-1)) (+ ... (+ (* x_{n-1} y) x_n)))))))
+
+ - reflexivity of <=
+ (forall (x Real) (<= x x))
+
+ - antisymmetry of <=
+ (forall (x Real) (y Real)
+ (implies (and (<= x y) (<= y x))
+ (= x y)))
+
+ - transitivity of <=
+ (forall (x Real) (y Real) (z Real)
+ (implies (and (<= x y) (<= y z))
+ (<= x z)))
+
+ - totality of <=
+ (forall (x Real) (y Real)
+ (or (<= x y) (<= y x)))
+
+ - monotonicity of <= wrt +
+ (forall (x Real) (y Real) (z Real)
+ (implies (<= x y) (<= (+ x z) (+ y z))))
+
+ - monotonicity of <= wrt *
+ (forall (x Real) (y Real) (z Real)
+ (implies (and (<= x y) (<= 0 z))
+ (<= (* z x) (* z y))))
+
+ - definition of <
+ (forall (x Real) (y Real)
+ (iff (< x y)
+ (and (<= x y) (distinct x y)))
+ )
+
+ References:
+ 1) W. Hodges. Model theory. Cambridge University Press, 1993.
+ 2) PlanetMath, http://planetmath.org/encyclopedia/RealClosedFields.html
+ "
+)
diff --git a/SMT/logics/Reals_Ints.smt2 b/SMT/logics/Reals_Ints.smt2
index 4e1a4fc..64e6ec4 100644
--- a/SMT/logics/Reals_Ints.smt2
+++ b/SMT/logics/Reals_Ints.smt2
@@ -1,93 +1,93 @@
-(theory Reals_Ints
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli"
- :date "2010-04-17"
-
- :sorts ((Int 0) (Real 0))
-
- :funs ((NUMERAL Int)
- (- Int Int) ; negation
- (- Int Int Int :left-assoc) ; subtraction
- (+ Int Int Int :left-assoc)
- (* Int Int Int :left-assoc)
- (div Int Int Int :left-assoc)
- (mod Int Int Int)
- (abs Int Int)
- (<= Int Int Bool :chainable)
- (< Int Int Bool :chainable)
- (>= Int Int Bool :chainable)
- (> Int Int Bool :chainable)
- (DECIMAL Real)
- (- Real Real) ; negation
- (- Real Real Real :left-assoc) ; subtraction
- (+ Real Real Real :left-assoc)
- (* Real Real Real :left-assoc)
- (/ Real Real Real :left-assoc)
- (<= Real Real Bool :chainable)
- (< Real Real Bool :chainable)
- (>= Real Real Bool :chainable)
- (> Real Real Bool :chainable)
- (to_real Int Real)
- (to_int Real Int)
- (is_int Real Bool)
- )
-
- :funs_description
- "All ranked function symbols of the form
- ((_ divisible n) Int Bool)
- where n is a positive numeral.
- "
-
- :values
- "The set of values for the sort Int consists of
- - all numerals,
- - all terms of the form (- n) where n is a numeral other than 0.
-
- The set of values for the sort Real consists of
- - all terms of the form (/ (to_real m) (to_real n)) or
- (/ (- (to_real m)) (to_real n)) where
- - m is a numeral,
- - n is a numeral other than 0,
- - as integers, m and n have no common factors besides 1.
- "
-
- :definition
- "For every expanded signature Sigma, the instance of RealsInts with that
- signature is the theory consisting of all Sigma-models that interpret:
-
- - the sort Int as the set of all integer numbers,
-
- - the sort Real as the set of all real numbers,
-
- - each numeral as the corresponding natural number,
-
- - to_real as the standard injection of the integers into the reals,
-
- - the other function symbols with Int arguments as in the theory
- declaration Ints,
-
- - each decimal as the corresponding real number,
-
- - to_int as the function that maps each real number r to its integer part,
- that is, to the largest integer n that satisfies (<= (to_real n) r)
-
- - is_int as the function that maps to true all and only the reals in the
- image of to_real,
-
- - the other function symbols with Real arguments as in the theory
- declaration Reals.
- "
-
- :notes
- "By definition of to_int, (to_int (- 1.3)) is equivalent to (- 2), not
- (- 1).
- "
-
- :notes
- "For each instance T of Reals_Ints, all models of T satisfy the sentence:
-
- (forall ((x Real))
- (= (is_int x) (= x (to_real (to_int x)))))
- "
-)
+(theory Reals_Ints
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli"
+ :date "2010-04-17"
+
+ :sorts ((Int 0) (Real 0))
+
+ :funs ((NUMERAL Int)
+ (- Int Int) ; negation
+ (- Int Int Int :left-assoc) ; subtraction
+ (+ Int Int Int :left-assoc)
+ (* Int Int Int :left-assoc)
+ (div Int Int Int :left-assoc)
+ (mod Int Int Int)
+ (abs Int Int)
+ (<= Int Int Bool :chainable)
+ (< Int Int Bool :chainable)
+ (>= Int Int Bool :chainable)
+ (> Int Int Bool :chainable)
+ (DECIMAL Real)
+ (- Real Real) ; negation
+ (- Real Real Real :left-assoc) ; subtraction
+ (+ Real Real Real :left-assoc)
+ (* Real Real Real :left-assoc)
+ (/ Real Real Real :left-assoc)
+ (<= Real Real Bool :chainable)
+ (< Real Real Bool :chainable)
+ (>= Real Real Bool :chainable)
+ (> Real Real Bool :chainable)
+ (to_real Int Real)
+ (to_int Real Int)
+ (is_int Real Bool)
+ )
+
+ :funs_description
+ "All ranked function symbols of the form
+ ((_ divisible n) Int Bool)
+ where n is a positive numeral.
+ "
+
+ :values
+ "The set of values for the sort Int consists of
+ - all numerals,
+ - all terms of the form (- n) where n is a numeral other than 0.
+
+ The set of values for the sort Real consists of
+ - all terms of the form (/ (to_real m) (to_real n)) or
+ (/ (- (to_real m)) (to_real n)) where
+ - m is a numeral,
+ - n is a numeral other than 0,
+ - as integers, m and n have no common factors besides 1.
+ "
+
+ :definition
+ "For every expanded signature Sigma, the instance of RealsInts with that
+ signature is the theory consisting of all Sigma-models that interpret:
+
+ - the sort Int as the set of all integer numbers,
+
+ - the sort Real as the set of all real numbers,
+
+ - each numeral as the corresponding natural number,
+
+ - to_real as the standard injection of the integers into the reals,
+
+ - the other function symbols with Int arguments as in the theory
+ declaration Ints,
+
+ - each decimal as the corresponding real number,
+
+ - to_int as the function that maps each real number r to its integer part,
+ that is, to the largest integer n that satisfies (<= (to_real n) r)
+
+ - is_int as the function that maps to true all and only the reals in the
+ image of to_real,
+
+ - the other function symbols with Real arguments as in the theory
+ declaration Reals.
+ "
+
+ :notes
+ "By definition of to_int, (to_int (- 1.3)) is equivalent to (- 2), not
+ (- 1).
+ "
+
+ :notes
+ "For each instance T of Reals_Ints, all models of T satisfy the sentence:
+
+ (forall ((x Real))
+ (= (is_int x) (= x (to_real (to_int x)))))
+ "
+)
diff --git a/SMT/logics/UF.smt2 b/SMT/logics/UF.smt2
index e657917..bb9157a 100644
--- a/SMT/logics/UF.smt2
+++ b/SMT/logics/UF.smt2
@@ -1,26 +1,26 @@
-(logic UF
-
- :smt-lib-version 2.0
- :written_by "David Cok, from QF_UF"
- :date "2015-06-27"
-
- :theories (Core)
-
- :language
- "Closed formulas built over an arbitrary expansion of
- the Core signature with free sort and function symbols.
- "
- :values
- "For each sort other than Bool the set of values is abstract.
- For Bool it is defined as in the Core theory declaration.
- "
- :notes
- "Formulas can contain variables as long as they are bound by a let binder.
- "
- :notes
- "All the free symbols used in scripts for this logic must be declared in
- the scripts themselves.
- "
-)
-
-
+(logic UF
+
+ :smt-lib-version 2.0
+ :written_by "David Cok, from QF_UF"
+ :date "2015-06-27"
+
+ :theories (Core)
+
+ :language
+ "Closed formulas built over an arbitrary expansion of
+ the Core signature with free sort and function symbols.
+ "
+ :values
+ "For each sort other than Bool the set of values is abstract.
+ For Bool it is defined as in the Core theory declaration.
+ "
+ :notes
+ "Formulas can contain variables as long as they are bound by a let binder.
+ "
+ :notes
+ "All the free symbols used in scripts for this logic must be declared in
+ the scripts themselves.
+ "
+)
+
+
diff --git a/SMT/logics/UFBV.smt2 b/SMT/logics/UFBV.smt2
index 53a42e8..7ad88cd 100644
--- a/SMT/logics/UFBV.smt2
+++ b/SMT/logics/UFBV.smt2
@@ -1,237 +1,237 @@
-(logic UFBV
-
-:smt-lib-version 2.0
- :written_by "David Cok, from QF_UFBV"
- :date "2015-06-27"
-
-:theories (Fixed_Size_BitVectors)
-
-:language
- "Closed formulas built over an arbitrary expansion of the
- Fixed_Size_BitVectors signature with free sort and function symbols over the sorts
- (_ BitVec m) for 0 < m. Formulas in ite terms must satisfy the same
- restriction as well, with the exception that they need not be closed
- (because they may be in the scope of a let binder).
- "
-
-:notes
- "For quick reference, the following is a brief and informal summary of the
- legal symbols in this logic and their meaning (formal definitions are found
- either in the Fixed_Size_Bitvectors theory, or in the extensions below).
-
- Defined in theory Fixed_Size_Bitvectors:
-
-
- Bitvector constants:
-
- - #bX where X is a binary numeral of length m defines the
- bitvector constant with value X and size m.
- - #xX where X is a hexadecimal numeral of length m defines the
- bitvector constant with value X and size 4*m.
-
- Functions:
-
- (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
- - concatenation of bitvectors of size i and j to get a new bitvector of
- size m, where m = i + j
- ((_ extract i j) (_ BitVec m) (_ BitVec n))
- - extraction of bits i down to j from a bitvector of size m to yield a
- new bitvector of size n, where n = i - j + 1
- (bvnot (_ BitVec m) (_ BitVec m))
- - bitwise negation
- (bvand (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise and
- (bvor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise or
- (bvneg (_ BitVec m) (_ BitVec m))
- - 2's complement unary minus
- (bvadd (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - addition modulo 2^m
- (bvmul (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - multiplication modulo 2^m
- (bvudiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - unsigned division, truncating towards 0 (undefined if divisor is 0)
- (bvurem (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - unsigned remainder from truncating division (undefined if divisor is 0)
- (bvshl (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - shift left (equivalent to multiplication by 2^x where x is the value of
- the second argument)
- (bvlshr (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - logical shift right (equivalent to unsigned division by 2^x where x is
- the value of the second argument)
- (bvult (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned less-than
-
- Defined below:
-
- Functions:
-
- (bvnand (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise nand (negation of and)
- (bvnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise nor (negation of or)
- (bvxor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise exclusive or
- (bvxnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - bitwise equivalence (equivalently, negation of bitwise exclusive or)
- (bvcomp (_ BitVec m) (_ BitVec m) (_ BitVec 1))
- - bit comparator: equals #b1 iff all bits are equal
- (bvsub (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement subtraction modulo 2^m
- (bvsdiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed division
- (bvsrem (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed remainder (sign follows dividend)
- (bvsmod (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - 2's complement signed remainder (sign follows divisor)
- (bvashr (_ BitVec m) (_ BitVec m) (_ BitVec m))
- - Arithmetic shift right, like logical shift right except that the most
- significant bits of the result always copy the most significant
- bit of the first argument.
-
- The following symbols are parameterized by the numeral i, where i >= 1.
-
- ((_ repeat i) (_ BitVec m) (_ BitVec i*m))
- - ((_ repeat i) x) means concatenate i copies of x
-
- The following symbols are parameterized by the numeral i, where i >= 0.
-
- ((_ zero_extend i) (_ BitVec m) (_ BitVec m+i))
- - ((_ zero_extend i) x) means extend x with zeroes to the (unsigned)
- equivalent bitvector of size m+i
- ((_ sign_extend i) (_ BitVec m) (_ BitVec m+i))
- - ((_ sign_extend i) x) means extend x to the (signed) equivalent bitvector
- of size m+i
- ((_ rotate_left i) (_ BitVec m) (_ BitVec m))
- - ((_ rotate_left i) x) means rotate bits of x to the left i times
- ((_ rotate_right i) (_ BitVec m) (_ BitVec m))
- - ((_ rotate_right i) x) means rotate bits of x to the right i times
-
- (bvule (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned less than or equal
- (bvugt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned greater than
- (bvuge (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for unsigned greater than or equal
- (bvslt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed less than
- (bvsle (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed less than or equal
- (bvsgt (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed greater than
- (bvsge (_ BitVec m) (_ BitVec m) Bool)
- - binary predicate for signed greater than or equal
-
- "
-
-:extensions
- "Below, let |exp| denote the integer resulting from the evaluation
- of the arithmetic expression exp.
-
- - Bitvector Constants:
- (_ bvX n) where X and n are numerals, i.e. (_ bv13 32),
- abbreviates the term #bY of sort (_ BitVec n) such that
-
- [[#bY]] = nat2bv[n](X) for X=0, ..., 2^n - 1.
-
- See the specification of the theory's semantics for a definition
- of the functions [[_]] and nat2bv. Note that this convention implicitly
- considers the numeral X as a number written in base 10.
-
- - Bitwise operators
-
- For all terms s,t of sort (_ BitVec m), where 0 < m,
-
- (bvnand s t) abbreviates (bvnot (bvand s t))
- (bvnor s t) abbreviates (bvnot (bvor s t))
- (bvxor s t) abbreviates (bvor (bvand s (bvnot t)) (bvand (bvnot s) t))
- (bvxnor s t) abbreviates (bvor (bvand s t) (bvand (bvnot s) (bvnot t)))
- (bvcomp s t) abbreviates (bvxnor s t) if m = 1, and
- (bvand (bvxnor ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvcomp ((_ extract |m-2| 0) s) ((_ extract |m-2| 0) t))) otherwise
-
- - Arithmetic operators
-
- For all terms s,t of sort (_ BitVec m), where 0 < m,
-
- (bvsub s t) abbreviates (bvadd s (bvneg t))
- (bvsdiv s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvudiv s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvneg (bvudiv (bvneg s) t))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvneg (bvudiv s (bvneg t)))
- (bvudiv (bvneg s) (bvneg t))))))
- (bvsrem s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvurem s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvneg (bvurem (bvneg s) t))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvurem s (bvneg t)))
- (bvneg (bvurem (bvneg s) (bvneg t))))))
- (bvsmod s t) abbreviates
- (let ((?msb_s ((_ extract |m-1| |m-1|) s))
- (?msb_t ((_ extract |m-1| |m-1|) t)))
- (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
- (bvurem s t)
- (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
- (bvadd (bvneg (bvurem (bvneg s) t)) t)
- (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
- (bvadd (bvurem s (bvneg t)) t)
- (bvneg (bvurem (bvneg s) (bvneg t)))))))
- (bvule s t) abbreviates (or (bvult s t) (= s t))
- (bvugt s t) abbreviates (bvult t s)
- (bvuge s t) abbreviates (or (bvult t s) (= s t))
- (bvslt s t) abbreviates:
- (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
- (= ((_ extract |m-1| |m-1|) t) #b0))
- (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvult s t)))
- (bvsle s t) abbreviates:
- (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
- (= ((_ extract |m-1| |m-1|) t) #b0))
- (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
- (bvule s t)))
- (bvsgt s t) abbreviates (bvslt t s)
- (bvsge s t) abbreviates (bvsle t s)
-
- - Other operations
-
- For all numerals i > 0, j > 1 and 0 < m, and all terms s and t of
- sort (_ BitVec m),
-
- (bvashr s t) abbreviates
- (ite (= ((_ extract |m-1| |m-1|) s) #b0)
- (bvlshr s t)
- (bvnot (bvlshr (bvnot s) t)))
-
- ((_ repeat 1) t) stands for t
- ((_ repeat j) t) abbreviates (concat t ((_ repeat |j-1|) t))
-
- ((_ zero_extend 0) t) stands for t
- ((_ zero_extend i) t) abbreviates (concat ((_ repeat i) #b0) t)
-
- ((_ sign_extend 0) t) stands for t
- ((_ sign_extend i) t) abbreviates
- (concat ((_ repeat i) ((_ extract |m-1| |m-1|) t)) t)
-
- ((_ rotate_left 0) t) stands for t
- ((_ rotate_left i) t) abbreviates t if m = 1, and
- ((_ rotate_left |i-1|)
- (concat ((_ extract |m-2| 0) t) ((_ extract |m-1| |m-1|) t))
- otherwise
-
- ((_ rotate_right 0) t) stands for t
- ((_ rotate_right i) t) abbreviates t if m = 1, and
- ((_ rotate_right |i-1|)
- (concat ((_ extract 0 0) t) ((_ extract |m-1| 1) t)))
- otherwise
- "
-)
-
+(logic UFBV
+
+:smt-lib-version 2.0
+ :written_by "David Cok, from QF_UFBV"
+ :date "2015-06-27"
+
+:theories (Fixed_Size_BitVectors)
+
+:language
+ "Closed formulas built over an arbitrary expansion of the
+ Fixed_Size_BitVectors signature with free sort and function symbols over the sorts
+ (_ BitVec m) for 0 < m. Formulas in ite terms must satisfy the same
+ restriction as well, with the exception that they need not be closed
+ (because they may be in the scope of a let binder).
+ "
+
+:notes
+ "For quick reference, the following is a brief and informal summary of the
+ legal symbols in this logic and their meaning (formal definitions are found
+ either in the Fixed_Size_Bitvectors theory, or in the extensions below).
+
+ Defined in theory Fixed_Size_Bitvectors:
+
+
+ Bitvector constants:
+
+ - #bX where X is a binary numeral of length m defines the
+ bitvector constant with value X and size m.
+ - #xX where X is a hexadecimal numeral of length m defines the
+ bitvector constant with value X and size 4*m.
+
+ Functions:
+
+ (concat (_ BitVec i) (_ BitVec j) (_ BitVec m))
+ - concatenation of bitvectors of size i and j to get a new bitvector of
+ size m, where m = i + j
+ ((_ extract i j) (_ BitVec m) (_ BitVec n))
+ - extraction of bits i down to j from a bitvector of size m to yield a
+ new bitvector of size n, where n = i - j + 1
+ (bvnot (_ BitVec m) (_ BitVec m))
+ - bitwise negation
+ (bvand (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise and
+ (bvor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise or
+ (bvneg (_ BitVec m) (_ BitVec m))
+ - 2's complement unary minus
+ (bvadd (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - addition modulo 2^m
+ (bvmul (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - multiplication modulo 2^m
+ (bvudiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - unsigned division, truncating towards 0 (undefined if divisor is 0)
+ (bvurem (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - unsigned remainder from truncating division (undefined if divisor is 0)
+ (bvshl (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - shift left (equivalent to multiplication by 2^x where x is the value of
+ the second argument)
+ (bvlshr (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - logical shift right (equivalent to unsigned division by 2^x where x is
+ the value of the second argument)
+ (bvult (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned less-than
+
+ Defined below:
+
+ Functions:
+
+ (bvnand (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise nand (negation of and)
+ (bvnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise nor (negation of or)
+ (bvxor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise exclusive or
+ (bvxnor (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - bitwise equivalence (equivalently, negation of bitwise exclusive or)
+ (bvcomp (_ BitVec m) (_ BitVec m) (_ BitVec 1))
+ - bit comparator: equals #b1 iff all bits are equal
+ (bvsub (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement subtraction modulo 2^m
+ (bvsdiv (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed division
+ (bvsrem (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed remainder (sign follows dividend)
+ (bvsmod (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - 2's complement signed remainder (sign follows divisor)
+ (bvashr (_ BitVec m) (_ BitVec m) (_ BitVec m))
+ - Arithmetic shift right, like logical shift right except that the most
+ significant bits of the result always copy the most significant
+ bit of the first argument.
+
+ The following symbols are parameterized by the numeral i, where i >= 1.
+
+ ((_ repeat i) (_ BitVec m) (_ BitVec i*m))
+ - ((_ repeat i) x) means concatenate i copies of x
+
+ The following symbols are parameterized by the numeral i, where i >= 0.
+
+ ((_ zero_extend i) (_ BitVec m) (_ BitVec m+i))
+ - ((_ zero_extend i) x) means extend x with zeroes to the (unsigned)
+ equivalent bitvector of size m+i
+ ((_ sign_extend i) (_ BitVec m) (_ BitVec m+i))
+ - ((_ sign_extend i) x) means extend x to the (signed) equivalent bitvector
+ of size m+i
+ ((_ rotate_left i) (_ BitVec m) (_ BitVec m))
+ - ((_ rotate_left i) x) means rotate bits of x to the left i times
+ ((_ rotate_right i) (_ BitVec m) (_ BitVec m))
+ - ((_ rotate_right i) x) means rotate bits of x to the right i times
+
+ (bvule (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned less than or equal
+ (bvugt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned greater than
+ (bvuge (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for unsigned greater than or equal
+ (bvslt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed less than
+ (bvsle (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed less than or equal
+ (bvsgt (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed greater than
+ (bvsge (_ BitVec m) (_ BitVec m) Bool)
+ - binary predicate for signed greater than or equal
+
+ "
+
+:extensions
+ "Below, let |exp| denote the integer resulting from the evaluation
+ of the arithmetic expression exp.
+
+ - Bitvector Constants:
+ (_ bvX n) where X and n are numerals, i.e. (_ bv13 32),
+ abbreviates the term #bY of sort (_ BitVec n) such that
+
+ [[#bY]] = nat2bv[n](X) for X=0, ..., 2^n - 1.
+
+ See the specification of the theory's semantics for a definition
+ of the functions [[_]] and nat2bv. Note that this convention implicitly
+ considers the numeral X as a number written in base 10.
+
+ - Bitwise operators
+
+ For all terms s,t of sort (_ BitVec m), where 0 < m,
+
+ (bvnand s t) abbreviates (bvnot (bvand s t))
+ (bvnor s t) abbreviates (bvnot (bvor s t))
+ (bvxor s t) abbreviates (bvor (bvand s (bvnot t)) (bvand (bvnot s) t))
+ (bvxnor s t) abbreviates (bvor (bvand s t) (bvand (bvnot s) (bvnot t)))
+ (bvcomp s t) abbreviates (bvxnor s t) if m = 1, and
+ (bvand (bvxnor ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvcomp ((_ extract |m-2| 0) s) ((_ extract |m-2| 0) t))) otherwise
+
+ - Arithmetic operators
+
+ For all terms s,t of sort (_ BitVec m), where 0 < m,
+
+ (bvsub s t) abbreviates (bvadd s (bvneg t))
+ (bvsdiv s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvudiv s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvneg (bvudiv (bvneg s) t))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvneg (bvudiv s (bvneg t)))
+ (bvudiv (bvneg s) (bvneg t))))))
+ (bvsrem s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvurem s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvneg (bvurem (bvneg s) t))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvurem s (bvneg t)))
+ (bvneg (bvurem (bvneg s) (bvneg t))))))
+ (bvsmod s t) abbreviates
+ (let ((?msb_s ((_ extract |m-1| |m-1|) s))
+ (?msb_t ((_ extract |m-1| |m-1|) t)))
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b0))
+ (bvurem s t)
+ (ite (and (= ?msb_s #b1) (= ?msb_t #b0))
+ (bvadd (bvneg (bvurem (bvneg s) t)) t)
+ (ite (and (= ?msb_s #b0) (= ?msb_t #b1))
+ (bvadd (bvurem s (bvneg t)) t)
+ (bvneg (bvurem (bvneg s) (bvneg t)))))))
+ (bvule s t) abbreviates (or (bvult s t) (= s t))
+ (bvugt s t) abbreviates (bvult t s)
+ (bvuge s t) abbreviates (or (bvult t s) (= s t))
+ (bvslt s t) abbreviates:
+ (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
+ (= ((_ extract |m-1| |m-1|) t) #b0))
+ (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvult s t)))
+ (bvsle s t) abbreviates:
+ (or (and (= ((_ extract |m-1| |m-1|) s) #b1)
+ (= ((_ extract |m-1| |m-1|) t) #b0))
+ (and (= ((_ extract |m-1| |m-1|) s) ((_ extract |m-1| |m-1|) t))
+ (bvule s t)))
+ (bvsgt s t) abbreviates (bvslt t s)
+ (bvsge s t) abbreviates (bvsle t s)
+
+ - Other operations
+
+ For all numerals i > 0, j > 1 and 0 < m, and all terms s and t of
+ sort (_ BitVec m),
+
+ (bvashr s t) abbreviates
+ (ite (= ((_ extract |m-1| |m-1|) s) #b0)
+ (bvlshr s t)
+ (bvnot (bvlshr (bvnot s) t)))
+
+ ((_ repeat 1) t) stands for t
+ ((_ repeat j) t) abbreviates (concat t ((_ repeat |j-1|) t))
+
+ ((_ zero_extend 0) t) stands for t
+ ((_ zero_extend i) t) abbreviates (concat ((_ repeat i) #b0) t)
+
+ ((_ sign_extend 0) t) stands for t
+ ((_ sign_extend i) t) abbreviates
+ (concat ((_ repeat i) ((_ extract |m-1| |m-1|) t)) t)
+
+ ((_ rotate_left 0) t) stands for t
+ ((_ rotate_left i) t) abbreviates t if m = 1, and
+ ((_ rotate_left |i-1|)
+ (concat ((_ extract |m-2| 0) t) ((_ extract |m-1| |m-1|) t))
+ otherwise
+
+ ((_ rotate_right 0) t) stands for t
+ ((_ rotate_right i) t) abbreviates t if m = 1, and
+ ((_ rotate_right |i-1|)
+ (concat ((_ extract 0 0) t) ((_ extract |m-1| 1) t)))
+ otherwise
+ "
+)
+
diff --git a/SMT/logics/UFIDL.smt2 b/SMT/logics/UFIDL.smt2
index 8aba68e..36e069e 100644
--- a/SMT/logics/UFIDL.smt2
+++ b/SMT/logics/UFIDL.smt2
@@ -1,31 +1,31 @@
-(logic UFIDL
-
- :smt-lib-version 2.0
- :written_by "David Cok, from QF_UFIDL"
- :date "2015-06-27"
-
- :theories (Ints)
-
-
- :language
- "Closed formulas built over an arbitrary expansion with
- free sort and function symbols of the signature consisting of
- - all the sort and function symbols of Core and
- - the following symbols of Int:
-
- :sorts ((Int 0))
- :funs ((NUMERAL Int)
- (- Int Int Int)
- (+ Int Int Int)
- (<= Int Int Bool)
- (< Int Int Bool)
- (>= Int Int Bool)
- (> Int Int Bool)
- )
-
- Additionally, for every term of the form (op t1 t2) with op in {+, -},
- at least one of t1 and t2 is a numeral.
- "
-)
-
-
+(logic UFIDL
+
+ :smt-lib-version 2.0
+ :written_by "David Cok, from QF_UFIDL"
+ :date "2015-06-27"
+
+ :theories (Ints)
+
+
+ :language
+ "Closed formulas built over an arbitrary expansion with
+ free sort and function symbols of the signature consisting of
+ - all the sort and function symbols of Core and
+ - the following symbols of Int:
+
+ :sorts ((Int 0))
+ :funs ((NUMERAL Int)
+ (- Int Int Int)
+ (+ Int Int Int)
+ (<= Int Int Bool)
+ (< Int Int Bool)
+ (>= Int Int Bool)
+ (> Int Int Bool)
+ )
+
+ Additionally, for every term of the form (op t1 t2) with op in {+, -},
+ at least one of t1 and t2 is a numeral.
+ "
+)
+
+
diff --git a/SMT/logics/UFLIA.smt2 b/SMT/logics/UFLIA.smt2
index 5ead1fc..0dbc1ad 100644
--- a/SMT/logics/UFLIA.smt2
+++ b/SMT/logics/UFLIA.smt2
@@ -1,23 +1,23 @@
-(logic UFLIA
-
- :smt-lib-version 2.0
- :written_by "David Cok, from QF_UFLIA"
- :date "2015-06-27"
-
- :theories (Ints)
-
- :language
- "Closed formulas built over an arbitrary expansion of the
- Ints signature with free sort and function symbols, but whose terms of sort Int
- are all linear, that is, have no occurrences of the function symbols
- *, /, div, mod, and abs, except as specified the :extensions attribute.
- "
-
- :extensions
- "Terms with _concrete_ coefficients are also allowed, that is, terms
- of the form c, (* c x), or (* x c) where x is a free constant and
- c is a term of the form n or (- n) for some numeral n.
- "
-)
-
-
+(logic UFLIA
+
+ :smt-lib-version 2.0
+ :written_by "David Cok, from QF_UFLIA"
+ :date "2015-06-27"
+
+ :theories (Ints)
+
+ :language
+ "Closed formulas built over an arbitrary expansion of the
+ Ints signature with free sort and function symbols, but whose terms of sort Int
+ are all linear, that is, have no occurrences of the function symbols
+ *, /, div, mod, and abs, except as specified the :extensions attribute.
+ "
+
+ :extensions
+ "Terms with _concrete_ coefficients are also allowed, that is, terms
+ of the form c, (* c x), or (* x c) where x is a free constant and
+ c is a term of the form n or (- n) for some numeral n.
+ "
+)
+
+
diff --git a/SMT/logics/UFLRA.smt2 b/SMT/logics/UFLRA.smt2
index 483dcb1..d86ddd4 100644
--- a/SMT/logics/UFLRA.smt2
+++ b/SMT/logics/UFLRA.smt2
@@ -1,29 +1,29 @@
-(logic UFLRA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli, David Cok"
- :date "2011-05-25"
-
- :theories (Reals)
-
- :language
- "Closed formulas built over arbitrary expansions of the Reals signature
- with free sort and function symbols, but containing only linear atoms, that is,
- atoms with no occurrences of the function symbols * and /, except as
- specified the :extensions attribute.
- "
-
- :extensions
- "Terms with _concrete_ coefficients are also allowed, that is, terms
- of the form (* c x), or (* x c) where x is a free constant and
- c is an integer or rational coefficient.
- - An integer coefficient is a term of the form m or (- m) for some
- numeral m.
- - A rational coefficient is a term of the form d, (- d) or (/ c n)
- for some decimal d, integer coefficient c and numeral n other than 0.
- "
-
-:notes
- "This logic properly extends the logic LRA by allowing uninterpreted functions."
-)
-
+(logic UFLRA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli, David Cok"
+ :date "2011-05-25"
+
+ :theories (Reals)
+
+ :language
+ "Closed formulas built over arbitrary expansions of the Reals signature
+ with free sort and function symbols, but containing only linear atoms, that is,
+ atoms with no occurrences of the function symbols * and /, except as
+ specified the :extensions attribute.
+ "
+
+ :extensions
+ "Terms with _concrete_ coefficients are also allowed, that is, terms
+ of the form (* c x), or (* x c) where x is a free constant and
+ c is an integer or rational coefficient.
+ - An integer coefficient is a term of the form m or (- m) for some
+ numeral m.
+ - A rational coefficient is a term of the form d, (- d) or (/ c n)
+ for some decimal d, integer coefficient c and numeral n other than 0.
+ "
+
+:notes
+ "This logic properly extends the logic LRA by allowing uninterpreted functions."
+)
+
diff --git a/SMT/logics/UFNIA.smt2 b/SMT/logics/UFNIA.smt2
index 2671e8b..d62ae45 100644
--- a/SMT/logics/UFNIA.smt2
+++ b/SMT/logics/UFNIA.smt2
@@ -1,13 +1,13 @@
-(logic UFNIA
-
- :smt-lib-version 2.0
- :written_by "Cesare Tinelli, David Cok"
- :date "2011-05-25"
-
- :theories (Ints)
-
- :language
- "Closed formulas built over an arbitrary expansion of the
- Ints signature with free sort and function symbols.
- "
-)
+(logic UFNIA
+
+ :smt-lib-version 2.0
+ :written_by "Cesare Tinelli, David Cok"
+ :date "2011-05-25"
+
+ :theories (Ints)
+
+ :language
+ "Closed formulas built over an arbitrary expansion of the
+ Ints signature with free sort and function symbols.
+ "
+)
diff --git a/SMT/logics/UFNRA.smt2 b/SMT/logics/UFNRA.smt2
index 63ae57f..5d4ebfc 100644
--- a/SMT/logics/UFNRA.smt2
+++ b/SMT/logics/UFNRA.smt2
@@ -1,16 +1,16 @@
-(logic UFNRA
-
- :smt-lib-version 2.0
- :written_by "David Cok, from QF_UFNRA"
- :date "2015-06-27"
-
- :theories (Reals)
-
- :language
- "Closed formulas built over arbitrary expansions of
- the Reals signature with free sort and function symbols.
- "
-
-)
-
-
+(logic UFNRA
+
+ :smt-lib-version 2.0
+ :written_by "David Cok, from QF_UFNRA"
+ :date "2015-06-27"
+
+ :theories (Reals)
+
+ :language
+ "Closed formulas built over arbitrary expansions of
+ the Reals signature with free sort and function symbols.
+ "
+
+)
+
+
diff --git a/SMT/solvers/windows/z3-4.8.5/LICENSE.txt b/SMT/solvers/windows/z3-4.8.5/LICENSE.txt
index 1f06113..cc90bed 100644
--- a/SMT/solvers/windows/z3-4.8.5/LICENSE.txt
+++ b/SMT/solvers/windows/z3-4.8.5/LICENSE.txt
@@ -1,10 +1,10 @@
-Z3
-Copyright (c) Microsoft Corporation
-All rights reserved.
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
+Z3
+Copyright (c) Microsoft Corporation
+All rights reserved.
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/SMT/src/APIExample.java b/SMT/src/APIExample.java
index 6161016..1d684cf 100644
--- a/SMT/src/APIExample.java
+++ b/SMT/src/APIExample.java
@@ -1,123 +1,123 @@
-import java.util.LinkedList;
-import java.util.List;
-
-import org.smtlib.*;
-import org.smtlib.command.C_declare_fun;
-import org.smtlib.impl.Script;
-
-public class APIExample {
-
- public static void main(String... args) {
- SMT smt = new SMT();
-
-
- try {
- // Parsing from a string
- IExpr.IFactory efactory = smt.smtConfig.exprFactory;
- ISource source = smt.smtConfig.smtFactory.createSource(new CharSequenceReader(new java.io.StringReader("(set-option :produce-models true)(set-logic QF_UF)(declare-fun p () Bool)")),null);
- IParser parser = smt.smtConfig.smtFactory.createParser(smt.smtConfig,source);
- ICommand command0 = parser.parseCommand();
- System.out.println(smt.smtConfig.defaultPrinter.toString(command0));
- ICommand command1 = parser.parseCommand();
- ICommand command2 = parser.parseCommand();
- if (!parser.isEOD()) {
- System.out.println("Expected parser to be at EOD");
- }
-
- // Parsing with an error
- source = smt.smtConfig.smtFactory.createSource(new CharSequenceReader(new java.io.StringReader("(assert )")),null);
- parser = smt.smtConfig.smtFactory.createParser(smt.smtConfig,source);
- ICommand c = parser.parseCommand();
- System.out.println(c == null ? "BAD COMMAND" : "NON_NULL COMMAND");
-
- // Constructing ASTs directly
- IExpr.ISymbol p = efactory.symbol("p");
- IExpr notp = efactory.fcn(efactory.symbol("not"),p);
- IExpr and = efactory.fcn(efactory.symbol("and"),p,notp);
- ICommand command3 = new org.smtlib.command.C_assert(and);
- ICommand command4 = new org.smtlib.command.C_exit();
-
- // Printing an AST
- IPrinter printer = smt.smtConfig.defaultPrinter;
- System.out.println(printer.toString(and));
- System.out.println(printer.toString(command1));
- System.out.println(printer.toString(command3));
-
- // Assemble a script
- ICommand.IScript script = new org.smtlib.impl.Script();
- script.commands().add(command1);
- script.commands().add(command2);
- script.commands().add(command3);
- script.commands().add(command4);
-
- // Execute the script
- ISolver solver = new org.smtlib.solvers.Solver_z3_4_3(smt.smtConfig,"C:/cygwin/home/dcok/mybin/z3-4.3.exe");
- solver.start();
- IResponse response = script.execute(solver);
- System.out.println(printer.toString(response));
-
- // Type-checking a script
- IExpr.ISymbol q = efactory.symbol("q");
- script = new org.smtlib.impl.Script();
- script.commands().add(command1);
- script.commands().add(command2);
- script.commands().add(new org.smtlib.command.C_assert(q));
- script.commands().add(command4);
- solver = new org.smtlib.solvers.Solver_z3_4_3(smt.smtConfig,"C:/cygwin/home/dcok/mybin/z3-4.3.exe");
- solver.start();
- response = script.execute(solver);
- System.out.println(printer.toString(response));
-
- // Execute commands directly
- // THIS API WILL BE CHANGING
- ISort.IFactory sortfactory = smt.smtConfig.sortFactory;
- ISort boolsort = sortfactory.createSortExpression(efactory.symbol("Bool"));
- solver = new org.smtlib.solvers.Solver_z3_4_3(smt.smtConfig,"C:/cygwin/home/dcok/mybin/z3-4.3.exe");
- solver.start();
- IResponse r = solver.set_logic("QF_UF",null);
- r = solver.declare_fun(new C_declare_fun(p,new java.util.LinkedList(),boolsort));
- r = solver.assertExpr(and);
- r = solver.check_sat();
- System.out.println(printer.toString(r));
- // solver.start()? solver.exit()????, restarting solver?
- // comment on toString directly on ASTs?t
-
- // typechecking?
-
- // Bit-vector and model example
- List nums = new LinkedList();
- nums.add(efactory.numeral(32)); // TODO - room for improvement in ease of use here...
- ISort bv32 = sortfactory.createSortExpression(efactory.id(efactory.symbol("BitVec"),nums));
- solver = new org.smtlib.solvers.Solver_z3_4_3(smt.smtConfig,"C:/cygwin/home/dcok/mybin/z3-4.3.exe");
- solver.start();
- solver.set_option(efactory.keyword(":produce-models"),efactory.symbol("true"));
- r = solver.set_logic("QF_BV",null);
- r = solver.declare_fun(new C_declare_fun(efactory.symbol("pb"),new java.util.LinkedList(),bv32));
- r = solver.declare_fun(new C_declare_fun(efactory.symbol("pc"),new java.util.LinkedList(),bv32));
-
- solver.push(1);
- r = solver.assertExpr(
- efactory.fcn(efactory.symbol("="),efactory.symbol("pc"),efactory.fcn(efactory.symbol("bvnot"),efactory.symbol("pb"))));
- r = solver.check_sat();
- System.out.println(printer.toString(r));
- r = solver.get_value(efactory.symbol("pb"),efactory.symbol("pc"));
- System.out.println(printer.toString(r));
-
- r = solver.assertExpr(
- efactory.fcn(efactory.symbol("="),efactory.symbol("pb"),efactory.binary("01001010010100101001010010100111")));
- r = solver.check_sat();
- System.out.println(printer.toString(r));
- r = solver.get_value(efactory.symbol("pb"),efactory.symbol("pc"));
- System.out.println(printer.toString(r));
- solver.pop(1);
- solver.exit();
-
- System.out.println("END");
-
- } catch (java.io.IOException e) {
- // Can happen if the ISource is reading from a file
- } catch (IParser.ParserException e) {
- System.out.println(e.getMessage());
- }
- }
-}
+import java.util.LinkedList;
+import java.util.List;
+
+import org.smtlib.*;
+import org.smtlib.command.C_declare_fun;
+import org.smtlib.impl.Script;
+
+public class APIExample {
+
+ public static void main(String... args) {
+ SMT smt = new SMT();
+
+
+ try {
+ // Parsing from a string
+ IExpr.IFactory efactory = smt.smtConfig.exprFactory;
+ ISource source = smt.smtConfig.smtFactory.createSource(new CharSequenceReader(new java.io.StringReader("(set-option :produce-models true)(set-logic QF_UF)(declare-fun p () Bool)")),null);
+ IParser parser = smt.smtConfig.smtFactory.createParser(smt.smtConfig,source);
+ ICommand command0 = parser.parseCommand();
+ System.out.println(smt.smtConfig.defaultPrinter.toString(command0));
+ ICommand command1 = parser.parseCommand();
+ ICommand command2 = parser.parseCommand();
+ if (!parser.isEOD()) {
+ System.out.println("Expected parser to be at EOD");
+ }
+
+ // Parsing with an error
+ source = smt.smtConfig.smtFactory.createSource(new CharSequenceReader(new java.io.StringReader("(assert )")),null);
+ parser = smt.smtConfig.smtFactory.createParser(smt.smtConfig,source);
+ ICommand c = parser.parseCommand();
+ System.out.println(c == null ? "BAD COMMAND" : "NON_NULL COMMAND");
+
+ // Constructing ASTs directly
+ IExpr.ISymbol p = efactory.symbol("p");
+ IExpr notp = efactory.fcn(efactory.symbol("not"),p);
+ IExpr and = efactory.fcn(efactory.symbol("and"),p,notp);
+ ICommand command3 = new org.smtlib.command.C_assert(and);
+ ICommand command4 = new org.smtlib.command.C_exit();
+
+ // Printing an AST
+ IPrinter printer = smt.smtConfig.defaultPrinter;
+ System.out.println(printer.toString(and));
+ System.out.println(printer.toString(command1));
+ System.out.println(printer.toString(command3));
+
+ // Assemble a script
+ ICommand.IScript script = new org.smtlib.impl.Script();
+ script.commands().add(command1);
+ script.commands().add(command2);
+ script.commands().add(command3);
+ script.commands().add(command4);
+
+ // Execute the script
+ ISolver solver = new org.smtlib.solvers.Solver_z3_4_3(smt.smtConfig,"C:/cygwin/home/dcok/mybin/z3-4.3.exe");
+ solver.start();
+ IResponse response = script.execute(solver);
+ System.out.println(printer.toString(response));
+
+ // Type-checking a script
+ IExpr.ISymbol q = efactory.symbol("q");
+ script = new org.smtlib.impl.Script();
+ script.commands().add(command1);
+ script.commands().add(command2);
+ script.commands().add(new org.smtlib.command.C_assert(q));
+ script.commands().add(command4);
+ solver = new org.smtlib.solvers.Solver_z3_4_3(smt.smtConfig,"C:/cygwin/home/dcok/mybin/z3-4.3.exe");
+ solver.start();
+ response = script.execute(solver);
+ System.out.println(printer.toString(response));
+
+ // Execute commands directly
+ // THIS API WILL BE CHANGING
+ ISort.IFactory sortfactory = smt.smtConfig.sortFactory;
+ ISort boolsort = sortfactory.createSortExpression(efactory.symbol("Bool"));
+ solver = new org.smtlib.solvers.Solver_z3_4_3(smt.smtConfig,"C:/cygwin/home/dcok/mybin/z3-4.3.exe");
+ solver.start();
+ IResponse r = solver.set_logic("QF_UF",null);
+ r = solver.declare_fun(new C_declare_fun(p,new java.util.LinkedList(),boolsort));
+ r = solver.assertExpr(and);
+ r = solver.check_sat();
+ System.out.println(printer.toString(r));
+ // solver.start()? solver.exit()????, restarting solver?
+ // comment on toString directly on ASTs?t
+
+ // typechecking?
+
+ // Bit-vector and model example
+ List nums = new LinkedList();
+ nums.add(efactory.numeral(32)); // TODO - room for improvement in ease of use here...
+ ISort bv32 = sortfactory.createSortExpression(efactory.id(efactory.symbol("BitVec"),nums));
+ solver = new org.smtlib.solvers.Solver_z3_4_3(smt.smtConfig,"C:/cygwin/home/dcok/mybin/z3-4.3.exe");
+ solver.start();
+ solver.set_option(efactory.keyword(":produce-models"),efactory.symbol("true"));
+ r = solver.set_logic("QF_BV",null);
+ r = solver.declare_fun(new C_declare_fun(efactory.symbol("pb"),new java.util.LinkedList(),bv32));
+ r = solver.declare_fun(new C_declare_fun(efactory.symbol("pc"),new java.util.LinkedList(),bv32));
+
+ solver.push(1);
+ r = solver.assertExpr(
+ efactory.fcn(efactory.symbol("="),efactory.symbol("pc"),efactory.fcn(efactory.symbol("bvnot"),efactory.symbol("pb"))));
+ r = solver.check_sat();
+ System.out.println(printer.toString(r));
+ r = solver.get_value(efactory.symbol("pb"),efactory.symbol("pc"));
+ System.out.println(printer.toString(r));
+
+ r = solver.assertExpr(
+ efactory.fcn(efactory.symbol("="),efactory.symbol("pb"),efactory.binary("01001010010100101001010010100111")));
+ r = solver.check_sat();
+ System.out.println(printer.toString(r));
+ r = solver.get_value(efactory.symbol("pb"),efactory.symbol("pc"));
+ System.out.println(printer.toString(r));
+ solver.pop(1);
+ solver.exit();
+
+ System.out.println("END");
+
+ } catch (java.io.IOException e) {
+ // Can happen if the ISource is reading from a file
+ } catch (IParser.ParserException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+}
diff --git a/SMT/src/org/smtlib/ICommand.java b/SMT/src/org/smtlib/ICommand.java
index 7b08c9e..f8754c3 100644
--- a/SMT/src/org/smtlib/ICommand.java
+++ b/SMT/src/org/smtlib/ICommand.java
@@ -1,12 +1,9 @@
/*
- * This file is part of the SMT project.
- * Copyright 2010 David R. Cok
- * Created August 2010
+ * This file is part of the SMT project. Copyright 2010 David R. Cok Created August 2010
*/
package org.smtlib;
import java.util.List;
-
import org.smtlib.IExpr.IDeclaration;
import org.smtlib.IExpr.IIdentifier;
import org.smtlib.IExpr.IKeyword;
@@ -16,219 +13,245 @@
import org.smtlib.ISort.IParameter;
-/** This interface is the generic interface to command classes, providing functionality
- * to type-check the command and to execute it.
+/**
+ * This interface is the generic interface to command classes, providing functionality to type-check
+ * the command and to execute it.
+ *
* @author David R. Cok
*/
public interface ICommand extends IAccept {
-
- /** This interface defines classes that implement techniques for mapping a command name to a class
- * that implements that command.
- */
- public static interface IFinder {
- /** This method finds a class that implements the ICommand interface for the given class name */
- Class extends ICommand> findCommand(String name);
- }
-
- /** Executes the command on the given solver; presumes that the command type-checked
- * successfully.
- * @param solver the instance of the solver to use (note that solvers have state)
- * @return the result of the command
- */
- IResponse execute(ISolver solver);
-
- /** This is the interface to be used by a concrete ICommand factory. */
- static public interface IFactory {
- /** Creates a script object containing the given filename or the given set of commands */
- IScript script(/*@Nullable*/IStringLiteral filename, /*@Nullable*/List commands);
-
- /** Creates an assert command object, asserting the given expression */
- Iassert assertCommand(IExpr expr);
-
- /** Creates a check-sat command object */
- Icheck_sat check_sat();
-
- /** Creates a declare-fun command object */
- Ideclare_fun declare_fun(IIdentifier id, List argSorts, ISort resultSort);
-
- /** Creates a declare-sort command object. */
- Ideclare_sort declare_sort(ISymbol sym, INumeral arity);
-
- /** Creates a define-fun command object */
- Idefine_fun define_fun(IIdentifier id, List declarations, ISort resultSort, IExpr expression);
-
- /** Creates a define-sort command object. */
- Idefine_sort define_sort(IIdentifier id, List parameters, ISort.IApplication expression);
-
- /** Creates an exit command object. */
- Iexit exit();
-
- /** Creates a get-assertions command object. */
- Iget_assertions get_assertions();
-
- /** Creates a get-assignment command object. */
- Iget_assignment get_assignment();
-
- /** Creates a get-info command object. */
- Iget_info get_info(IKeyword infoflag);
-
- /** Creates a get-option command object */
- Iget_option get_option(IKeyword option);
-
- /** Creates a get-proof command object. */
- Iget_proof get_proof();
-
- /** Creates a get-unsat-core command object. */
- Iget_unsat_core get_unsat_core();
-
- /** Creates a get-value command object. */
- Iget_value get_value(List exprs);
-
- /** Creates a push command object. */
- Ipush push(INumeral number);
-
- /** Creates a pop command object. */
- Ipop pop(INumeral number);
-
- /** Creates a set-logic command object */
- Iset_logic set_logic(ISymbol logic);
-
- /** Creates a set-info command object. */
- Iset_info set_info(IKeyword infoflag, IAttributeValue value);
-
- /** Creates a set-option command object. */
- Iset_option set_option(IKeyword option, IAttributeValue value);
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB scripts. A script may consist of a file or an explicit list of commands. */
-
- static public interface IScript extends IAccept {
- /*@Nullable*/ IStringLiteral filename();
- /*@Nullable*/ List commands();
- IResponse execute(ISolver solver);
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB assert commands. */
- static public interface Iassert extends ICommand {
- IExpr expr();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB check-sat commands. */
- static public interface Icheck_sat extends ICommand {
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB check-sat-assuming commands. */
- static public interface Icheck_sat_assuming extends ICommand {
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB declare-const commands. */
- static public interface Ideclare_const extends ICommand {
- ISymbol symbol();
- ISort resultSort();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB declare-fun commands. */
- static public interface Ideclare_fun extends ICommand {
- ISymbol symbol();
- List argSorts();
- ISort resultSort();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB declare-sort commands. */
- static public interface Ideclare_sort extends ICommand {
- ISymbol sortSymbol();
- INumeral arity();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB define-fun commands. */
- static public interface Idefine_fun extends ICommand {
- ISymbol symbol();
- List parameters();
- ISort resultSort();
- IExpr expression();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB define-sort commands. */
- static public interface Idefine_sort extends ICommand {
- ISymbol sortSymbol();
- List parameters();
- ISort expression();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB exit commands. */
- static public interface Iexit extends ICommand {
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB get-assertions commands. */
- static public interface Iget_assertions extends ICommand {
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB get-assignment commands. */
- static public interface Iget_assignment extends ICommand {
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB get-info commands. */
- static public interface Iget_info extends ICommand {
- IKeyword infoflag();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB get-option commands. */
- static public interface Iget_option extends ICommand {
- IKeyword option();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB get-proof commands. */
- static public interface Iget_proof extends ICommand {
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB get-unsat-assumptions commands. */
- static public interface Iget_unsat_assumptions extends ICommand {
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB get-unsat-core commands. */
- static public interface Iget_unsat_core extends ICommand {
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB get-value commands. */
- static public interface Iget_value extends ICommand {
- //@ ensures exprs().size > 0;
- List exprs();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB pop commands. */
- static public interface Ipop extends ICommand {
- //@ ensures \result.intValue() >= 0;
- INumeral number();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB push commands. */
- static public interface Ipush extends ICommand {
- //@ ensures \result.intValue() >= 0;
- INumeral number();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB reset commands. */
- static public interface Ireset extends ICommand {
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB reset-assertions commands. */
- static public interface Ireset_assertions extends ICommand {
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB set-logic commands. */
- static public interface Iset_logic extends ICommand {
- ISymbol logic();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB set-info commands. */
- static public interface Iset_info extends ICommand {
- IKeyword infoflag();
- IAttributeValue value();
- }
-
- /** Interface to be implemented by all objects representing SMT-LIB set-option commands. */
- static public interface Iset_option extends ICommand {
- IKeyword option();
- /*@Nullable*/IAttributeValue value();
- }
+
+ /**
+ * This interface defines classes that implement techniques for mapping a command name to a class
+ * that implements that command.
+ */
+ public static interface IFinder {
+ /** This method finds a class that implements the ICommand interface for the given class name */
+ Class extends ICommand> findCommand(String name);
+ }
+
+ /**
+ * Executes the command on the given solver; presumes that the command type-checked successfully.
+ *
+ * @param solver the instance of the solver to use (note that solvers have state)
+ * @return the result of the command
+ */
+ IResponse execute(ISolver solver);
+
+ /** This is the interface to be used by a concrete ICommand factory. */
+ static public interface IFactory {
+ /** Creates a script object containing the given filename or the given set of commands */
+ IScript script(/* @Nullable */IStringLiteral filename, /* @Nullable */List commands);
+
+ /** Creates an assert command object, asserting the given expression */
+ Iassert assertCommand(IExpr expr);
+
+ /** Creates a check-sat command object */
+ Icheck_sat check_sat();
+
+ /** Creates a declare-fun command object */
+ Ideclare_fun declare_fun(IIdentifier id, List argSorts, ISort resultSort);
+
+ /** Creates a declare-sort command object. */
+ Ideclare_sort declare_sort(ISymbol sym, INumeral arity);
+
+ /** Creates a define-fun command object */
+ Idefine_fun define_fun(IIdentifier id, List declarations, ISort resultSort,
+ IExpr expression);
+
+ /** Creates a define-sort command object. */
+ Idefine_sort define_sort(IIdentifier id, List parameters,
+ ISort.IApplication expression);
+
+ /** Creates an exit command object. */
+ Iexit exit();
+
+ /** Creates a get-assertions command object. */
+ Iget_assertions get_assertions();
+
+ /** Creates a get-assignment command object. */
+ Iget_assignment get_assignment();
+
+ /** Creates a get-info command object. */
+ Iget_info get_info(IKeyword infoflag);
+
+ /** Creates a get-option command object */
+ Iget_option get_option(IKeyword option);
+
+ /** Creates a get-proof command object. */
+ Iget_proof get_proof();
+
+ /** Creates a get-unsat-core command object. */
+ Iget_unsat_core get_unsat_core();
+
+ /** Creates a get-value command object. */
+ Iget_value get_value(List exprs);
+
+ /** Creates a push command object. */
+ Ipush push(INumeral number);
+
+ /** Creates a pop command object. */
+ Ipop pop(INumeral number);
+
+ /** Creates a set-logic command object */
+ Iset_logic set_logic(ISymbol logic);
+
+ /** Creates a set-info command object. */
+ Iset_info set_info(IKeyword infoflag, IAttributeValue value);
+
+ /** Creates a set-option command object. */
+ Iset_option set_option(IKeyword option, IAttributeValue value);
+ }
+
+ /**
+ * Interface to be implemented by all objects representing SMT-LIB scripts. A script may consist
+ * of a file or an explicit list of commands.
+ */
+
+ static public interface IScript extends IAccept {
+ /* @Nullable */ IStringLiteral filename();
+
+ /* @Nullable */ List commands();
+
+ IResponse execute(ISolver solver);
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB assert commands. */
+ static public interface Iassert extends ICommand {
+ IExpr expr();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB check-sat commands. */
+ static public interface Icheck_sat extends ICommand {
+ }
+
+ /**
+ * Interface to be implemented by all objects representing SMT-LIB check-sat-assuming commands.
+ */
+ static public interface Icheck_sat_assuming extends ICommand {
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB declare-const commands. */
+ static public interface Ideclare_const extends ICommand {
+ ISymbol symbol();
+
+ ISort resultSort();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB declare-fun commands. */
+ static public interface Ideclare_fun extends ICommand {
+ ISymbol symbol();
+
+ List argSorts();
+
+ ISort resultSort();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB declare-sort commands. */
+ static public interface Ideclare_sort extends ICommand {
+ ISymbol sortSymbol();
+
+ INumeral arity();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB define-fun commands. */
+ static public interface Idefine_fun extends ICommand {
+ ISymbol symbol();
+
+ List parameters();
+
+ ISort resultSort();
+
+ IExpr expression();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB define-sort commands. */
+ static public interface Idefine_sort extends ICommand {
+ ISymbol sortSymbol();
+
+ List parameters();
+
+ ISort expression();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB exit commands. */
+ static public interface Iexit extends ICommand {
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB get-assertions commands. */
+ static public interface Iget_assertions extends ICommand {
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB get-assignment commands. */
+ static public interface Iget_assignment extends ICommand {
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB get-info commands. */
+ static public interface Iget_info extends ICommand {
+ IKeyword infoflag();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB get-option commands. */
+ static public interface Iget_option extends ICommand {
+ IKeyword option();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB get-proof commands. */
+ static public interface Iget_proof extends ICommand {
+ }
+
+ /**
+ * Interface to be implemented by all objects representing SMT-LIB get-unsat-assumptions commands.
+ */
+ static public interface Iget_unsat_assumptions extends ICommand {
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB get-unsat-core commands. */
+ static public interface Iget_unsat_core extends ICommand {
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB get-value commands. */
+ static public interface Iget_value extends ICommand {
+ // @ ensures exprs().size > 0;
+ List exprs();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB pop commands. */
+ static public interface Ipop extends ICommand {
+ // @ ensures \result.intValue() >= 0;
+ INumeral number();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB push commands. */
+ static public interface Ipush extends ICommand {
+ // @ ensures \result.intValue() >= 0;
+ INumeral number();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB reset commands. */
+ static public interface Ireset extends ICommand {
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB reset-assertions commands. */
+ static public interface Ireset_assertions extends ICommand {
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB set-logic commands. */
+ static public interface Iset_logic extends ICommand {
+ ISymbol logic();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB set-info commands. */
+ static public interface Iset_info extends ICommand {
+ IKeyword infoflag();
+
+ IAttributeValue value();
+ }
+
+ /** Interface to be implemented by all objects representing SMT-LIB set-option commands. */
+ static public interface Iset_option extends ICommand {
+ IKeyword option();
+
+ /* @Nullable */IAttributeValue value();
+ }
}
diff --git a/SMT/src/org/smtlib/command/C_declare_nat.java b/SMT/src/org/smtlib/command/C_declare_nat.java
new file mode 100644
index 0000000..005949f
--- /dev/null
+++ b/SMT/src/org/smtlib/command/C_declare_nat.java
@@ -0,0 +1,58 @@
+package org.smtlib.command;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import org.smtlib.IParser.ParserException;
+import org.smtlib.IResponse;
+import org.smtlib.ISolver;
+import org.smtlib.IVisitor;
+import org.smtlib.IVisitor.VisitorException;
+import org.smtlib.impl.Command;
+import org.smtlib.impl.Response;
+import org.smtlib.sexpr.Parser;
+import org.smtlib.sexpr.Printer;
+
+public class C_declare_nat extends Command {
+
+ public static final String javaDir = "/Users/koja/UCF/Research/declare-nat/";
+
+ /** The command name */
+ public static final String commandName = "declare-nat";
+
+ public C_declare_nat() {}
+
+ /** Parses the arguments of the command, producing a new command instance */
+ static public /* @Nullable */ C_declare_nat parse(final Parser p)
+ throws IOException, ParserException {
+ p.parseExpr();
+ while (!p.isRP()) {
+ p.parseExpr();
+ }
+ return new C_declare_nat();
+ }
+
+ @Override
+ public IResponse execute(final ISolver solver) {
+ return (new Response.Factory(solver.smt())).unknown();
+ }
+
+ @Override
+ public T accept(final IVisitor v) throws VisitorException {
+ return v.visit(this);
+ }
+
+ /** The command name */
+ @Override
+ public String commandName() {
+ return commandName;
+ }
+
+ /** Writes out the command in S-expression syntax using the given printer */
+ public void write(final Printer p) throws IOException, IVisitor.VisitorException {
+ final String natJava = new String(Files.readAllBytes(Paths.get(javaDir + "Nat.java")));
+ p.writer().append(natJava);
+ }
+
+
+}
diff --git a/SMT/src/smt2jml/Smt2Jml.java b/SMT/src/smt2jml/Smt2Jml.java
new file mode 100644
index 0000000..4f672db
--- /dev/null
+++ b/SMT/src/smt2jml/Smt2Jml.java
@@ -0,0 +1,66 @@
+package smt2jml;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.StringWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import org.smtlib.CharSequenceReader;
+import org.smtlib.ICommand;
+import org.smtlib.IParser;
+import org.smtlib.ISource;
+import org.smtlib.IVisitor.VisitorException;
+import org.smtlib.SMT;
+
+public class Smt2Jml {
+
+ public static final Path outputDir = Paths.get("/Users/koja/UCF/Research/output/");
+
+ public static void main(final String... args) {
+ smt2Jml(outputDir.resolve("loop_inv.smt2"), System.out);
+ }
+
+ public static void smt2Jml(final Path input, final PrintStream output) {
+ final SMT smt = new SMT();
+
+
+ try {
+ smt.smtConfig.log.clearListeners(); // Don't output error log to System.out
+ String fileString = new String(Files.readAllBytes(input));
+ fileString = prepare(fileString);
+ final ISource source = smt.smtConfig.smtFactory
+ .createSource(new CharSequenceReader(new java.io.StringReader(fileString)), null);
+ IParser parser = smt.smtConfig.smtFactory.createParser(smt.smtConfig, source);
+ final Smt2JmlPreprocessor preprocessor = new Smt2JmlPreprocessor();
+ while (!parser.isEOD()) {
+ final ICommand command = parser.parseCommand();
+ if (command != null) {
+ command.accept(preprocessor);
+ }
+ }
+ parser = smt.smtConfig.smtFactory.createParser(smt.smtConfig, source);
+ smt.smtConfig.defaultPrinter = new Smt2JmlVisitor(new StringWriter());
+ while (!parser.isEOD()) {
+ final ICommand command = parser.parseCommand();
+ if (command != null) {
+ output.println(smt.smtConfig.defaultPrinter.toString(command));
+ }
+ }
+ } catch (final java.io.IOException e) {
+ // Can happen if the ISource is reading from a file
+ System.err.println(e.getMessage());
+ } catch (final IParser.ParserException e) {
+ System.err.println(e.getMessage());
+ } catch (final java.nio.file.FileSystemNotFoundException e) {
+ System.err.println(e.getMessage());
+ } catch (final VisitorException e) {
+ System.err.println(e.getMessage());
+ }
+ }
+
+ private static String prepare(final String fileString) throws IOException {
+ return fileString.replace("'", ""); // remove single quotes
+ }
+
+}
diff --git a/SMT/src/smt2jml/Smt2JmlPreprocessor.java b/SMT/src/smt2jml/Smt2JmlPreprocessor.java
new file mode 100644
index 0000000..827aea3
--- /dev/null
+++ b/SMT/src/smt2jml/Smt2JmlPreprocessor.java
@@ -0,0 +1,87 @@
+package smt2jml;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.smtlib.ICommand;
+import org.smtlib.IExpr.ISymbol;
+import org.smtlib.ISort;
+import org.smtlib.IVisitor;
+import org.smtlib.IVisitor.TreeVisitor;
+import org.smtlib.command.C_assert;
+import org.smtlib.command.C_declare_const;
+import org.smtlib.command.C_declare_fun;
+import org.smtlib.command.C_declare_sort;
+
+public class Smt2JmlPreprocessor extends TreeVisitor {
+ private boolean isAssertion = false;
+ public static Set usedSymbols = new HashSet<>();
+
+ @Override
+ public Void visit(final ISymbol e) throws VisitorException {
+ if (isAssertion) {
+ usedSymbols.add(e.toString());
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(final ICommand e) throws IVisitor.VisitorException {
+ if (e instanceof C_declare_fun) {
+ visitDeclareFun((C_declare_fun) e);
+ return null;
+ } else if (e instanceof C_declare_sort) {
+ visitDeclareSort((C_declare_sort) e);
+ return null;
+ } else if (e instanceof C_assert) {
+ visitAssert((C_assert) e);
+ return null;
+ }
+ return null;
+ }
+
+ private void visitAssert(final C_assert that) {
+ try {
+ isAssertion = true;
+ that.expr().accept(this);
+ isAssertion = false;
+ } catch (final VisitorException e) {
+ System.err.println(e.getMessage());
+ }
+ }
+
+ private void visitDeclareSort(final C_declare_sort that) {
+ try {
+ that.sortSymbol().accept(this);
+ that.sortSymbol().accept(this);
+ } catch (final VisitorException e) {
+ System.err.println(e.getMessage());
+ }
+ }
+
+ private void visitDeclareFun(final C_declare_fun that) {
+ if (that instanceof C_declare_const) {
+ visitDeclareConst((C_declare_const) that);
+ return;
+ }
+ try {
+ that.resultSort().accept(this);
+ that.symbol().accept(this);
+ for (final ISort s : that.argSorts()) {
+ s.accept(this);
+ }
+ } catch (final VisitorException e) {
+ System.err.println(e.getMessage());
+ }
+ }
+
+ private void visitDeclareConst(final C_declare_const that) {
+ try {
+ that.resultSort().accept(this);
+ that.symbol().accept(this);
+ } catch (final VisitorException e) {
+ System.err.println(e.getMessage());
+ }
+ }
+
+
+}
diff --git a/SMT/src/smt2jml/Smt2JmlVisitor.java b/SMT/src/smt2jml/Smt2JmlVisitor.java
new file mode 100644
index 0000000..4a57d37
--- /dev/null
+++ b/SMT/src/smt2jml/Smt2JmlVisitor.java
@@ -0,0 +1,354 @@
+package smt2jml;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.smtlib.IAccept;
+import org.smtlib.ICommand;
+import org.smtlib.IExpr;
+import org.smtlib.IExpr.IAttribute;
+import org.smtlib.IExpr.IDeclaration;
+import org.smtlib.IExpr.IExists;
+import org.smtlib.IExpr.IFcnExpr;
+import org.smtlib.IExpr.IForall;
+import org.smtlib.IExpr.ISymbol;
+import org.smtlib.ISort;
+import org.smtlib.IVisitor;
+import org.smtlib.command.C_assert;
+import org.smtlib.command.C_declare_const;
+import org.smtlib.command.C_declare_fun;
+import org.smtlib.command.C_declare_sort;
+import org.smtlib.sexpr.Printer;
+import org.smtlib.sexpr.Utils;
+
+public class Smt2JmlVisitor extends Printer {
+
+ private static Map binaryOpsMap = new HashMap<>();
+ private static Map unaryOpsMap = new HashMap<>();
+ private static Set methods = new HashSet<>();
+ private static int loopInvariantCount = 0;
+
+ static {
+ binaryOpsMap.put("or", "||");
+ binaryOpsMap.put("and", "&&");
+ binaryOpsMap.put("=>", "==>");
+ binaryOpsMap.put("<", "<");
+ binaryOpsMap.put("<=", "<=");
+ binaryOpsMap.put(">", ">");
+ binaryOpsMap.put(">=", ">=");
+ binaryOpsMap.put("+", "+");
+ binaryOpsMap.put("/", "/");
+ binaryOpsMap.put("*", "*");
+ binaryOpsMap.put("-", "-");
+ binaryOpsMap.put("%", "%");
+ binaryOpsMap.put("=", "==");
+ binaryOpsMap.put("!=", "!=");
+ unaryOpsMap.put("not", "!");
+ unaryOpsMap.put("-", "-");
+ }
+
+ /** indent and alignment */
+ private int lmargin = 0;
+ private final int indentWidth = 2;
+
+ private void indent() {
+ lmargin += indentWidth;
+ }
+
+ private void undent() {
+ lmargin -= indentWidth;
+ if (lmargin < 0) {
+ lmargin = 0;
+ }
+ }
+
+ private void returnAndAlign() throws IOException {
+ w.append("\n");
+ for (int i = 0; i < lmargin; ++i) {
+ w.append(" ");
+ }
+ }
+
+ private void returnAndIndent() throws IOException {
+ indent();
+ returnAndAlign();
+ }
+
+ private void returnAndUndent() throws IOException {
+ undent();
+ returnAndAlign();
+ }
+
+ public Smt2JmlVisitor(final Writer w) {
+ super(w);
+ }
+
+ @Override
+ public Void visit(final IAttribute> e) throws VisitorException {
+ return null;
+ }
+
+ @Override
+ public Void visit(final IFcnExpr e) throws IVisitor.VisitorException {
+ try {
+ final String id = e.head().headSymbol().value();
+ String sep = "";
+ if (unaryOpsMap.containsKey(id)) {
+ e.head().accept(this);
+ for (final IExpr a : e.args()) {
+ if (a != null) {
+ a.accept(this);
+ } else {
+ w.append("???");
+ }
+ }
+ } else if (binaryOpsMap.containsKey(id)) {
+ w.append("(");
+ e.args().get(0).accept(this);
+ e.head().accept(this);
+ e.args().get(1).accept(this);
+ w.append(")");
+ } else {
+ e.head().accept(this);
+ w.append("(");
+ for (final IExpr a : e.args()) {
+ w.append(sep);
+ if (a != null) {
+ a.accept(this);
+ } else {
+ w.append("???");
+ }
+ sep = ", ";
+ }
+ w.append(")");
+ }
+ } catch (final IOException ex) {
+ throw new IVisitor.VisitorException(ex, e.pos());
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(final IForall e) throws IVisitor.VisitorException {
+ try {
+ w.append("\\" + Utils.FORALL + " ");
+ String sep = "";
+ for (final IDeclaration a : e.parameters()) {
+ w.append(sep);
+ a.accept(this);
+ sep = ", ";
+ }
+ w.append(";\n");
+ w.append(" @ ");
+ e.expr().accept(this);
+ } catch (final IOException ex) {
+ throw new IVisitor.VisitorException(ex, e.pos());
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(final IExists e) throws IVisitor.VisitorException {
+ try {
+ w.append("\\" + Utils.EXISTS + " ");
+ String sep = "";
+ for (final IDeclaration a : e.parameters()) {
+ w.append(sep);
+ a.accept(this);
+ sep = ", ";
+ }
+ w.append(";\n");
+ w.append(" @ ");
+ e.expr().accept(this);
+ } catch (final IOException ex) {
+ throw new IVisitor.VisitorException(ex, e.pos());
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(final IDeclaration e) throws IVisitor.VisitorException {
+ try {
+ e.sort().accept(this);
+ w.append(" ");
+ e.parameter().accept(this);
+ } catch (final IOException ex) {
+ throw new VisitorException(ex, e.pos());
+ }
+ return null;
+ }
+
+ @Override
+ public Void visit(final ISymbol e) throws IVisitor.VisitorException {
+ final String sym = e.value();
+ try {
+ if (unaryOpsMap.containsKey(sym)) {
+ w.append(unaryOpsMap.get(sym));
+ return null;
+ }
+ if (binaryOpsMap.containsKey(sym)) {
+ w.append(" " + binaryOpsMap.get(sym) + " ");
+ return null;
+ }
+ if (sym.endsWith("_final")) {
+ w.append(sym.replace("_final", ""));
+ return null;
+ } else if (sym.endsWith("length")) {
+ w.append(sym.replace("length", ".length"));
+ return null;
+ }
+ switch (sym) {
+ case "Int":
+ w.append("int");
+ return null;
+ case "Bool":
+ w.append("boolean");
+ return null;
+ default:
+ w.append(e.toString());
+ return null;
+ }
+ } catch (final IOException ex) {
+ throw new IVisitor.VisitorException(ex);
+ }
+ }
+
+ @Override
+ public Void visit(final ICommand e) throws IVisitor.VisitorException {
+ if (e instanceof C_declare_fun) {
+ visitDeclareFun((C_declare_fun) e);
+ return null;
+ } else if (e instanceof C_declare_sort) {
+ visitDeclareSort((C_declare_sort) e);
+ return null;
+ } else if (e instanceof C_assert) {
+ visitAssert((C_assert) e);
+ return null;
+ }
+ super.visit(e);
+ return null;
+ }
+
+ private void visitAssert(final C_assert that) {
+ try {
+ w.append("/*[" + ++loopInvariantCount + "]*/");
+ final IExpr formula = that.expr();
+ w.append("/*@\n");
+ w.append(" @ loop_invariant ");
+ formula.accept(this);
+ w.append(";");
+ w.append("\n @*/");
+ } catch (final IOException e) {
+ error(e.getMessage());
+ } catch (final VisitorException e) {
+ error(e.getMessage());
+ }
+ }
+
+ private void visitDeclareSort(final C_declare_sort that) {
+ if (!Smt2JmlPreprocessor.usedSymbols.contains(that.sortSymbol().toString())) {
+ return;
+ }
+ try {
+ w.append("public class ");
+ that.sortSymbol().accept(this);
+ w.append(" {");
+ returnAndIndent();
+ w.append("public ");
+ that.sortSymbol().accept(this);
+ w.append(" (");
+ char paramName = 'a';
+ String sep = "";
+ for (int i = 0; i < that.arity().intValue(); ++i) {
+ w.append(sep);
+ w.append("/*TYPE*/ "); // The type of each parameter is not defined.
+ w.append(paramName++);
+ sep = ", ";
+ }
+ w.append(") {}");
+ returnAndUndent();
+ w.append("}");
+ } catch (final IOException e) {
+ error(e.getMessage());
+ } catch (final VisitorException e) {
+ error(e.getMessage());
+ }
+ }
+
+ private void visitDeclareFun(final C_declare_fun that) {
+ if (!Smt2JmlPreprocessor.usedSymbols.contains(that.symbol().toString())) {
+ return;
+ }
+ if (that instanceof C_declare_const) {
+ visitDeclareConst((C_declare_const) that);
+ return;
+ }
+ try {
+ methods.add(that.symbol().value());
+ w.append("//@ public pure model ");
+ that.resultSort().accept(this);
+ w.append(" ");
+ that.symbol().accept(this);
+ w.append("(");
+ char paramName = 'a';
+ String sep = "";
+ for (final ISort s : that.argSorts()) {
+ w.append(sep);
+ s.accept(this);
+ w.append(" ");
+ w.append(paramName++);
+ sep = ", ";
+ }
+ w.append(");");
+ } catch (final IOException e) {
+ error(e.getMessage());
+ } catch (final VisitorException e) {
+ error(e.getMessage());
+ }
+ }
+
+ private void visitDeclareConst(final C_declare_const that) {
+ try {
+ if (that.symbol().toString().endsWith("_init")) {
+ w.append("//@ ghost final ");
+ that.resultSort().accept(this);
+ w.append(" ");
+ that.symbol().accept(this);
+ w.append(" = ");
+ w.append(that.symbol().toString().replace("_init", ";"));
+ } else {
+ w.append("//@ public ghost model ");
+ that.resultSort().accept(this);
+ w.append(" ");
+ that.symbol().accept(this);
+ w.append(";");
+ }
+ } catch (final IOException e) {
+ error(e.getMessage());
+ } catch (final VisitorException e) {
+ error(e.getMessage());
+ }
+ }
+
+ /**
+ * Returns the argument as a String using a Printer of the same type as the receiver, but does not
+ * modify the receiver.
+ */
+ @Override
+ public String toString(final T expr) {
+ try {
+ if (expr == null) {
+ throw new IVisitor.VisitorException(new Throwable("expr is null"));
+ }
+ final StringWriter sw = new StringWriter();
+ expr.accept(new Smt2JmlVisitor(sw));
+ return sw.toString();
+ } catch (final IVisitor.VisitorException e) {
+ return "<>";
+ }
+ }
+}
diff --git a/SMTFeature/.project b/SMTFeature/.project
index eb86ed8..d67a734 100644
--- a/SMTFeature/.project
+++ b/SMTFeature/.project
@@ -1,17 +1,17 @@
-
-
- SMTFeature
-
-
-
-
-
- org.eclipse.pde.FeatureBuilder
-
-
-
-
-
- org.eclipse.pde.FeatureNature
-
-
+
+
+ SMTFeature
+
+
+
+
+
+ org.eclipse.pde.FeatureBuilder
+
+
+
+
+
+ org.eclipse.pde.FeatureNature
+
+
diff --git a/SMTFeature/build.properties b/SMTFeature/build.properties
index 82ab19c..64f93a9 100644
--- a/SMTFeature/build.properties
+++ b/SMTFeature/build.properties
@@ -1 +1 @@
-bin.includes = feature.xml
+bin.includes = feature.xml
diff --git a/SMTPlugin/.classpath b/SMTPlugin/.classpath
index bd4e238..3bd1deb 100644
--- a/SMTPlugin/.classpath
+++ b/SMTPlugin/.classpath
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/SMTPlugin/.project b/SMTPlugin/.project
index 568d6bf..fd99c4f 100644
--- a/SMTPlugin/.project
+++ b/SMTPlugin/.project
@@ -1,34 +1,34 @@
-
-
- SMTPlugin
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
- checkers.eclipse.checkerbuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
- checkers.eclipse.buildnature
-
-
+
+
+ SMTPlugin
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+ checkers.eclipse.checkerbuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+ checkers.eclipse.buildnature
+
+
diff --git a/SMTPlugin/META-INF/MANIFEST.MF b/SMTPlugin/META-INF/MANIFEST.MF
index b9a16c1..63c0da9 100644
--- a/SMTPlugin/META-INF/MANIFEST.MF
+++ b/SMTPlugin/META-INF/MANIFEST.MF
@@ -1,23 +1,23 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name
-Bundle-SymbolicName: org.smtlib.plugin.SMTPlugin;singleton:=true
-Bundle-Version: 0.9.10.5
-Bundle-Activator: org.smtlib.plugin.Activator
-Bundle-Vendor: David Cok
-Require-Bundle: org.eclipse.ui;bundle-version="3.108.0",
- org.eclipse.ui.ide;bundle-version="3.12.1",
- org.eclipse.ui.editors;bundle-version="3.10.0",
- org.eclipse.core.resources;bundle-version="3.11.0",
- org.eclipse.core.runtime;bundle-version="3.12.0",
- org.smtlib.SMT,
- org.eclipse.jface.text;bundle-version="3.11.1",
- org.eclipse.ui.console;bundle-version="3.6.200"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Bundle-ActivationPolicy: lazy
-Import-Package: org.eclipse.core.resources,
- org.eclipse.ui.console,
- org.eclipse.ui.texteditor
-Bundle-ClassPath: .
-Export-Package: org.smtlib.plugin,
- org.smtlib.plugin.editor
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.smtlib.plugin.SMTPlugin;singleton:=true
+Bundle-Version: 0.9.10.5
+Bundle-Activator: org.smtlib.plugin.Activator
+Bundle-Vendor: David Cok
+Require-Bundle: org.eclipse.ui;bundle-version="3.108.0",
+ org.eclipse.ui.ide;bundle-version="3.12.1",
+ org.eclipse.ui.editors;bundle-version="3.10.0",
+ org.eclipse.core.resources;bundle-version="3.11.0",
+ org.eclipse.core.runtime;bundle-version="3.12.0",
+ org.smtlib.SMT,
+ org.eclipse.jface.text;bundle-version="3.11.1",
+ org.eclipse.ui.console;bundle-version="3.6.200"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.ui.console,
+ org.eclipse.ui.texteditor
+Bundle-ClassPath: .
+Export-Package: org.smtlib.plugin,
+ org.smtlib.plugin.editor
diff --git a/SMTPlugin/OSGI-INF/l10n/bundle.properties b/SMTPlugin/OSGI-INF/l10n/bundle.properties
index 01db71e..44f65a3 100644
--- a/SMTPlugin/OSGI-INF/l10n/bundle.properties
+++ b/SMTPlugin/OSGI-INF/l10n/bundle.properties
@@ -1,14 +1,14 @@
-#Properties file for SMT Plug-in
-Bundle-Name = jSMTLIB-Plugin
-Bundle-Symbolic-Name = org.smtlib.plugin.SMTPlugin
-# Toolbar tooltips
-Toolbar.SMT.Tooltip = Runs the default SMT solver
-# Menu labels
-Delete.SMT.Markers = Delete SMT markers
-Run.default.solver = Run default solver
-View.Logic = View Logic
-Get.Value = Get Value
-All = All
-Runs.All.Solvers = Runs all solvers
-Run.SMT.Solver.Cmd = Run SMT solver
+#Properties file for SMT Plug-in
+Bundle-Name = jSMTLIB-Plugin
+Bundle-Symbolic-Name = org.smtlib.plugin.SMTPlugin
+# Toolbar tooltips
+Toolbar.SMT.Tooltip = Runs the default SMT solver
+# Menu labels
+Delete.SMT.Markers = Delete SMT markers
+Run.default.solver = Run default solver
+View.Logic = View Logic
+Get.Value = Get Value
+All = All
+Runs.All.Solvers = Runs all solvers
+Run.SMT.Solver.Cmd = Run SMT solver
Run.SMT.Solver.Desc = Runs the default SMT solver on selected files
\ No newline at end of file
diff --git a/SMTPlugin/build.properties b/SMTPlugin/build.properties
index 4cbea8e..35684ae 100644
--- a/SMTPlugin/build.properties
+++ b/SMTPlugin/build.properties
@@ -1,10 +1,10 @@
-source.. = src/
-output.. = bin/
-bin.includes = plugin.xml,\
- META-INF/,\
- .,\
- icons/,\
- bin/,\
- OSGI-INF/l10n/bundle.properties
-src.includes = icons/,\
- bin/
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ bin/,\
+ OSGI-INF/l10n/bundle.properties
+src.includes = icons/,\
+ bin/
diff --git a/SMTPlugin/html/.svn/all-wcprops b/SMTPlugin/html/.svn/all-wcprops
index 8193faa..c780399 100644
--- a/SMTPlugin/html/.svn/all-wcprops
+++ b/SMTPlugin/html/.svn/all-wcprops
@@ -1,17 +1,17 @@
-K 25
-svn:wc:ra_dav:version-url
-V 60
-/svnroot/jmlspecs/!svn/ver/1286/OpenJML/trunk/OpenJMLUI/html
-END
-JMLHelp.xml
-K 25
-svn:wc:ra_dav:version-url
-V 72
-/svnroot/jmlspecs/!svn/ver/1286/OpenJML/trunk/OpenJMLUI/html/JMLHelp.xml
-END
-JMLHelp.html
-K 25
-svn:wc:ra_dav:version-url
-V 73
-/svnroot/jmlspecs/!svn/ver/1286/OpenJML/trunk/OpenJMLUI/html/JMLHelp.html
-END
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svnroot/jmlspecs/!svn/ver/1286/OpenJML/trunk/OpenJMLUI/html
+END
+JMLHelp.xml
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svnroot/jmlspecs/!svn/ver/1286/OpenJML/trunk/OpenJMLUI/html/JMLHelp.xml
+END
+JMLHelp.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svnroot/jmlspecs/!svn/ver/1286/OpenJML/trunk/OpenJMLUI/html/JMLHelp.html
+END
diff --git a/SMTPlugin/html/.svn/entries b/SMTPlugin/html/.svn/entries
index 5ac4539..ce36986 100644
--- a/SMTPlugin/html/.svn/entries
+++ b/SMTPlugin/html/.svn/entries
@@ -1,96 +1,96 @@
-10
-
-dir
-2246
-https://jmlspecs.svn.sourceforge.net/svnroot/jmlspecs/OpenJML/trunk/OpenJMLUI/html
-https://jmlspecs.svn.sourceforge.net/svnroot/jmlspecs
-
-
-
-2009-05-24T02:55:27.836459Z
-1286
-davidcok
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-510593ba-971e-0410-8ca9-cbd488b1689e
-
-JMLHelp.xml
-file
-
-
-
-
-2010-07-17T20:46:42.694258Z
-33982bbcb2e49cbecd61ac79ee30360b
-2009-05-24T02:55:27.836459Z
-1286
-davidcok
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2092
-
-JMLHelp.html
-file
-
-
-
-
-2010-07-17T20:46:42.714258Z
-2589b7e4f58a5a1bb97800afb59e4be5
-2009-05-24T02:55:27.836459Z
-1286
-davidcok
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-26878
-
+10
+
+dir
+2246
+https://jmlspecs.svn.sourceforge.net/svnroot/jmlspecs/OpenJML/trunk/OpenJMLUI/html
+https://jmlspecs.svn.sourceforge.net/svnroot/jmlspecs
+
+
+
+2009-05-24T02:55:27.836459Z
+1286
+davidcok
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+510593ba-971e-0410-8ca9-cbd488b1689e
+
+JMLHelp.xml
+file
+
+
+
+
+2010-07-17T20:46:42.694258Z
+33982bbcb2e49cbecd61ac79ee30360b
+2009-05-24T02:55:27.836459Z
+1286
+davidcok
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2092
+
+JMLHelp.html
+file
+
+
+
+
+2010-07-17T20:46:42.714258Z
+2589b7e4f58a5a1bb97800afb59e4be5
+2009-05-24T02:55:27.836459Z
+1286
+davidcok
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+26878
+
diff --git a/SMTPlugin/html/.svn/text-base/JMLHelp.html.svn-base b/SMTPlugin/html/.svn/text-base/JMLHelp.html.svn-base
index 1fee139..adfc773 100644
--- a/SMTPlugin/html/.svn/text-base/JMLHelp.html.svn-base
+++ b/SMTPlugin/html/.svn/text-base/JMLHelp.html.svn-base
@@ -1,556 +1,556 @@
-
-
-
-JML Eclipse plug-in
-
-
-
-
-This plug-in provides Java Modeling Language
-(JML)
-functionality as an Eclipse plug-in into the Java (1.5) development environment of Eclipse.
-The JML plug-in
-in particular provides functionality for checking and manipulating annotation
-files.
-
-The plug-in adds the following functionality to Eclipse's Java Perspective:
-
-
A menubar item labeled 'JML' with a number of submenu items that
-invoke various tools and manage the environment.
-
A toolbar item labeled with the JML yellow coffee cup icon that invokes the JML checker.
-
Problem markers: a red disk with a 'J' on it for JML problems, and
-a yellow disk with a 'J' on it for JML warnings.
-These must be enabled in the Filters menu of the Problems view (they may be
-disabled by default).
-
Annotation preferences. On the General>Editors>TextEditors>Annotations
-preference page are two new categories, 'JML Error' and 'JML Warning'. This
-preference page are controls for determining whether and how editor annotations
-are displayed in editors - e.g. as squigglies, in the overview ruler (on the right),
-in the vertical ruler (on the left), and in what color.
-
Context menu items in various views
-and on Java editors that replicate some
-of the above menu items for Java Projects, source
-folders, packages, and compilation
-units.
-
A console page to which output from the JML operations is sent.
-
A JML preferences page in the Java group of preference pages
-(under Window >> Preferences).
-
A JML builder that is visible (when the JML Nature is enabled)
-in the Project Properties Builders page.
-
A decoration visible in the package explorer (and other places)
-on Java Projects with autochecking enabled. There is a toggle
-named 'JML' to enable these decorations in the Label Decorations page of
-the workbench preferences.
-
A new category of commands in the Workbench >> Keys page of the Eclipse
-preferences. The category is named 'JML' and allows key bindings to be
-defined for the various new menu actions.
-
A Help document describing the JML plug-in functionality available
-through the Help >> HelpContents menu (this document).
-
-
-Besides the additions to the Eclipse UI, there is also a JML command-line tool
-that can be executed using Eclipse.
-
-
-The plug-in is installed from a standard Eclipse update site as follows.
-
-
Start Eclipse.
-
Open the dialog at Help >> Software Updates >> Find and Install.
-
Choose "Search for new features to install" and "Next>".
-
Select "New Remote Site". Fill in the dialog with the name "JML"
- and the URL "???", and press "OK".
-
Select "JML" in the list of sites to search and press "Next>".
-
If all is well, the available versions of the plug-in will be displayed;
- select the most recent JML version and press "Next>".
-
Read and accept the license terms, and press "Next>".
-
Choose the local installation site into which you want to install the plug-in
- (or add a new one for experimentation); then press 'Finish'. You will likely
- be asked to restart the workspace, which you should do, otherwise the menu
- items may not appear.
-
Within the file system, find the installation site plugins directory,
- and set all of the Simplify* files to have executable permission.
- (As of version 1.1.1, this should be taken care of automatically when
- the Simplify executable is first used, but it is best if the installer
- fixes the permissions at install time.)
-
The plug-in will be available from any newly opened workspace from this
- installation site.
-
The plug-in can be disabled or uninstalled
- using Help >> Software Updates >> Manage Configuration.
-
-If you simply want to update a previous installation of JML,
-then do the following:
-
-
Open an Eclipse workspace and choose Help >> Software Updates >> Find and Install.
-
Choose "Search for updates..." and "Next>"
-
Select the feature version to install and "Next>"
-
Read and accept the license terms, and press "Next>".
-
Choose the local installation site into which you want to install the plug-in
- (or add a new one for experimentation); then press 'Finish'. You will likely
- be asked to restart the workspace, which you should do.
-
The updated plug-in will be available from any newly opened workspace from this
- installation site.
-
-
In order to uninstall the plugin, do the following:
-
-
Choose Help >> Software Updates >> Manage Configuration
-
Click the + symbol by the install location from which you wish to uninstall the plugin
-
Choose the JML feature from the list of installed features
-
Select Uninstall in the right hand panel
-
Confirm the Uninstall and restart the workbench
-
-
-
-Once installed, there are a few setup actions that the user needs to
-do to avoid becoming confused later on.
-
-
Enable the JML markers - By default new marker types
-are not displayed in the 'Problems' View. To correct this, open
-the 'Problems' View (typically in the lower right pane in a Java
-Perspective), and then open the 'Filter' dialog using the toolbar
-item or the menu on the right end of the Problems view's toolbar.
-Make sure that the 'JML Warning' entry is checked.
-
Define file associations for specification file suffixes -
-The Java perspective does not treat specification files as first-class
-Java files, but it is at least helpful to be able to use the
-Java editor on these files. So choose Window >> Preferences and
-then Workbench >> File Associations. In turn, add the entries
-'*.refines-java', '*.refines-spec', '*.refines-jml', '*.spec'
-and '*.jml' as new file types in the upper panel and add the
-Java Editor as the default editor for each of these suffixes in the lower
-panel.
-
Be sure the JML Label Decorations are turned on in the
-Label Decorations page of the Workbench preferences.
-
Optionally define any desired key bindings for the various menu actions.
-Use the JML category in the Keys page of the Workbench preferences to do this.
-Add the key bindings to be effective in Windows or in Dialogs & Windows.
-
Other preferences relevant to the JML plug-in may be set on the
-JML preferences page under the Java category. (The preferences page is
-obtained from the Window >> Preferences menu item.)
-
-
-There is one other important action that is taken care of automatically
-but that the user should be aware of.
-
-
-
JML specifications for the Java system and JML Model classes - To use
-JML (or other JML-based tools) effectively, the tool needs to reference a
-copy of the JML specifications for the Java system classes. A copy of these
-is contained in the JML plug-in. When a project is enabled for
-JML checking, a specification project (named JmlSpecs) is automatically
-created and added to the workspace. This project contains a link to the
-library of system specifications; the project is also added to the classpath
-of the enabled project, so that the specifications are seen when individual
-files are checked.
-
-You may need to adjust the position of the specifications in the classpath.
-
-If you have other versions of the system specifications (or other sets
-of specifications for other libraries), you can conveniently add them
-to your Java Projects by ...
-
-
-
-Here are some aspects to be aware of in using the plug-in.
-
-
-The JML functionality is provided by a new implementation of JML for Java 1.5
-within Eclipse.
-
-Defining the Java Editor as the editor for the specification file suffixes
-goes only part of the way towards convenient handling of specification files within
-Eclipse. In particular, one difficulty is that editing specification files
-will not trigger an
-incremental compilation.
-
-The Eclipse framework operates on projects one by one. This is
-required because attributes such as the relevant classpath for
-compiling the project may differ from project to project. Hence
-JML (and JML tools) must also operate project by project; this is ordinarily
-not a problem but can in some circumstances lead to slow or
-undesirable results. This problem is avoided if everything that
-can be compiled with a given classpath is contained in one project,
-with one output bin directory,
-possibly using multiple source folders.
-
-Internal errors or unexpected exceptional situations are logged in
-Eclipse's error log. The JML page of the Eclipse Console
- may be used to report progress and general debugging information, if
- that output is enabled in the JML preferences page.
-
-
-The top menubar provides the following functionality. The toolbar
-and the context menus replicate some of this functionality. The menubar
-item is labeled 'JML'.
-
-Each of the menu operations act on the currently selected set of objects.
-If an editor is selected and active, the operation will apply to the
-one Java compilation unit in that editor. If a WorkingSet is selected, it will
-apply to the Java Projects in that Working Set.
-In Eclipse's Package Explorer view, multiple items may
-be selected. The operations will act appropriately on
-each selected Java Project, container or file.
-Selecting a container item will cause
-the relevant operation to be performed on all the items within the
-container. Currently, selecting a java element within a file (e.g. a method)
-does not result in any operation, though some appropriate action may be
-implemented in the future.
-
-
JML Checking
-This operation runs a JML check on each selected item or its contents.
-The operation can be initiated from the menu item or by the 'JML Check' item on the
-toolbar (the yellow coffee cup) or from various context menus.
-Any JML syntax or parsing errors are presented as problem markers.
-The problem markers are shown along the left edge of each editor at the line
-corresponding to the problem. If
-problem markers are enabled in the Problems View, then details of the problem
-are shown in the Problems View. This menu item performs
-a check whether or not the project is enabled for automatic checking.
-
-If an editor is modified and not saved, checking JML using the menubar or toolbar
-command will check the source in the editor, not that currently saved in the file.
-However the context menu operations within the Package Explorer... (FIXME)
-
-A JML Check operation needs to parse files other than those selected
-if they are referenced by the selected files. Thus errors may be
-detected (and markers produced) in files other than those selected.
-
-Prior to executing the checking operation, all markers are cleared
-from the selected files, so that a fresh set of error reports is
-available. However, non-selected files are not cleared, which may
-result in multiple markers being produced for problems in other files.
-Also, if the error is subsequently corrected but the file with the marker is
-not selected when the JML Checker is run again, the marker will not be
-cleared even though the problem is no longer present.
-
-
-
Deleting JML Markers
-The Delete Markers operation removes all problem markers from any selected files or
-files.
-
-
-
Enable JML auto checking
-Enabling the JML
-autochecker will install the JML nature on the project and enable the
-automatic builder. Then after any compilation (even an incremental compilation),
-the JML checker will be run on any newly saved compilation units of the project.
-The checker will be run on the entire project immediately upon enabling the
-automatic builder. This menu item is also available on WorkingSets in the
-Package Navigator; when activated, it applies to all of the Java projects in the
-working set. The auto checker is enabled or disabled only on Java Projects, not
-on components of projects.
-
-
-
Disable JML auto checking
-This menu action disables the JML automatic checking for a project.
-The menu item is also available on WorkingSets, in which case it applies to
-all of the Java Projects in the working set.
-Note that you can also disable automatic checking on the Builders page of the
-Project >> Properties menu item.
- The auto checker is enabled or disabled only on Java Projects, not
-on components of projects.
-
-
-
-
-
-
-
-
JML preferences
-The plug-in provides a new preference page under Window>>Preferences; it is
-contained under the 'Java' heading.
-All the items in the JML preferences page are global to all
-Java projects.
-
-FIXME - This needs rewriting.
-
Options for JML-Eclipse
-This group of options does not affect JML per se. Rather they control
-aspects of the plug-in.
-
-Enable Eclipse informational messages.
-Enabling this option turns on printing of
-progress and debug messages relating to the operation
-of the plug-in itself. (Default is off.) Errors and warnings are always displayed.
-
-Log to the Eclipse console.
-Error and informational output from the plug-in
-can be directed to one of two places, depending on the
-status of this toggle. If the toggle is checked (the default),
-progress and debug output is sent to the Eclipse console of the instance
-of Eclipse that is running the program being executed. If the toggle
-is not checked, then the output is sent to System.out. Depending
-on the way in which Eclipse was started, this output may end up in the
-terminal from which Eclipse was started, the console of a parent
-Eclipse process, or may be lost entirely.
-
-Send informational output to the log file also.
-When unchecked (the default), only error output is recorded in the system
-log file (as seen in Eclipse's Error Log view). By enabling this option,
-informational output is also logged in the log and can be seen in the Error
-Log view. Normally this simply clutters up the Error Log, but it can be helpful
-in some situations to capture all of the output in one place.
-
-
Options related to JML
-
-
-
Java source version.
-Use this option to specify the version of Java source code that is being used.
-Using version "1.4" enables the assert identifier to be treated as
-a keyword and for the assert statement to be interpreted as specified by Java.
-Using "1.5" enables all of the Java 5.0 (1.5) language enhancements [which are
-not yet implemented in JML.]
-The default is version 1.4. (-source option)
-
-Behavior of assert statement.
-Use this option to define the behavior of Java 1.4 assert statements. The options
-are to ignore assert statements, to treat them as Java statements (the default),
- or to convert
-them to JML assertions.
-
-
Other Features
-
JML Problem Markers
-
-The plug-in defines a new type of Problem marker that is used to indicate
-syntax errors or warnings about potential specification violations
-that the JML tool finds. The marker icon is a
-white 'J' superimposed on a red dot. The icon is shown in the ruler along the
-left edge of Java editors at the line where a problem is identified. Tooltip
-information, shown when the mouse pointer remains steady over the icon for a short
-period of time, gives details of the problem.
-
-The
-details of the problem are also shown in the Problems View. Note that the Problems
-View has a filter that chooses which types of problems are to be shown. The
-JML problem type is NOT shown by default and must be enabled in the
-filters menu of the Problems View. (The filters menu is found by selecting either
-the Filters icon or the down-arrow Menu icon in the upper right corner of the
-Problems View). [ FIXME - is it still true that the markers are not shown by defzault?]
-
-
JML Console
-The Eclipse Console View is available to plug-ins to show textual output from
-plug-in tools. The Console has a number of panes. The JML plug-in adds
-a new pane, called 'JML', to which output from the JML plug-in or
-tool is sent. The Console view generally automatically switches to the pane
-with recent output, but on some occasions the user may have to choose the
-pane manually to see the JML output.
-
Context Menus
-The context menu in the Package Navigator (obtained with a right mouse press over
-an item in the Package Navigator tree hierarchy) has menu options pertinent
-to the context in which the menu is invoked. These actions are equivalent
-to those in the menubar.
-
JML Automatic Builder
-When JML is enabled for a project
-(e.g. by the JML >> Setup >> Enable JML menu item), then
-a new Incremental Builder becomes available on the Project's
-Builders Properties page. Once present, the builders can be
-enabled and disabled on the Builders page.
-
-When the 'JML AutoCheck' Builder is enabled, then whenever compilation
-takes place within a project, all files in that project are JML-checked
-after being compiled.
-Success or failure of this checking is shown by the presence of
-JML markers
-in each file, just as errors from the Java compiler are show by Java Problem markers.
-
-Enabling auto checking will cause Eclipse to immediately run a compilation
-cycle on that project.
-
-Note that changing the options on the JML preferences page does not
-constitute changing the file and will not provoke an incremental
-recompilation (and JML rechecking) of the files. Instead, if you
-change the JML options (when you have auto checking enabled),
-do a clean rebuild of the files (or a gratuitous edit and save within them).
-Be sure to save any edited files, or have 'Save automatically before build'
-enabled on the Workbench Preferences page (from the Window>>Preferences menu item).
-
-
JML Label Decorations
-The plug-in adds a new label decoration to the Eclipse framework.
-Label Decorators can be
-enabled or disabled on the Workbench>>Label Decorations page of the
-workbench Preferences. When enabled here, a decoration may be shown on
-icons in the Package Explorer view.
-The decoaration is a miniscule version of the JML logo (a mostly yellow coffee cup)
-appears as an Upper Right
-overlay for Java Projects that have JML enabled.
- (It lies on top of the
-blue J indicating a Java Project.)
-
-
JML Key Bindings
-The 'Keys' page of the Workbench preferences allows the user to
-associate key bindings with any
-command. There is a JML category of commands.
-No key bindings are defined by default, but the
-user may choose to add some. Make sure they are enabled for 'Windows'
-or 'Dialogs and Windows'.
-
-
JML Help
-Help information (this document) is available through the Help menu.
-Select the Help menu item on the menubar and the 'Help Contents'
-sub-menu item. One of the help topics shown is 'JML'. Selecting
-that topic will bring up this JML Help document.
-
-In addition all the various toolbar and dialog box controls have tool tip
-information that gives a bit more explanation of the purpose of the item.
-
-
Version history
-
-
Version ???? (TBD):
-
-
Getting Started Tutorial
---- not written yet -- (FIXME)
-
-
-
Notes for Developers
---- not written yet -- (FIXME)
-
-
Problems to fix and features to add
-
-This section summarizes in bullet form
-outstanding issues and future would-be-nice features.
-
+This plug-in provides Java Modeling Language
+(JML)
+functionality as an Eclipse plug-in into the Java (1.5) development environment of Eclipse.
+The JML plug-in
+in particular provides functionality for checking and manipulating annotation
+files.
+
+The plug-in adds the following functionality to Eclipse's Java Perspective:
+
+
A menubar item labeled 'JML' with a number of submenu items that
+invoke various tools and manage the environment.
+
A toolbar item labeled with the JML yellow coffee cup icon that invokes the JML checker.
+
Problem markers: a red disk with a 'J' on it for JML problems, and
+a yellow disk with a 'J' on it for JML warnings.
+These must be enabled in the Filters menu of the Problems view (they may be
+disabled by default).
+
Annotation preferences. On the General>Editors>TextEditors>Annotations
+preference page are two new categories, 'JML Error' and 'JML Warning'. This
+preference page are controls for determining whether and how editor annotations
+are displayed in editors - e.g. as squigglies, in the overview ruler (on the right),
+in the vertical ruler (on the left), and in what color.
+
Context menu items in various views
+and on Java editors that replicate some
+of the above menu items for Java Projects, source
+folders, packages, and compilation
+units.
+
A console page to which output from the JML operations is sent.
+
A JML preferences page in the Java group of preference pages
+(under Window >> Preferences).
+
A JML builder that is visible (when the JML Nature is enabled)
+in the Project Properties Builders page.
+
A decoration visible in the package explorer (and other places)
+on Java Projects with autochecking enabled. There is a toggle
+named 'JML' to enable these decorations in the Label Decorations page of
+the workbench preferences.
+
A new category of commands in the Workbench >> Keys page of the Eclipse
+preferences. The category is named 'JML' and allows key bindings to be
+defined for the various new menu actions.
+
A Help document describing the JML plug-in functionality available
+through the Help >> HelpContents menu (this document).
+
+
+Besides the additions to the Eclipse UI, there is also a JML command-line tool
+that can be executed using Eclipse.
+
+
+The plug-in is installed from a standard Eclipse update site as follows.
+
+
Start Eclipse.
+
Open the dialog at Help >> Software Updates >> Find and Install.
+
Choose "Search for new features to install" and "Next>".
+
Select "New Remote Site". Fill in the dialog with the name "JML"
+ and the URL "???", and press "OK".
+
Select "JML" in the list of sites to search and press "Next>".
+
If all is well, the available versions of the plug-in will be displayed;
+ select the most recent JML version and press "Next>".
+
Read and accept the license terms, and press "Next>".
+
Choose the local installation site into which you want to install the plug-in
+ (or add a new one for experimentation); then press 'Finish'. You will likely
+ be asked to restart the workspace, which you should do, otherwise the menu
+ items may not appear.
+
Within the file system, find the installation site plugins directory,
+ and set all of the Simplify* files to have executable permission.
+ (As of version 1.1.1, this should be taken care of automatically when
+ the Simplify executable is first used, but it is best if the installer
+ fixes the permissions at install time.)
+
The plug-in will be available from any newly opened workspace from this
+ installation site.
+
The plug-in can be disabled or uninstalled
+ using Help >> Software Updates >> Manage Configuration.
+
+If you simply want to update a previous installation of JML,
+then do the following:
+
+
Open an Eclipse workspace and choose Help >> Software Updates >> Find and Install.
+
Choose "Search for updates..." and "Next>"
+
Select the feature version to install and "Next>"
+
Read and accept the license terms, and press "Next>".
+
Choose the local installation site into which you want to install the plug-in
+ (or add a new one for experimentation); then press 'Finish'. You will likely
+ be asked to restart the workspace, which you should do.
+
The updated plug-in will be available from any newly opened workspace from this
+ installation site.
+
+
In order to uninstall the plugin, do the following:
+
+
Choose Help >> Software Updates >> Manage Configuration
+
Click the + symbol by the install location from which you wish to uninstall the plugin
+
Choose the JML feature from the list of installed features
+
Select Uninstall in the right hand panel
+
Confirm the Uninstall and restart the workbench
+
+
+
+Once installed, there are a few setup actions that the user needs to
+do to avoid becoming confused later on.
+
+
Enable the JML markers - By default new marker types
+are not displayed in the 'Problems' View. To correct this, open
+the 'Problems' View (typically in the lower right pane in a Java
+Perspective), and then open the 'Filter' dialog using the toolbar
+item or the menu on the right end of the Problems view's toolbar.
+Make sure that the 'JML Warning' entry is checked.
+
Define file associations for specification file suffixes -
+The Java perspective does not treat specification files as first-class
+Java files, but it is at least helpful to be able to use the
+Java editor on these files. So choose Window >> Preferences and
+then Workbench >> File Associations. In turn, add the entries
+'*.refines-java', '*.refines-spec', '*.refines-jml', '*.spec'
+and '*.jml' as new file types in the upper panel and add the
+Java Editor as the default editor for each of these suffixes in the lower
+panel.
+
Be sure the JML Label Decorations are turned on in the
+Label Decorations page of the Workbench preferences.
+
Optionally define any desired key bindings for the various menu actions.
+Use the JML category in the Keys page of the Workbench preferences to do this.
+Add the key bindings to be effective in Windows or in Dialogs & Windows.
+
Other preferences relevant to the JML plug-in may be set on the
+JML preferences page under the Java category. (The preferences page is
+obtained from the Window >> Preferences menu item.)
+
+
+There is one other important action that is taken care of automatically
+but that the user should be aware of.
+
+
+
JML specifications for the Java system and JML Model classes - To use
+JML (or other JML-based tools) effectively, the tool needs to reference a
+copy of the JML specifications for the Java system classes. A copy of these
+is contained in the JML plug-in. When a project is enabled for
+JML checking, a specification project (named JmlSpecs) is automatically
+created and added to the workspace. This project contains a link to the
+library of system specifications; the project is also added to the classpath
+of the enabled project, so that the specifications are seen when individual
+files are checked.
+
+You may need to adjust the position of the specifications in the classpath.
+
+If you have other versions of the system specifications (or other sets
+of specifications for other libraries), you can conveniently add them
+to your Java Projects by ...
+
+
+
+Here are some aspects to be aware of in using the plug-in.
+
+
+The JML functionality is provided by a new implementation of JML for Java 1.5
+within Eclipse.
+
+Defining the Java Editor as the editor for the specification file suffixes
+goes only part of the way towards convenient handling of specification files within
+Eclipse. In particular, one difficulty is that editing specification files
+will not trigger an
+incremental compilation.
+
+The Eclipse framework operates on projects one by one. This is
+required because attributes such as the relevant classpath for
+compiling the project may differ from project to project. Hence
+JML (and JML tools) must also operate project by project; this is ordinarily
+not a problem but can in some circumstances lead to slow or
+undesirable results. This problem is avoided if everything that
+can be compiled with a given classpath is contained in one project,
+with one output bin directory,
+possibly using multiple source folders.
+
+Internal errors or unexpected exceptional situations are logged in
+Eclipse's error log. The JML page of the Eclipse Console
+ may be used to report progress and general debugging information, if
+ that output is enabled in the JML preferences page.
+
+
+The top menubar provides the following functionality. The toolbar
+and the context menus replicate some of this functionality. The menubar
+item is labeled 'JML'.
+
+Each of the menu operations act on the currently selected set of objects.
+If an editor is selected and active, the operation will apply to the
+one Java compilation unit in that editor. If a WorkingSet is selected, it will
+apply to the Java Projects in that Working Set.
+In Eclipse's Package Explorer view, multiple items may
+be selected. The operations will act appropriately on
+each selected Java Project, container or file.
+Selecting a container item will cause
+the relevant operation to be performed on all the items within the
+container. Currently, selecting a java element within a file (e.g. a method)
+does not result in any operation, though some appropriate action may be
+implemented in the future.
+
+
JML Checking
+This operation runs a JML check on each selected item or its contents.
+The operation can be initiated from the menu item or by the 'JML Check' item on the
+toolbar (the yellow coffee cup) or from various context menus.
+Any JML syntax or parsing errors are presented as problem markers.
+The problem markers are shown along the left edge of each editor at the line
+corresponding to the problem. If
+problem markers are enabled in the Problems View, then details of the problem
+are shown in the Problems View. This menu item performs
+a check whether or not the project is enabled for automatic checking.
+
+If an editor is modified and not saved, checking JML using the menubar or toolbar
+command will check the source in the editor, not that currently saved in the file.
+However the context menu operations within the Package Explorer... (FIXME)
+
+A JML Check operation needs to parse files other than those selected
+if they are referenced by the selected files. Thus errors may be
+detected (and markers produced) in files other than those selected.
+
+Prior to executing the checking operation, all markers are cleared
+from the selected files, so that a fresh set of error reports is
+available. However, non-selected files are not cleared, which may
+result in multiple markers being produced for problems in other files.
+Also, if the error is subsequently corrected but the file with the marker is
+not selected when the JML Checker is run again, the marker will not be
+cleared even though the problem is no longer present.
+
+
+
Deleting JML Markers
+The Delete Markers operation removes all problem markers from any selected files or
+files.
+
+
+
Enable JML auto checking
+Enabling the JML
+autochecker will install the JML nature on the project and enable the
+automatic builder. Then after any compilation (even an incremental compilation),
+the JML checker will be run on any newly saved compilation units of the project.
+The checker will be run on the entire project immediately upon enabling the
+automatic builder. This menu item is also available on WorkingSets in the
+Package Navigator; when activated, it applies to all of the Java projects in the
+working set. The auto checker is enabled or disabled only on Java Projects, not
+on components of projects.
+
+
+
Disable JML auto checking
+This menu action disables the JML automatic checking for a project.
+The menu item is also available on WorkingSets, in which case it applies to
+all of the Java Projects in the working set.
+Note that you can also disable automatic checking on the Builders page of the
+Project >> Properties menu item.
+ The auto checker is enabled or disabled only on Java Projects, not
+on components of projects.
+
+
+
+
+
+
+
+
JML preferences
+The plug-in provides a new preference page under Window>>Preferences; it is
+contained under the 'Java' heading.
+All the items in the JML preferences page are global to all
+Java projects.
+
+FIXME - This needs rewriting.
+
Options for JML-Eclipse
+This group of options does not affect JML per se. Rather they control
+aspects of the plug-in.
+
+Enable Eclipse informational messages.
+Enabling this option turns on printing of
+progress and debug messages relating to the operation
+of the plug-in itself. (Default is off.) Errors and warnings are always displayed.
+
+Log to the Eclipse console.
+Error and informational output from the plug-in
+can be directed to one of two places, depending on the
+status of this toggle. If the toggle is checked (the default),
+progress and debug output is sent to the Eclipse console of the instance
+of Eclipse that is running the program being executed. If the toggle
+is not checked, then the output is sent to System.out. Depending
+on the way in which Eclipse was started, this output may end up in the
+terminal from which Eclipse was started, the console of a parent
+Eclipse process, or may be lost entirely.
+
+Send informational output to the log file also.
+When unchecked (the default), only error output is recorded in the system
+log file (as seen in Eclipse's Error Log view). By enabling this option,
+informational output is also logged in the log and can be seen in the Error
+Log view. Normally this simply clutters up the Error Log, but it can be helpful
+in some situations to capture all of the output in one place.
+
+
Options related to JML
+
+
+
Java source version.
+Use this option to specify the version of Java source code that is being used.
+Using version "1.4" enables the assert identifier to be treated as
+a keyword and for the assert statement to be interpreted as specified by Java.
+Using "1.5" enables all of the Java 5.0 (1.5) language enhancements [which are
+not yet implemented in JML.]
+The default is version 1.4. (-source option)
+
+Behavior of assert statement.
+Use this option to define the behavior of Java 1.4 assert statements. The options
+are to ignore assert statements, to treat them as Java statements (the default),
+ or to convert
+them to JML assertions.
+
+
Other Features
+
JML Problem Markers
+
+The plug-in defines a new type of Problem marker that is used to indicate
+syntax errors or warnings about potential specification violations
+that the JML tool finds. The marker icon is a
+white 'J' superimposed on a red dot. The icon is shown in the ruler along the
+left edge of Java editors at the line where a problem is identified. Tooltip
+information, shown when the mouse pointer remains steady over the icon for a short
+period of time, gives details of the problem.
+
+The
+details of the problem are also shown in the Problems View. Note that the Problems
+View has a filter that chooses which types of problems are to be shown. The
+JML problem type is NOT shown by default and must be enabled in the
+filters menu of the Problems View. (The filters menu is found by selecting either
+the Filters icon or the down-arrow Menu icon in the upper right corner of the
+Problems View). [ FIXME - is it still true that the markers are not shown by defzault?]
+
+
JML Console
+The Eclipse Console View is available to plug-ins to show textual output from
+plug-in tools. The Console has a number of panes. The JML plug-in adds
+a new pane, called 'JML', to which output from the JML plug-in or
+tool is sent. The Console view generally automatically switches to the pane
+with recent output, but on some occasions the user may have to choose the
+pane manually to see the JML output.
+
Context Menus
+The context menu in the Package Navigator (obtained with a right mouse press over
+an item in the Package Navigator tree hierarchy) has menu options pertinent
+to the context in which the menu is invoked. These actions are equivalent
+to those in the menubar.
+
JML Automatic Builder
+When JML is enabled for a project
+(e.g. by the JML >> Setup >> Enable JML menu item), then
+a new Incremental Builder becomes available on the Project's
+Builders Properties page. Once present, the builders can be
+enabled and disabled on the Builders page.
+
+When the 'JML AutoCheck' Builder is enabled, then whenever compilation
+takes place within a project, all files in that project are JML-checked
+after being compiled.
+Success or failure of this checking is shown by the presence of
+JML markers
+in each file, just as errors from the Java compiler are show by Java Problem markers.
+
+Enabling auto checking will cause Eclipse to immediately run a compilation
+cycle on that project.
+
+Note that changing the options on the JML preferences page does not
+constitute changing the file and will not provoke an incremental
+recompilation (and JML rechecking) of the files. Instead, if you
+change the JML options (when you have auto checking enabled),
+do a clean rebuild of the files (or a gratuitous edit and save within them).
+Be sure to save any edited files, or have 'Save automatically before build'
+enabled on the Workbench Preferences page (from the Window>>Preferences menu item).
+
+
JML Label Decorations
+The plug-in adds a new label decoration to the Eclipse framework.
+Label Decorators can be
+enabled or disabled on the Workbench>>Label Decorations page of the
+workbench Preferences. When enabled here, a decoration may be shown on
+icons in the Package Explorer view.
+The decoaration is a miniscule version of the JML logo (a mostly yellow coffee cup)
+appears as an Upper Right
+overlay for Java Projects that have JML enabled.
+ (It lies on top of the
+blue J indicating a Java Project.)
+
+
JML Key Bindings
+The 'Keys' page of the Workbench preferences allows the user to
+associate key bindings with any
+command. There is a JML category of commands.
+No key bindings are defined by default, but the
+user may choose to add some. Make sure they are enabled for 'Windows'
+or 'Dialogs and Windows'.
+
+
JML Help
+Help information (this document) is available through the Help menu.
+Select the Help menu item on the menubar and the 'Help Contents'
+sub-menu item. One of the help topics shown is 'JML'. Selecting
+that topic will bring up this JML Help document.
+
+In addition all the various toolbar and dialog box controls have tool tip
+information that gives a bit more explanation of the purpose of the item.
+
+
Version history
+
+
Version ???? (TBD):
+
+
Getting Started Tutorial
+--- not written yet -- (FIXME)
+
+
+
Notes for Developers
+--- not written yet -- (FIXME)
+
+
Problems to fix and features to add
+
+This section summarizes in bullet form
+outstanding issues and future would-be-nice features.
+
-This plugin provides an interface to SMT-LIB functionality integrated with the Eclipse UI.
-There is an associated command-line tool that provides SMT-LIB type-checking and an interface to various SMT solvers.
-The tools use the SMT-LIB v.2 language.
-
-This plug-in provides
-SMT-LIB
-functionality as an Eclipse plug-in.
-The SMT-LIB plug-in
-in particular provides functionality for checking, editing and executing files in SMT-LIB
-version 2 format with a variety of SMT solvers.
-
-The plug-in adds the following functionality to Eclipse:
-
-
An editor for SMT-LIBv.2 files, with associated syntax coloring and automatic type-checking.
-
A menubar item labeled 'SMT' with a number of submenu items that
-invoke various tools and manage the environment. Through these menu actions
-the underlying SMT-LIB command-line tool can be invoked.
-
A toolbar item labeled 'SMT' that invokes an SMT solver.
-
Context menu items in various views
-that replicate some
-of the above menu items for Projects,
-folders, and SMT-LIB files.
-
An icon (blue disk with a 'S') that identifies SMT-LIB files and editors
-
Problem markers: a red disk with a 'S' on it indicating problems with SMT-LIB files.
-These must be enabled in the Filters menu of the Problems view (they may be
-disabled by default). There is a corresponding new Problem type.
-
A console page to which output from the SMT operations is sent.
-
A SMT preferences page
-(under Window >> Preferences) in which various options can be set.
-
A new category of commands in the Workbench >> Keys page of the Eclipse
-preferences. The category is named 'SMT' and allows key bindings to be
-defined for the various new menu actions.
-
A Help document describing the SMT plug-in functionality available
-through the Help >> HelpContents menu (this document).
-
-The plug-in has been developed for Eclipse 3.6.0.
-[TBD: Note 32 vs 64 bit ?? ]
-
-
-The plug-in is installed from a standard Eclipse update site as follows.
-
-
Start Eclipse.
-
Open the dialog at Help >> Install New Software
-
Insert the SMT-LIB Eclipse plug-in site address in the "Work with" field:
- TBD
-
Push the "Add" button and give the address a name (e.g. "SMT-LIB").
-
-
TBD
-
-
-
-
-
-To update everything installed: Open an Eclipse workspace and choose Help >> Check for Updates.
-If you simply want to update a previous installation of the SMT-LIB plug-in,
-then do the following:
-
-
-
Choose Help >> Install New Software"
-
Use the drop-down menu on the "Work with" field to select the SMT-LIB URL
-
When the information about the plug-in has updated, then if there is an
- update, select it and press Next.
-
TBD
-
-
In order to uninstall the plugin, do the following:
-
-
-The plug-in provides a text editor customized to SMT-LIBv2 files.
-The editor is the default editor for files with a '.smt2' suffix.
-It behaves like a regular text editor, with the usual functionality
-such as undo, cut&paste, search&replace, and word completion, and these embellisments:
-
-
The editor is customized to highlight SMT-LIBv2 tokens with
-syntax coloring.
-
-
The editor also runs the SMT-LIB type-checker whenever the file is
-edited or saved.
-
-
-
-For the future:
-
-
Customizing the syntax coloring and font
-
Customized word completion
-
Be able to turn auto-checking off, or do it in the background, for large files.
-
-
-
-
Menu actions
-
-Menu actions are available from these places; they all invoke the same functionality:
-
-
The submenu items of the 'SMT' item on the menubar. These actions apply to items selected in a View
-(such as the Package Navigator or Outline View) or to the selected editor.
-
The blue disk with 'S', which invokes the 'Run default solver' action
-
Context menus on Projects, Folders, and SMT-LIB files. The menu actions apply to the (one or more) items
-selected.
-
-If container items are selected (Projects or Folders),
-the menu action applies to all SMT-LIB files within the container.
-
-When type-checking or a solver runs on a script file, errors in the file are identified by problem markers
-(red disks with 'S' on them) and listed in the Eclipse Problem View. Output is also written to the Console View
-(the amount of output depends on various preferences).
-
-
-
Run default solver:
-This action runs a specific solver chosen in the preferences on the selected SMT-LIB script files.
-
-
[a solver name] (Run a specific named solver):
-This action runs the specifically named solver on the selected SMT-LIB script files.
-
-
'check': Runs just the type-checking on the selected script files.
-
-
'All' (Run all solvers):
-This action runs all the installed solvers on the selected SMT-LIB script files.
-
-
Delete SMT markers
-Deletes all the SMT markers (in case some do not delete as they should when a file is rechecked).
-
-
View Logic
-In a new text editor, shows the content of a logic or theory file whose name has been selected in a text or SMT editor.
-
-
-
-
-
SMT Problem Markers
-
-The plug-in defines a new type of Problem marker that is used to indicate
-syntax or runtime errors
-that the SMT tools find. The marker icon is a
-white 'S' superimposed on a red dot. The icon is shown in the ruler along the
-left edge of SMT editors at the line where a problem is identified. Tooltip
-information, shown when the mouse pointer remains steady over the icon for a short
-period of time, gives details of the problem. [TBD - not working]
-
-By default, problems are identified in the text with a red squiggly underscore.
-Using preferences (Window->Preferences) in the General->Editors->Text Editors->Annotations
-group, one can change the presentation of an SMT Problem. Select SMT Problem in
-the list of Annotations, and then set as desired whether the problem is shown in the vertical ruler
-(on the left), in the Overview ruler (on the right), the color used in the text itself,
-and whether the problem is shown in the text as a squiggly underscore, as highlighted, or
-neither.
-
-The same icon is used to identify SMT-LIB editors and
-to identify (in the Project Explorer or Navigator) files with the SMT-LIB suffix.
-
-The
-details of the problem are also shown in the Problems View. Note that the Problems
-View has a filter that chooses which types of problems are to be shown.
-
-The plug-in provides a new preference page named 'SMT' at the
-top level under Window>>Preferences.
-All the items in the SMT preferences page are global to all
-SMT-LIB files and operations.
-
-TBD - explain all the options
-
-
-
SMT Console
-The Eclipse Console View is available to plug-ins to show textual output from
-plug-in tools. The Console has a number of panes. The SMT plug-in adds
-a new pane, called 'SMT Console', to which output from the SMT plug-in or
-tools is sent. The Console view generally automatically switches to the pane
-with recent output, but on some occasions the user may have to choose the
-pane manually to see the SMT output.
-
-FOr the future:
-
-
Allow different consoles for different background jobs
-
-
-
SMT Key Bindings
-The 'Keys' page of the General Workbench preferences allows the user to
-associate key bindings with any
-command. There is a SMT category of commands.
-No key bindings are defined by default, but the
-user may choose to add some. Make sure they are enabled for 'Windows'
-or 'Dialogs and Windows'.
-
-
SMT Help
-Help information (this document) is available through the Help menu.
-Select the Help menu item on the menubar and the 'Help Contents'
-sub-menu item. One of the help topics shown is 'SMT'. Selecting
-that topic will bring up this SMT Help document.
-
-
-
-
+
+
+
+SMT Eclipse plug-in
+
+
+
+
SMT Eclipse Plugin
+
Author: David Cok
+
Version alpha, 6 December 2010
+
THIS DOCUMENT IS IN DRAFT FORM AND NOT YET COMPLETE
+This plugin provides an interface to SMT-LIB functionality integrated with the Eclipse UI.
+There is an associated command-line tool that provides SMT-LIB type-checking and an interface to various SMT solvers.
+The tools use the SMT-LIB v.2 language.
+
+This plug-in provides
+SMT-LIB
+functionality as an Eclipse plug-in.
+The SMT-LIB plug-in
+in particular provides functionality for checking, editing and executing files in SMT-LIB
+version 2 format with a variety of SMT solvers.
+
+The plug-in adds the following functionality to Eclipse:
+
+
An editor for SMT-LIBv.2 files, with associated syntax coloring and automatic type-checking.
+
A menubar item labeled 'SMT' with a number of submenu items that
+invoke various tools and manage the environment. Through these menu actions
+the underlying SMT-LIB command-line tool can be invoked.
+
A toolbar item labeled 'SMT' that invokes an SMT solver.
+
Context menu items in various views
+that replicate some
+of the above menu items for Projects,
+folders, and SMT-LIB files.
+
An icon (blue disk with a 'S') that identifies SMT-LIB files and editors
+
Problem markers: a red disk with a 'S' on it indicating problems with SMT-LIB files.
+These must be enabled in the Filters menu of the Problems view (they may be
+disabled by default). There is a corresponding new Problem type.
+
A console page to which output from the SMT operations is sent.
+
A SMT preferences page
+(under Window >> Preferences) in which various options can be set.
+
A new category of commands in the Workbench >> Keys page of the Eclipse
+preferences. The category is named 'SMT' and allows key bindings to be
+defined for the various new menu actions.
+
A Help document describing the SMT plug-in functionality available
+through the Help >> HelpContents menu (this document).
+
+The plug-in has been developed for Eclipse 3.6.0.
+[TBD: Note 32 vs 64 bit ?? ]
+
+
+The plug-in is installed from a standard Eclipse update site as follows.
+
+
Start Eclipse.
+
Open the dialog at Help >> Install New Software
+
Insert the SMT-LIB Eclipse plug-in site address in the "Work with" field:
+ TBD
+
Push the "Add" button and give the address a name (e.g. "SMT-LIB").
+
+
TBD
+
+
+
+
+
+To update everything installed: Open an Eclipse workspace and choose Help >> Check for Updates.
+If you simply want to update a previous installation of the SMT-LIB plug-in,
+then do the following:
+
+
+
Choose Help >> Install New Software"
+
Use the drop-down menu on the "Work with" field to select the SMT-LIB URL
+
When the information about the plug-in has updated, then if there is an
+ update, select it and press Next.
+
TBD
+
+
In order to uninstall the plugin, do the following:
+
+
+The plug-in provides a text editor customized to SMT-LIBv2 files.
+The editor is the default editor for files with a '.smt2' suffix.
+It behaves like a regular text editor, with the usual functionality
+such as undo, cut&paste, search&replace, and word completion, and these embellisments:
+
+
The editor is customized to highlight SMT-LIBv2 tokens with
+syntax coloring.
+
+
The editor also runs the SMT-LIB type-checker whenever the file is
+edited or saved.
+
+
+
+For the future:
+
+
Customizing the syntax coloring and font
+
Customized word completion
+
Be able to turn auto-checking off, or do it in the background, for large files.
+
+
+
+
Menu actions
+
+Menu actions are available from these places; they all invoke the same functionality:
+
+
The submenu items of the 'SMT' item on the menubar. These actions apply to items selected in a View
+(such as the Package Navigator or Outline View) or to the selected editor.
+
The blue disk with 'S', which invokes the 'Run default solver' action
+
Context menus on Projects, Folders, and SMT-LIB files. The menu actions apply to the (one or more) items
+selected.
+
+If container items are selected (Projects or Folders),
+the menu action applies to all SMT-LIB files within the container.
+
+When type-checking or a solver runs on a script file, errors in the file are identified by problem markers
+(red disks with 'S' on them) and listed in the Eclipse Problem View. Output is also written to the Console View
+(the amount of output depends on various preferences).
+
+
+
Run default solver:
+This action runs a specific solver chosen in the preferences on the selected SMT-LIB script files.
+
+
[a solver name] (Run a specific named solver):
+This action runs the specifically named solver on the selected SMT-LIB script files.
+
+
'check': Runs just the type-checking on the selected script files.
+
+
'All' (Run all solvers):
+This action runs all the installed solvers on the selected SMT-LIB script files.
+
+
Delete SMT markers
+Deletes all the SMT markers (in case some do not delete as they should when a file is rechecked).
+
+
View Logic
+In a new text editor, shows the content of a logic or theory file whose name has been selected in a text or SMT editor.
+
+
+
+
+
SMT Problem Markers
+
+The plug-in defines a new type of Problem marker that is used to indicate
+syntax or runtime errors
+that the SMT tools find. The marker icon is a
+white 'S' superimposed on a red dot. The icon is shown in the ruler along the
+left edge of SMT editors at the line where a problem is identified. Tooltip
+information, shown when the mouse pointer remains steady over the icon for a short
+period of time, gives details of the problem. [TBD - not working]
+
+By default, problems are identified in the text with a red squiggly underscore.
+Using preferences (Window->Preferences) in the General->Editors->Text Editors->Annotations
+group, one can change the presentation of an SMT Problem. Select SMT Problem in
+the list of Annotations, and then set as desired whether the problem is shown in the vertical ruler
+(on the left), in the Overview ruler (on the right), the color used in the text itself,
+and whether the problem is shown in the text as a squiggly underscore, as highlighted, or
+neither.
+
+The same icon is used to identify SMT-LIB editors and
+to identify (in the Project Explorer or Navigator) files with the SMT-LIB suffix.
+
+The
+details of the problem are also shown in the Problems View. Note that the Problems
+View has a filter that chooses which types of problems are to be shown.
+
+The plug-in provides a new preference page named 'SMT' at the
+top level under Window>>Preferences.
+All the items in the SMT preferences page are global to all
+SMT-LIB files and operations.
+
+TBD - explain all the options
+
+
+
SMT Console
+The Eclipse Console View is available to plug-ins to show textual output from
+plug-in tools. The Console has a number of panes. The SMT plug-in adds
+a new pane, called 'SMT Console', to which output from the SMT plug-in or
+tools is sent. The Console view generally automatically switches to the pane
+with recent output, but on some occasions the user may have to choose the
+pane manually to see the SMT output.
+
+FOr the future:
+
+
Allow different consoles for different background jobs
+
+
+
SMT Key Bindings
+The 'Keys' page of the General Workbench preferences allows the user to
+associate key bindings with any
+command. There is a SMT category of commands.
+No key bindings are defined by default, but the
+user may choose to add some. Make sure they are enabled for 'Windows'
+or 'Dialogs and Windows'.
+
+
SMT Help
+Help information (this document) is available through the Help menu.
+Select the Help menu item on the menubar and the 'Help Contents'
+sub-menu item. One of the help topics shown is 'SMT'. Selecting
+that topic will bring up this SMT Help document.
+
+
+
+
diff --git a/SMTPlugin/html/SMTHelp.xml b/SMTPlugin/html/SMTHelp.xml
index 4e02b3e..f2f376c 100644
--- a/SMTPlugin/html/SMTHelp.xml
+++ b/SMTPlugin/html/SMTHelp.xml
@@ -1,30 +1,30 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SMTPlugin/plugin.xml b/SMTPlugin/plugin.xml
index 06619e0..6f608f6 100644
--- a/SMTPlugin/plugin.xml
+++ b/SMTPlugin/plugin.xml
@@ -1,597 +1,597 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SMTPlugin/src/org/smtlib/plugin/AbstractPreference.java b/SMTPlugin/src/org/smtlib/plugin/AbstractPreference.java
index 2f18c38..14cda29 100644
--- a/SMTPlugin/src/org/smtlib/plugin/AbstractPreference.java
+++ b/SMTPlugin/src/org/smtlib/plugin/AbstractPreference.java
@@ -1,309 +1,309 @@
-/*
- * This file is part of the SMT plugin project.
- * Copyright 2010 David R. Cok
- * Created August 2010
- */
-package org.smtlib.plugin;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-
-/**
- * This is a base class for persistent options. The options are
- * stored as workspace preferences.
- *
- * @author David R. Cok
- */
-public class AbstractPreference {
-
- /** A reference to the plugin's preference store */
- public IPreferenceStore preferenceStore() {
- return Activator.getDefault().getPreferenceStore();
- }
-
- /** The name used as the key into the
- * persistent store for the value of the option.
- */
- //@ non_null
- protected String key;
-
- /** The label to use for the widget */
- //@ non_null
- protected String label;
-
- /** The tooltip help for the widget */
- //@ non_null
- protected String tooltip;
-
- /**
- * The protected constructor used by derived classes
- * @param key The name used as a preference key
- * @param label A short description suitable as a label
- * @param tooltip A longer description suitable as help
- */
- protected AbstractPreference(String key, String label, String tooltip) {
- this.key = key;
- this.label = label;
- this.tooltip = tooltip;
- }
-
- /** An interface for the listeners that are fired when options change.*/
- static public interface Listener {
- /** The method executed when the listener is notified. */
- public void run();
- }
-
- /** The listeners that will be notified when options change (through the workspace preferences dialog). */
- static private Collection listeners = new LinkedList();
-
- /** Adds a listener to the collection of listeners.
- *
- * @param l Listener to be added
- */
- static synchronized public void addListener(Listener l) {
- listeners.add(l);
- }
-
- /** Adds a listener to the collection of listeners.
- *
- * @param l Listener to be removed
- */
- static synchronized public void removeListener(Listener l) {
- listeners.remove(l);
- }
-
- /** Executes all listeners */
- static synchronized public void notifyListeners() {
- for (Listener i: listeners) {
- i.run();
- }
- }
-
- /** Returns the key string
- * @return the key
- */
- public String key() { return key; }
-
- /** Returns the label string (short description) for this option
- *
- * @return the label string
- */
- public String label() { return label; }
-
- /** Returns the help string for this option
- *
- * @return the help string
- */
- public String tooltip() { return tooltip; }
-
- /** Sets the option to its default value */
- public void setToDefault() {
- preferenceStore().setToDefault(key);
- }
-
- /** An option that has a boolean value */
- static public class BooleanOption extends AbstractPreference {
-
- /**
- * Creating a boolean option object
- * @param key The name used as a preference key
- * @param def The default value used if no value is previously stored
- * @param label A short description usable as a label
- * @param tooltip A long description usable as help
- */
- public BooleanOption(String key, boolean def,
- String label, String tooltip) {
- super(key,label,tooltip);
- preferenceStore().setDefault(key,def);
- }
-
- /**
- * Returns the current value of the option
- * @return The current value of the option
- */
- public boolean getValue() { return preferenceStore().getBoolean(key); }
-
- /**
- * Sets the workspace property value to the given value.
- *
- * @param b The value to set
- */
- public void setValue(boolean b) { preferenceStore().setValue(key,b); }
-
- /** Returns the default value of the preference
- * @return the default value of the preference
- */
- public boolean getDefault() {
- return preferenceStore().getDefaultBoolean(key);
- }
-
- }
-
- /** An option that has a int value */
- static public class IntOption extends AbstractPreference {
-
- /**
- * Creating a int option object
- * @param key The name used as a preference key
- * @param def The default value used if no value is previously stored
- * @param label A short description usable as a label
- * @param tooltip A long description usable as help
- */
- public IntOption(String key, int def,
- String label, String tooltip) {
- super(key,label,tooltip);
- preferenceStore().setDefault(key,def);
- }
-
- /**
- * Returns the current value of the option
- * @return The current value of the option
- */
- public int getValue() { return preferenceStore().getInt(key); }
-
- /**
- * Sets the workspace property value to the given value.
- *
- * @param i The value to set
- */
- public void setValue(int i) { preferenceStore().setValue(key,i); }
-
- /** Returns the default value of the preference
- * @return the default value of the preference
- */
- public int getDefault() {
- return preferenceStore().getDefaultInt(key);
- }
-
- }
-
- /** An option that has a String value */
- static public class StringOption extends AbstractPreference {
-
- /**
- * Creating a String option object
- * @param key The qualified name used as a property key
- * @param def The default value used if no value is previously stored
- * @param label A short description usable as a label
- * @param tooltip A long description usable as help
- */
- public StringOption(String key, String def,
- String label, String tooltip) {
- super(key,label,tooltip);
- if (def != null) preferenceStore().setDefault(key,def);
- }
-
- /** Returns the default value of the preference
- * @return the default value of the preference
- */
- public String getDefault() {
- return preferenceStore().getDefaultString(key);
- }
-
- /**
- * Returns the current value of the option
- * @return The current value of the option
- */
- public String getValue() { return preferenceStore().getString(key); }
-
- /**
- * Sets the option value to the given value.
- *
- * @param v The value to set
- */
- public void setValue(String v) { preferenceStore().setValue(key,v); }
- }
-
- /** An option that has one of a set of Strings as its value */
- static public class ChoiceOption extends AbstractPreference {
-
- /** The choices */
- protected String[] choices;
-
- /**
- * Creating a String option object
- * @param key The name used as a preference key
- * @param def The default value used if no value is previously stored (an index into the array of choices)
- * @param choices The choices (as Strings) to be chosen among
- * @param label A short description usable as a label
- * @param tooltip A long description usable as help
- */
- public ChoiceOption(String key, String[] choices,
- int def,
- String label, String tooltip) {
- super(key,label,tooltip);
- preferenceStore().setDefault(key,choices[def]);
- this.choices = choices;
- }
-
- /** Returns the array of choices; this array should not be modified.
- *
- * @return the array of choices
- */
- public String[] choices() { return choices; }
-
- /** Returns the default value of the preference
- * @return the default value of the preference
- */
- public String getDefault() {
- return preferenceStore().getDefaultString(key);
- }
-
- /** Returns the default value of the preference
- * @return the default value of the preference
- */
- public int getDefaultIndex() {
- return lookup(preferenceStore().getDefaultString(key));
- }
-
- /**
- * Returns the current value of the option
- * @return The current value of the option
- */
- public int getIndexValue() {
- String r = preferenceStore().getString(key);
- return lookup(r);
- }
-
- /**
- * Returns the current value of the option
- * @return The current value of the option
- */
- public String getStringValue() {
- return preferenceStore().getString(key);
- }
-
- /**
- * Sets the option value to the given value.
- *
- * @param v The String value to set
- */
- public void setValue(String v) { preferenceStore().setValue(key,v); }
-
- /**
- * Sets the option value to the given value.
- *
- * @param i The index value to set
- */
- //@ requires 0<=i && i choices[\result].equals(s);
- //@ ensures \result == -1 ==> (\forall int i; 0<=i && i listeners = new LinkedList();
+
+ /** Adds a listener to the collection of listeners.
+ *
+ * @param l Listener to be added
+ */
+ static synchronized public void addListener(Listener l) {
+ listeners.add(l);
+ }
+
+ /** Adds a listener to the collection of listeners.
+ *
+ * @param l Listener to be removed
+ */
+ static synchronized public void removeListener(Listener l) {
+ listeners.remove(l);
+ }
+
+ /** Executes all listeners */
+ static synchronized public void notifyListeners() {
+ for (Listener i: listeners) {
+ i.run();
+ }
+ }
+
+ /** Returns the key string
+ * @return the key
+ */
+ public String key() { return key; }
+
+ /** Returns the label string (short description) for this option
+ *
+ * @return the label string
+ */
+ public String label() { return label; }
+
+ /** Returns the help string for this option
+ *
+ * @return the help string
+ */
+ public String tooltip() { return tooltip; }
+
+ /** Sets the option to its default value */
+ public void setToDefault() {
+ preferenceStore().setToDefault(key);
+ }
+
+ /** An option that has a boolean value */
+ static public class BooleanOption extends AbstractPreference {
+
+ /**
+ * Creating a boolean option object
+ * @param key The name used as a preference key
+ * @param def The default value used if no value is previously stored
+ * @param label A short description usable as a label
+ * @param tooltip A long description usable as help
+ */
+ public BooleanOption(String key, boolean def,
+ String label, String tooltip) {
+ super(key,label,tooltip);
+ preferenceStore().setDefault(key,def);
+ }
+
+ /**
+ * Returns the current value of the option
+ * @return The current value of the option
+ */
+ public boolean getValue() { return preferenceStore().getBoolean(key); }
+
+ /**
+ * Sets the workspace property value to the given value.
+ *
+ * @param b The value to set
+ */
+ public void setValue(boolean b) { preferenceStore().setValue(key,b); }
+
+ /** Returns the default value of the preference
+ * @return the default value of the preference
+ */
+ public boolean getDefault() {
+ return preferenceStore().getDefaultBoolean(key);
+ }
+
+ }
+
+ /** An option that has a int value */
+ static public class IntOption extends AbstractPreference {
+
+ /**
+ * Creating a int option object
+ * @param key The name used as a preference key
+ * @param def The default value used if no value is previously stored
+ * @param label A short description usable as a label
+ * @param tooltip A long description usable as help
+ */
+ public IntOption(String key, int def,
+ String label, String tooltip) {
+ super(key,label,tooltip);
+ preferenceStore().setDefault(key,def);
+ }
+
+ /**
+ * Returns the current value of the option
+ * @return The current value of the option
+ */
+ public int getValue() { return preferenceStore().getInt(key); }
+
+ /**
+ * Sets the workspace property value to the given value.
+ *
+ * @param i The value to set
+ */
+ public void setValue(int i) { preferenceStore().setValue(key,i); }
+
+ /** Returns the default value of the preference
+ * @return the default value of the preference
+ */
+ public int getDefault() {
+ return preferenceStore().getDefaultInt(key);
+ }
+
+ }
+
+ /** An option that has a String value */
+ static public class StringOption extends AbstractPreference {
+
+ /**
+ * Creating a String option object
+ * @param key The qualified name used as a property key
+ * @param def The default value used if no value is previously stored
+ * @param label A short description usable as a label
+ * @param tooltip A long description usable as help
+ */
+ public StringOption(String key, String def,
+ String label, String tooltip) {
+ super(key,label,tooltip);
+ if (def != null) preferenceStore().setDefault(key,def);
+ }
+
+ /** Returns the default value of the preference
+ * @return the default value of the preference
+ */
+ public String getDefault() {
+ return preferenceStore().getDefaultString(key);
+ }
+
+ /**
+ * Returns the current value of the option
+ * @return The current value of the option
+ */
+ public String getValue() { return preferenceStore().getString(key); }
+
+ /**
+ * Sets the option value to the given value.
+ *
+ * @param v The value to set
+ */
+ public void setValue(String v) { preferenceStore().setValue(key,v); }
+ }
+
+ /** An option that has one of a set of Strings as its value */
+ static public class ChoiceOption extends AbstractPreference {
+
+ /** The choices */
+ protected String[] choices;
+
+ /**
+ * Creating a String option object
+ * @param key The name used as a preference key
+ * @param def The default value used if no value is previously stored (an index into the array of choices)
+ * @param choices The choices (as Strings) to be chosen among
+ * @param label A short description usable as a label
+ * @param tooltip A long description usable as help
+ */
+ public ChoiceOption(String key, String[] choices,
+ int def,
+ String label, String tooltip) {
+ super(key,label,tooltip);
+ preferenceStore().setDefault(key,choices[def]);
+ this.choices = choices;
+ }
+
+ /** Returns the array of choices; this array should not be modified.
+ *
+ * @return the array of choices
+ */
+ public String[] choices() { return choices; }
+
+ /** Returns the default value of the preference
+ * @return the default value of the preference
+ */
+ public String getDefault() {
+ return preferenceStore().getDefaultString(key);
+ }
+
+ /** Returns the default value of the preference
+ * @return the default value of the preference
+ */
+ public int getDefaultIndex() {
+ return lookup(preferenceStore().getDefaultString(key));
+ }
+
+ /**
+ * Returns the current value of the option
+ * @return The current value of the option
+ */
+ public int getIndexValue() {
+ String r = preferenceStore().getString(key);
+ return lookup(r);
+ }
+
+ /**
+ * Returns the current value of the option
+ * @return The current value of the option
+ */
+ public String getStringValue() {
+ return preferenceStore().getString(key);
+ }
+
+ /**
+ * Sets the option value to the given value.
+ *
+ * @param v The String value to set
+ */
+ public void setValue(String v) { preferenceStore().setValue(key,v); }
+
+ /**
+ * Sets the option value to the given value.
+ *
+ * @param i The index value to set
+ */
+ //@ requires 0<=i && i choices[\result].equals(s);
+ //@ ensures \result == -1 ==> (\forall int i; 0<=i && i
- * I would have thought that the non-plugin functionality of (a) exporting
- * logics directory and (b) finding the logic files on the classpath
- * would work - but I have not been able to make that function. Thus
- * we need one mechanism for finding resources inside a plug-in (this
- * one - with reference to the plug-in bundle) and another mechanism
- * (looking on the classpath) when one is not inside a plug-in.
- */
- SMT.logicFinder = new SMT.ILogicFinder() {
- @Override
- public InputStream find(SMT.Configuration smtConfig, String name, IPos pos) throws java.io.IOException {
- if (smtConfig == null || smtConfig.logicPath == null || smtConfig.logicPath.trim().length() ==0) {
- // Note that the following logic depends on the fact that the
- // logic definition files (e.g., QF_UF.smt2) reside at the
- // root of the plugin that holds the SMT application (not
- // this plugin which is for the UI). They get there because
- // they are copied into the bin directory as part of the
- // build. The application depends on them being on the
- // classpath.
- URL url = Platform.getBundle(org.smtlib.Utils.PLUGIN_ID).getResource(name + org.smtlib.Utils.SUFFIX);
- if (Activator.verbose) Activator.log.logln("Finding logic file " + name + " " + url);
- if (url != null) {
- InputStream stream = url.openStream();
- if (stream != null) return stream;
- if (smtConfig==null) Activator.utils.showMessageInUI(null,"SMT: ViewLogic",
- "No logic file found for " + name + " as " + url);
- else smtConfig.log.logError(smtConfig.responseFactory.error("No logic file found for " + name + " as " + url, pos));
- } else {
- if (smtConfig==null) Activator.utils.showMessageInUI(null,"SMT: ViewLogic",
- "No logic file found for " + name);
- else smtConfig.log.logError(smtConfig.responseFactory.error("No logic file found for " + name, pos));
- }
- return null;
- } else {
- String fname = smtConfig.logicPath + File.separator + name + org.smtlib.Utils.SUFFIX;
- File f = new File(fname);
- if (Activator.verbose) Activator.log.logln("Finding logic file " + name + " " + fname);
- if (!f.isFile()) {
- smtConfig.log.logError(smtConfig.responseFactory.error("No logic file found for " + name + " as " + f.getPath(), pos));
- return null;
- }
- return new FileInputStream(f);
- }
- }
- };
-
- if (verbose) Activator.log.logln("SMT UI plugin started");
-
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- /*@NonNull*//*@Pure*/
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*
+ * This file is part of the SMT plugin project.
+ * Copyright 2010 David R. Cok
+ * Created August 2010
+ */
+package org.smtlib.plugin;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+import org.smtlib.SMT;
+
+import java.io.*;
+import java.net.URL;
+
+import org.smtlib.IPos;
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /** The plug-in Symbol - must match what is in plugin.xml */
+ public static final String PLUGIN_ID = "org.smtlib.plugin.SMTPlugin"; //$NON-NLS-1$
+
+ /** The shared (singleton) instance of the plugin, initialized on construction */
+ /*@NonNull*/
+ private static Activator plugin;
+
+ /** The shared instance of the plug-in utils methods */
+ /*@NonNull*/
+ public static Utils utils;
+
+ /** The shared instance of a plug-in Log for the whole plug-in */
+ /*@NonNull*/
+ public static Log log;
+
+ /** A shared instance of the SMT configuration */
+ public static org.smtlib.SMT.Configuration smtConfiguration = null;//new org.smtlib.SMT.Configuration();
+
+ /** The option to print out verbose diagnostic information for the plug-in*/
+ public static boolean verbose = false;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ plugin = this;
+ utils = new Utils();
+ log = new Log();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ // Initialize the configuration
+ smtConfiguration = Preferences.extractOptions(null);
+ // Creates a new console and sets it to hear plugin log messages
+ ConsoleLogger console = new ConsoleLogger("SMT Console");
+ Activator.log.setListener(console);
+ // Set the console to hear all the SMT application messages as well
+ smtConfiguration.log.clearListeners(); // This removes the standard listener that would otherwise send log information to the console
+ smtConfiguration.log.addListener(console);
+ // Sets a problem listener to hear application error log messages, so they can become problem markers
+ smtConfiguration.log.addListener(new ProblemListener());
+
+ // Listens for Preference page changes and updates the SMT Configuration accordingly
+ AbstractPreference.addListener(new AbstractPreference.Listener() {
+ @Override
+ public void run() {
+ // The following line also extracts and sets Activator.verbose
+ smtConfiguration = Preferences.extractOptions(smtConfiguration);
+ }
+ });
+
+ /** The logic file finder for the plug-in looks for a logic file with the given name:
+ * (a) if no logic directory path is set, then it looks within the SMT plugin itself for any built-in files
+ * (b) if a logic directory path is set, it looks there.
+ *
+ * I would have thought that the non-plugin functionality of (a) exporting
+ * logics directory and (b) finding the logic files on the classpath
+ * would work - but I have not been able to make that function. Thus
+ * we need one mechanism for finding resources inside a plug-in (this
+ * one - with reference to the plug-in bundle) and another mechanism
+ * (looking on the classpath) when one is not inside a plug-in.
+ */
+ SMT.logicFinder = new SMT.ILogicFinder() {
+ @Override
+ public InputStream find(SMT.Configuration smtConfig, String name, IPos pos) throws java.io.IOException {
+ if (smtConfig == null || smtConfig.logicPath == null || smtConfig.logicPath.trim().length() ==0) {
+ // Note that the following logic depends on the fact that the
+ // logic definition files (e.g., QF_UF.smt2) reside at the
+ // root of the plugin that holds the SMT application (not
+ // this plugin which is for the UI). They get there because
+ // they are copied into the bin directory as part of the
+ // build. The application depends on them being on the
+ // classpath.
+ URL url = Platform.getBundle(org.smtlib.Utils.PLUGIN_ID).getResource(name + org.smtlib.Utils.SUFFIX);
+ if (Activator.verbose) Activator.log.logln("Finding logic file " + name + " " + url);
+ if (url != null) {
+ InputStream stream = url.openStream();
+ if (stream != null) return stream;
+ if (smtConfig==null) Activator.utils.showMessageInUI(null,"SMT: ViewLogic",
+ "No logic file found for " + name + " as " + url);
+ else smtConfig.log.logError(smtConfig.responseFactory.error("No logic file found for " + name + " as " + url, pos));
+ } else {
+ if (smtConfig==null) Activator.utils.showMessageInUI(null,"SMT: ViewLogic",
+ "No logic file found for " + name);
+ else smtConfig.log.logError(smtConfig.responseFactory.error("No logic file found for " + name, pos));
+ }
+ return null;
+ } else {
+ String fname = smtConfig.logicPath + File.separator + name + org.smtlib.Utils.SUFFIX;
+ File f = new File(fname);
+ if (Activator.verbose) Activator.log.logln("Finding logic file " + name + " " + fname);
+ if (!f.isFile()) {
+ smtConfig.log.logError(smtConfig.responseFactory.error("No logic file found for " + name + " as " + f.getPath(), pos));
+ return null;
+ }
+ return new FileInputStream(f);
+ }
+ }
+ };
+
+ if (verbose) Activator.log.logln("SMT UI plugin started");
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ /*@NonNull*//*@Pure*/
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/ConsoleLogger.java b/SMTPlugin/src/org/smtlib/plugin/ConsoleLogger.java
index 6db176a..c2ed9a2 100644
--- a/SMTPlugin/src/org/smtlib/plugin/ConsoleLogger.java
+++ b/SMTPlugin/src/org/smtlib/plugin/ConsoleLogger.java
@@ -1,224 +1,224 @@
-/*
- * This file is part of the SMT plugin project.
- * Copyright 2010 David R. Cok
- * Created August 2010
- */
-package org.smtlib.plugin;
-
-import java.io.IOException;
-import java.io.PrintStream;
-
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleManager;
-import org.eclipse.ui.console.MessageConsole;
-import org.eclipse.ui.console.MessageConsoleStream;
-import org.smtlib.IResponse;
-
-/** This class provides Log.IListener implementation that listens
- * to messages written through methods in the plug-in Log and sends them to the Eclipse console;
- * also listens to messages written through the application log.
- */
-public class ConsoleLogger implements org.smtlib.plugin.Log.IListener, org.smtlib.Log.IListener {
-
- /** Creates a new ConsoleLogger utility object
- *
- * @param consoleName The name of the console to be logged to
- */
- //@ requires consoleName != null;
- //@ requires Activator.plugin != null;
- //@ modifies \nothing;
- //@ ensures \result.consoleName == consoleName;
- public ConsoleLogger(/*@NonNull*/ String consoleName) {
- this.consoleName = consoleName;
- Plugin plugin = Activator.getDefault();
- this.pluginLog = plugin.getLog();
- this.pluginID = plugin.getBundle().getSymbolicName();
- }
-
- // This model variable models the content of the material
- // sent to the log.
- //@ model public String content;
-
- /** The name of the console that this plugin writes to. */
- //@ constraint \not_modified(consoleName);
- //@ spec_public
- //@ non_null
- /*@NonNull*/
- final private String consoleName;
-
- /** The ILog of the plugin that this ConsoleLogger object connects to */
- //@ constraint \not_modified(pluginLog);
- //@ invariant pluginLog != null;
- //@ spec_public
- final private ILog pluginLog;
-
- /** The id of the plugin using this log */
- //@ constraint \not_modified(pluginID);
- //@ invariant pluginID != null;
- //@ spec_public
- /*@NonNull*/
- final private String pluginID;
-
- /** Cached value of the stream to use to write to the console */
- /*@Nullable*/
- private MessageConsoleStream stream = null;
- //@ private constraint \old(stream) != null ==> \not_modified(stream);
-
- /** The associated PrintStream, lazily initialized */
- /*@Nullable*/
- private PrintStream printStream = null;
-
- /** Creates, if necessary, and returns an instance of
- * the stream to use to write to the console
- * @return The stream value to use
- */
- //@ modifies stream;
- //@ ensures \result != null;
- //@ ensures \result == stream;
- public MessageConsoleStream getConsoleStream() {
- if (stream == null) {
- /*@Mutable*/ MessageConsole console = null;
- IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
- /*@Mutable*/ IConsole[] existing = consoleManager.getConsoles();
- for (int i=0; i \not_modified(stream);
+
+ /** The associated PrintStream, lazily initialized */
+ /*@Nullable*/
+ private PrintStream printStream = null;
+
+ /** Creates, if necessary, and returns an instance of
+ * the stream to use to write to the console
+ * @return The stream value to use
+ */
+ //@ modifies stream;
+ //@ ensures \result != null;
+ //@ ensures \result == stream;
+ public MessageConsoleStream getConsoleStream() {
+ if (stream == null) {
+ /*@Mutable*/ MessageConsole console = null;
+ IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
+ /*@Mutable*/ IConsole[] existing = consoleManager.getConsoles();
+ for (int i=0; i solvers = Activator.utils.getSolvers(action.getId());
- List files = Activator.utils.getSelectedFiles(selection,null,shell);
- Activator.utils.text = null; // TODO - setting 'text' through side-effects is a bad design
- if (files.isEmpty()) files = Activator.utils.resources(selection,null,shell); // sets Activator.utils.text also
- if (files.isEmpty()) {
- Activator.utils.showMessageInUI(shell,"SMT Run Solver",
- "Failed to find a resource on which to run a solver (select one or more files or an editor)");
- return;
- }
- Activator.utils.runJobs(solvers,files);
- } catch (Exception e) {
- Activator.utils.topLevelException(shell,"ContextAction.RunSolver",e);
- }
- }
- }
-
-
- /** Deletes SMT markers on selected resources */
- static public class DeleteMarkers extends ContextAction {
- /**
- * @see IActionDelegate#run(IAction)
- */
- @Override
- public void run(IAction action) {
- try {
- Activator.utils.deleteMarkersInSelection(selection,null,shell);
- } catch (Exception e) {
- Activator.utils.topLevelException(shell,"ContextAction.DeleteMarkers",e);
- }
- }
- }
-
-// Not included because the ViewLogic command uses selected text; it does not make sense
-// to run it on a file.
-// /** Shows the content of the SMT logic or theory whose name is selected */
-// static public class ViewLogic extends ContextAction {
-// /**
-// * @see IActionDelegate#run(IAction)
-// */
-// public void run(IAction action) {
-// Activator.utils.viewLogic(shell,selection);
-// }
-// }
-
-}
-
+/*
+ * This file is part of the SMT plugin project.
+ * Copyright 2010 David R. Cok
+ * Created August 2010
+ */
+package org.smtlib.plugin;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/** This class is an abstract base class for implementing popup menu item actions.
+ * @author David R. Cok
+ */
+abstract public class ContextAction implements IObjectActionDelegate {
+ /** A cached value of the most recent selection */
+ /*@Nullable*/ protected ISelection selection;
+
+ /** A cached value of the shell that holds the most recent editor (actually IWorkbenchPart) */
+ /*@Nullable*/ protected Shell shell;
+
+ /**
+ * Constructor, with no initialization
+ */
+ public ContextAction() {
+ super();
+ }
+
+ /**
+ * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
+ */
+ //@ ensures this.shell != null;
+ @Override
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ shell = targetPart.getSite().getShell();
+ }
+
+ /**
+ * @see IActionDelegate#run(IAction)
+ */
+ @Override
+ abstract public void run(IAction action);
+
+ /**
+ * @see IActionDelegate#selectionChanged(IAction, ISelection)
+ */
+ //@ ensures this.selection != null;
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ }
+
+ /** Runs the default solver on the selected files */
+ static public class RunSolver extends ContextAction {
+ /**
+ * @see IActionDelegate#run(IAction)
+ */
+ @Override
+ public void run(IAction action) {
+ try {
+ final List solvers = Activator.utils.getSolvers(action.getId());
+ List files = Activator.utils.getSelectedFiles(selection,null,shell);
+ Activator.utils.text = null; // TODO - setting 'text' through side-effects is a bad design
+ if (files.isEmpty()) files = Activator.utils.resources(selection,null,shell); // sets Activator.utils.text also
+ if (files.isEmpty()) {
+ Activator.utils.showMessageInUI(shell,"SMT Run Solver",
+ "Failed to find a resource on which to run a solver (select one or more files or an editor)");
+ return;
+ }
+ Activator.utils.runJobs(solvers,files);
+ } catch (Exception e) {
+ Activator.utils.topLevelException(shell,"ContextAction.RunSolver",e);
+ }
+ }
+ }
+
+
+ /** Deletes SMT markers on selected resources */
+ static public class DeleteMarkers extends ContextAction {
+ /**
+ * @see IActionDelegate#run(IAction)
+ */
+ @Override
+ public void run(IAction action) {
+ try {
+ Activator.utils.deleteMarkersInSelection(selection,null,shell);
+ } catch (Exception e) {
+ Activator.utils.topLevelException(shell,"ContextAction.DeleteMarkers",e);
+ }
+ }
+ }
+
+// Not included because the ViewLogic command uses selected text; it does not make sense
+// to run it on a file.
+// /** Shows the content of the SMT logic or theory whose name is selected */
+// static public class ViewLogic extends ContextAction {
+// /**
+// * @see IActionDelegate#run(IAction)
+// */
+// public void run(IAction action) {
+// Activator.utils.viewLogic(shell,selection);
+// }
+// }
+
+}
+
diff --git a/SMTPlugin/src/org/smtlib/plugin/Log.java b/SMTPlugin/src/org/smtlib/plugin/Log.java
index f1b41e6..6d9c359 100644
--- a/SMTPlugin/src/org/smtlib/plugin/Log.java
+++ b/SMTPlugin/src/org/smtlib/plugin/Log.java
@@ -1,65 +1,65 @@
-/*
- * This file is part of the SMT plugin project.
- * Copyright 2010 David R. Cok
- * Created August 2010
- */
-package org.smtlib.plugin;
-
-/** All log messages from the plug-in are sent to this class. */
-public class Log {
-
- /** An interface for objects that want to receive any plug-in log messages */
- public static interface IListener {
- /** Called when a log message is recorded in the log (listener should NOT add line separator). */
- public void log(String msg);
-
- /** Called when a log message is recorded in the log (listener should add line separator). */
- public void logln(String msg);
-
- /** Called when an error message is recorded in the log (listener should add line separator). */
- public void errorlog(String msg, /*@Nullable*/ Throwable e);
- }
-
- /**
- * Called to record an ordinary message; notifies any listeners;
- * if no listeners, simply writes to System.out (no line separator added)
- */
- public void log(String s) {
- if (listener != null)
- listener.log(s);
- else
- System.out.print(s);
- }
-
- /**
- * Called to record an ordinary message; notifies any listeners;
- * if no listeners, simply writes to System.out (line separator added)
- */
- public void logln(String s) {
- if (listener != null) {
- listener.logln(s);
- } else
- System.out.println(s);
- }
-
- /**
- * Called to record an error message; notifies any listeners;
- * if no listeners, simply writes to System.out; adds line separator
- */
- public void errorlog(String s, Throwable e) {
- if (listener != null)
- listener.errorlog(s,e);
- else
- System.out.println(s);
- }
-
- /** The (at most) one listener */
- /*@Nullable */
- public IListener listener = null;
-
- /** Adds a listener to the log - only one listener is allowed */
- public void setListener(IListener l) {
- listener = l;
- }
-
-}
+/*
+ * This file is part of the SMT plugin project.
+ * Copyright 2010 David R. Cok
+ * Created August 2010
+ */
+package org.smtlib.plugin;
+
+/** All log messages from the plug-in are sent to this class. */
+public class Log {
+
+ /** An interface for objects that want to receive any plug-in log messages */
+ public static interface IListener {
+ /** Called when a log message is recorded in the log (listener should NOT add line separator). */
+ public void log(String msg);
+
+ /** Called when a log message is recorded in the log (listener should add line separator). */
+ public void logln(String msg);
+
+ /** Called when an error message is recorded in the log (listener should add line separator). */
+ public void errorlog(String msg, /*@Nullable*/ Throwable e);
+ }
+
+ /**
+ * Called to record an ordinary message; notifies any listeners;
+ * if no listeners, simply writes to System.out (no line separator added)
+ */
+ public void log(String s) {
+ if (listener != null)
+ listener.log(s);
+ else
+ System.out.print(s);
+ }
+
+ /**
+ * Called to record an ordinary message; notifies any listeners;
+ * if no listeners, simply writes to System.out (line separator added)
+ */
+ public void logln(String s) {
+ if (listener != null) {
+ listener.logln(s);
+ } else
+ System.out.println(s);
+ }
+
+ /**
+ * Called to record an error message; notifies any listeners;
+ * if no listeners, simply writes to System.out; adds line separator
+ */
+ public void errorlog(String s, Throwable e) {
+ if (listener != null)
+ listener.errorlog(s,e);
+ else
+ System.out.println(s);
+ }
+
+ /** The (at most) one listener */
+ /*@Nullable */
+ public IListener listener = null;
+
+ /** Adds a listener to the log - only one listener is allowed */
+ public void setListener(IListener l) {
+ listener = l;
+ }
+
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/MenuActions.java b/SMTPlugin/src/org/smtlib/plugin/MenuActions.java
index 077ce2a..31e37cb 100644
--- a/SMTPlugin/src/org/smtlib/plugin/MenuActions.java
+++ b/SMTPlugin/src/org/smtlib/plugin/MenuActions.java
@@ -1,136 +1,136 @@
-/*
- * This file is part of the SMT plugin project.
- * Copyright 2010 David R. Cok
- * Created August 2010
- */
-package org.smtlib.plugin;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * This class holds the implementations of the utils in response to
- * menu items in the menubar and toolbar
- */
-abstract public class MenuActions implements IWorkbenchWindowActionDelegate {
-
- // IWorkbenchWindowActionDelegate is the interface for actions that
- // are contributed as menubar or toolbar items
-
- /** Caches the value of the window, when informed of it. */
- /*@Nullable*/ protected IWorkbenchWindow window;
-
- /** Caches the value of the shell in which the window exists. */
- /*@Nullable*/ protected Shell shell = null;
-
- /** The current selection. */
- /*@Nullable*/ protected ISelection selection;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- //@ ensures this.selection != null;
- //JAVA16 @Override
- public final void selectionChanged(final IAction action, final ISelection selection) {
- this.selection = selection;
- }
-
- /**
- * We can use this method to dispose of any system
- * resources we previously allocated.
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- //JAVA16 @Override
- public void dispose() {
- }
-
- /**
- * We will cache window object in order to
- * be able to provide a parent shell for the message dialog.
- * @param window The parent window
- * @see IWorkbenchWindowActionDelegate#init
- */
- //JAVA16 @Override
- public void init(IWorkbenchWindow window) {
- this.window = window;
- this.shell = window.getShell();
- }
-
- /** Called by the system in response to a menu selection (or other command).
- * This should be overridden for individual menu items.
- */
- //JAVA16 @Override
- abstract public void run(final IAction action);
-
- /**
- * This class implements the action for checking
- * JML in the selected objects (which may be working sets, folders,
- * or java files). Applying the operation
- * to a container applies it to all its contents recursively.
- * The checks are done in a non-UI thread.
- *
- * @author David R. Cok
- */
- public static class RunSolver extends MenuActions {
-
- @Override
- public final void run(final IAction action) {
- try {
- final List solvers = Activator.utils.getSolvers(action.getId());
- List files = Activator.utils.getSelectedFiles(selection,window,shell);
- Activator.utils.text = null; // TODO - setting 'text' through side-effects is a bad design
- if (files.isEmpty()) files = Activator.utils.resources(selection,window,shell); // sets Activator.utils.text also
- if (files.isEmpty()) {
- Activator.utils.showMessageInUI(shell,"SMT Run Solver",
- "Failed to find a resource on which to run a solver (select one or more files or an editor)");
- return;
- }
- Activator.utils.runJobs(solvers,files);
- } catch (Exception e) {
- Activator.utils.topLevelException(shell,"MenuActions.RunSolver",e);
- }
-
- }
- }
-
- /**
- * This class implements the action that clears
- * SMT markers. It is performed entirely in the UI thread, with no
- * progress reporting. Its ought to be fast.
- *
- * @author David R. Cok
- */
- public static class DeleteMarkers extends MenuActions {
- @Override
- public final void run(final IAction action) {
- try {
- Activator.utils.deleteMarkersInSelection(selection,window,shell);
- } catch (Exception e) {
- Activator.utils.topLevelException(shell,"MenuActions.DeleteMarkers",e);
- }
- }
- }
-
- /** Shows the content of the SMT logic or theory whose name is selected */
- public static class ViewLogic extends MenuActions {
- @Override
- public final void run(final IAction action) {
- Activator.utils.viewLogic(shell,selection);
- }
- }
-
- /** Does a get-value command on the selected text */
- public static class GetValue extends MenuActions {
- @Override
- public final void run(final IAction action) {
- Activator.utils.getValue(shell,selection);
- }
- }
-
-}
+/*
+ * This file is part of the SMT plugin project.
+ * Copyright 2010 David R. Cok
+ * Created August 2010
+ */
+package org.smtlib.plugin;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * This class holds the implementations of the utils in response to
+ * menu items in the menubar and toolbar
+ */
+abstract public class MenuActions implements IWorkbenchWindowActionDelegate {
+
+ // IWorkbenchWindowActionDelegate is the interface for actions that
+ // are contributed as menubar or toolbar items
+
+ /** Caches the value of the window, when informed of it. */
+ /*@Nullable*/ protected IWorkbenchWindow window;
+
+ /** Caches the value of the shell in which the window exists. */
+ /*@Nullable*/ protected Shell shell = null;
+
+ /** The current selection. */
+ /*@Nullable*/ protected ISelection selection;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ //@ ensures this.selection != null;
+ //JAVA16 @Override
+ public final void selectionChanged(final IAction action, final ISelection selection) {
+ this.selection = selection;
+ }
+
+ /**
+ * We can use this method to dispose of any system
+ * resources we previously allocated.
+ * @see IWorkbenchWindowActionDelegate#dispose
+ */
+ //JAVA16 @Override
+ public void dispose() {
+ }
+
+ /**
+ * We will cache window object in order to
+ * be able to provide a parent shell for the message dialog.
+ * @param window The parent window
+ * @see IWorkbenchWindowActionDelegate#init
+ */
+ //JAVA16 @Override
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ this.shell = window.getShell();
+ }
+
+ /** Called by the system in response to a menu selection (or other command).
+ * This should be overridden for individual menu items.
+ */
+ //JAVA16 @Override
+ abstract public void run(final IAction action);
+
+ /**
+ * This class implements the action for checking
+ * JML in the selected objects (which may be working sets, folders,
+ * or java files). Applying the operation
+ * to a container applies it to all its contents recursively.
+ * The checks are done in a non-UI thread.
+ *
+ * @author David R. Cok
+ */
+ public static class RunSolver extends MenuActions {
+
+ @Override
+ public final void run(final IAction action) {
+ try {
+ final List solvers = Activator.utils.getSolvers(action.getId());
+ List files = Activator.utils.getSelectedFiles(selection,window,shell);
+ Activator.utils.text = null; // TODO - setting 'text' through side-effects is a bad design
+ if (files.isEmpty()) files = Activator.utils.resources(selection,window,shell); // sets Activator.utils.text also
+ if (files.isEmpty()) {
+ Activator.utils.showMessageInUI(shell,"SMT Run Solver",
+ "Failed to find a resource on which to run a solver (select one or more files or an editor)");
+ return;
+ }
+ Activator.utils.runJobs(solvers,files);
+ } catch (Exception e) {
+ Activator.utils.topLevelException(shell,"MenuActions.RunSolver",e);
+ }
+
+ }
+ }
+
+ /**
+ * This class implements the action that clears
+ * SMT markers. It is performed entirely in the UI thread, with no
+ * progress reporting. Its ought to be fast.
+ *
+ * @author David R. Cok
+ */
+ public static class DeleteMarkers extends MenuActions {
+ @Override
+ public final void run(final IAction action) {
+ try {
+ Activator.utils.deleteMarkersInSelection(selection,window,shell);
+ } catch (Exception e) {
+ Activator.utils.topLevelException(shell,"MenuActions.DeleteMarkers",e);
+ }
+ }
+ }
+
+ /** Shows the content of the SMT logic or theory whose name is selected */
+ public static class ViewLogic extends MenuActions {
+ @Override
+ public final void run(final IAction action) {
+ Activator.utils.viewLogic(shell,selection);
+ }
+ }
+
+ /** Does a get-value command on the selected text */
+ public static class GetValue extends MenuActions {
+ @Override
+ public final void run(final IAction action) {
+ Activator.utils.getValue(shell,selection);
+ }
+ }
+
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/PreferenceWidget.java b/SMTPlugin/src/org/smtlib/plugin/PreferenceWidget.java
index acbf870..e4e64f2 100644
--- a/SMTPlugin/src/org/smtlib/plugin/PreferenceWidget.java
+++ b/SMTPlugin/src/org/smtlib/plugin/PreferenceWidget.java
@@ -1,562 +1,562 @@
-/*
- * This file is part of the SMT plugin project.
- * Copyright 2010 David R. Cok
- * Created August 2010
- */
-package org.smtlib.plugin;
-
-// FIXME : Needs a color selection widget
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This class is a base class for the controls that are used in
- * the property page; each control is connected to an Option object.
- *
- * @author David Cok
- *
- */
-abstract public class PreferenceWidget {
-
- /** The option object represented by this PreferenceWidget */
- /*@Nullable*/ AbstractPreference option;
-
-
- /**
- * Base class constructor, taking some common arguments.
- *
- * @param option The option that this widget represents.
- */
- public PreferenceWidget(/*@Nullable*/ AbstractPreference option) {
- this.option = option;
- }
-
- /**
- * Creates and adds the widget to the given control
- * @param parent The composite to add the widget to.
- */
- abstract public void addWidget(Composite parent);
-
- /**
- * Sets the UI widget to the built-in default value
- *
- */
- abstract public void setDefault();
-
- /**
- * Sets the value of the associated option based on the
- * current UI setting.
- *
- */
- abstract public void setOptionValue();
-
-
- /**
- * A UI widget that offers a selection from a fixed
- * set of strings,
- * corresponding to a ChoiceOption.
- *
- * @author David Cok
- *
- */
- public static class ChoiceWidget extends PreferenceWidget {
-
- /** The widget used to get input from the user. */
- /*@Nullable*/ protected Combo widget = null;
-
- /**
- * A constructor that creates a Combo widget, initializing
- * it from the associated property.
- *
- * @param option The option with which the widget is associated
- */
- //@ pure
- public ChoiceWidget(AbstractPreference.ChoiceOption option) {
- super(option);
- }
-
- /**
- * Creates the corresponding widget and adds it to the given
- * Composite widget; the UI widgets are recreated for each
- * instance of a property page.
- * @param parent The Composite that holds all of the option widgets
- */
- //@ ensures widget != null;
- @Override
- public void addWidget(Composite parent) {
- AbstractPreference.ChoiceOption opt = (AbstractPreference.ChoiceOption)option;
- Composite composite = new Widgets.HComposite(parent,2);
- widget = new Combo(composite, SWT.READ_ONLY);
- widget.setItems(opt.choices());
- widget.select(opt.getIndexValue());
- widget.setVisibleItemCount(opt.choices().length);
- widget.setToolTipText(opt.tooltip());
- org.eclipse.swt.widgets.Label label2 = new org.eclipse.swt.widgets.Label(composite,SWT.NONE);
- label2.setText(opt.label());
- label2.setToolTipText(opt.tooltip());
- }
-
- /**
- * Returns the current setting of the widget; this method
- * may be called only when there is a current Properties Page.
- * @return The current setting of the widget
- */
- //@ requires widget != null;
- //@ ensures \result != null;
- //@ pure
- public String value() { return widget.getText(); }
-
-
- /**
- * Sets the UI widget to the option's default value
- *
- */
- @Override
- public void setDefault() {
- widget.select(((AbstractPreference.ChoiceOption)option).getDefaultIndex());
- }
-
- /**
- * Sets the option value to be consistent with the
- * current setting of the UI's widget.
- */
- @Override
- public void setOptionValue() { ((AbstractPreference.ChoiceOption)option).setValue(value()); }
-
- /** Resets the list of choice items */
- public void setChoices(String[] choices) { widget.setItems(choices); }
- }
-
- // FIXME - improve the handling of lengths of file/directory/string fields
-
- /**
- * This class implements an PreferenceWidget for a text field
- * property that holds a file name, using the FileTextField widget, which
- * incorporates a Browse button.
- *
- * @author David Cok
- *
- */
- public static class FileWidget extends PreferenceWidget {
-
- /** The UI widget representing a file browser. */
- /*@Nullable*/ protected Widgets.FileTextField widget = null;
-
- /**
- * Creates a FileWidget (the underlying widget is not
- * created until createContents is called).
- * @param option The option on which this widget is based
- */
- //@ reqiures option != null;
- //@ ensures widget == null;
- //@ ensures this.option == option;
- //@ pure
- public FileWidget(AbstractPreference.StringOption option) {
- super(option);
- }
-
-
- /**
- * Creates the corresponding widget and adds it to the given
- * Composite widget; the UI widgets are recreated for each
- * instance of a property page.
- * @param parent The Composite that holds all of the option widgets
- */
- //@ ensures widget != null;
- @Override
- public void addWidget(Composite parent) {
- String fn = ((AbstractPreference.StringOption)option).getValue();
- widget = new Widgets.FileTextField(parent,option.label(),fn,option.tooltip(),50);
- }
-
- /**
- * Returns the current setting of the widget; this method
- * may be called only when there is a current Properties Page.
- * @return The current setting of the widget
- */
- //@ requires widget != null;
- public String value() { return widget.value().trim(); }
-
- /**
- * Sets the UI widget to the built-in default value
- *
- */
- //@ requires widget != null;
- //@ requires option != null;
- @Override
- public void setDefault() {
- widget.setText(((AbstractPreference.StringOption)option).getDefault());
- }
-
- /**
- * Sets the option value to be consistent with the
- * current setting of the UI's widget.
- */
- //@ requires widget != null;
- //@ requires option != null;
- @Override
- public void setOptionValue() { ((AbstractPreference.StringOption)option).setValue(value()); }
- }
-
- /**
- * This class implements an PreferenceWidget for a text field
- * property that holds a directory name, using the DirTextField widget, which
- * incorporates a Browse button.
- *
- * @author David Cok
- *
- */
- public static class DirectoryWidget extends PreferenceWidget {
-
- /** The UI widget representing a file browser. */
- /*@Nullable*/ protected Widgets.DirTextField widget = null;
-
- /**
- * Creates a FileWidget (the underlying widget is not
- * created until createContents is called).
- * @param option The option on which this widget is based
- */
- //@ reqiures option != null;
- //@ ensures widget == null;
- //@ ensures this.option == option;
- //@ pure
- public DirectoryWidget(AbstractPreference.StringOption option) {
- super(option);
- }
-
-
- /**
- * Creates the corresponding widget and adds it to the given
- * Composite widget; the UI widgets are recreated for each
- * instance of a property page.
- * @param parent The Composite that holds all of the option widgets
- */
- //@ ensures widget != null;
- @Override
- public void addWidget(Composite parent) {
- String fn = ((AbstractPreference.StringOption)option).getValue();
- widget = new Widgets.DirTextField(parent,option.label(),fn,option.tooltip(),80);
- }
-
- public void addModifyListener(ModifyListener listener) {
- widget.addModifyListener(listener);
- }
-
- /**
- * Returns the current setting of the widget; this method
- * may be called only when there is a current Properties Page.
- * @return The current setting of the widget
- */
- //@ requires widget != null;
- public String value() { return widget.value().trim(); }
-
- /**
- * Sets the UI widget to the built-in default value
- *
- */
- //@ requires widget != null;
- //@ requires option != null;
- @Override
- public void setDefault() {
- widget.setText(((AbstractPreference.StringOption)option).getDefault());
- }
-
- /**
- * Sets the option value to be consistent with the
- * current setting of the UI's widget.
- */
- //@ requires widget != null;
- //@ requires option != null;
- @Override
- public void setOptionValue() { ((AbstractPreference.StringOption)option).setValue(value()); }
- }
-
- /**
- * This class implements a PropertyWidget for a boolean-valued
- * property, associating it with a check-box Button in the UI.
- *
- * @author David Cok
- *
- */
- public static class BooleanWidget extends PreferenceWidget {
-
- /** The UI widget representing a boolean choice. */
- /*@Nullable*/ protected Button widget = null;
-
- /**
- * Creates a checkbox widget on the given parent Composite widget;
- * initializes the widget with the value of the given option
- * @param option The option on which this widget is based
- */
- //@ requires option != null;
- //@ ensures this.option == option;
- //@ pure
- public BooleanWidget(AbstractPreference.BooleanOption option) {
- super(option);
- }
-
- /**
- * Creates the corresponding widget and adds it to the given
- * Composite widget; the UI widgets are recreated for each
- * instance of a property page.
- * @param parent The Composite that holds all of the option widgets
- */
- //@ requires option != null;
- //@ ensures widget != null;
- @Override
- public void addWidget(Composite parent) {
- widget = new Button(parent,SWT.CHECK);
- widget.setText(option.label());
- widget.setToolTipText(option.tooltip());
- widget.setSelection(((AbstractPreference.BooleanOption)option).getValue());
- }
-
- /**
- * Returns the current setting of the widget; this method
- * may be called only when there is a current Properties Page.
- * @return The current setting of the widget
- */
- //@ requires widget != null;
- public boolean value() { return widget.getSelection(); }
-
- /**
- * Sets the UI widget to the built-in default value
- *
- */
- //@ requires widget != null;
- //@ requires option != null;
- @Override
- public void setDefault() {
- widget.setSelection(((AbstractPreference.BooleanOption)option).getDefault());
- }
-
- /**
- * Sets the workspace property value to be consistent with the
- * current setting of the UI's widget.
- */
- //@ requires widget != null;
- //@ requires option != null;
- @Override
- public void setOptionValue() { ((AbstractPreference.BooleanOption)option).setValue(value()); }
- }
-
- /**
- * This class implements a PropertyWidget for a boolean-valued
- * property, associating it with a check-box Button in the UI.
- *
- * @author David Cok
- *
- */
- public static class IntWidget extends PreferenceWidget {
-
- // FIXME - change this to be an int field with arrow keys? Use FieldEditors?
-
- /** The UI widget representing a choice. */
- /*@Nullable*/ protected Combo widget = null;
-
- /** The strings giving the specific choices displayed. */
- protected String[] choices;
-
- /**
- * Creates a checkbox widget on the given parent Composite widget;
- * initializes the widget with the value of the given option
- * @param option The option on which this widget is based
- * @param choices the specific alternates displayed as choices
- */
- //@ requires option != null;
- //@ ensures this.option == option;
- //@ pure
- public IntWidget(AbstractPreference.IntOption option, String[] choices) {
- super(option);
- this.choices = choices;
- }
-
- /**
- * Creates the corresponding widget and adds it to the given
- * Composite widget; the UI widgets are recreated for each
- * instance of a property page.
- * @param parent The Composite that holds all of the option widgets
- */
- //@ requires option != null;
- //@ ensures widget != null;
- @Override
- public void addWidget(Composite parent) {
- AbstractPreference.IntOption opt = (AbstractPreference.IntOption)option;
- Composite composite = new Widgets.HComposite(parent,2);
- org.eclipse.swt.widgets.Label label2 = new org.eclipse.swt.widgets.Label(composite,SWT.NONE);
- label2.setText(opt.label());
- label2.setToolTipText(opt.tooltip());
- widget = new Combo(composite, SWT.READ_ONLY);
- widget.setItems(choices);
- widget.select(opt.getValue());
- widget.setVisibleItemCount(choices.length);
- widget.setToolTipText(opt.tooltip());
-
-// widget = new Button(parent,SWT.CHECK);
-// widget.setText(option.label());
-// widget.setToolTipText(option.tooltip());
-// widget.setSelection(((AbstractPreference.BooleanOption)option).getValue());
- }
-
- /**
- * Returns the current setting of the widget; this method
- * may be called only when there is a current Properties Page.
- * @return The current setting of the widget
- */
- //@ requires widget != null;
- public int value() { return widget.getSelectionIndex(); }
-
- /**
- * Sets the UI widget to the built-in default value
- *
- */
- //@ requires widget != null;
- //@ requires option != null;
- @Override
- public void setDefault() {
- widget.select(((AbstractPreference.IntOption)option).getDefault());
- }
-
- /**
- * Sets the workspace property value to be consistent with the
- * current setting of the UI's widget.
- */
- //@ requires widget != null;
- //@ requires option != null;
- @Override
- public void setOptionValue() { ((AbstractPreference.IntOption)option).setValue(value()); }
- }
-
-
- /**
- * This class implements a PropertyWidget for a String-valued
- * property, associating it with an editable text box in the UI.
- *
- * @author David Cok
- *
- */
- public static class StringWidget extends PreferenceWidget {
-
- /** The UI widget representing a String value. */
- /*@Nullable*/ protected Text widget = null;
-
- /**
- * Creates a checkbox widget on the given parent Composite widget;
- * initializes the widget with the value of the given option
- * @param option The option on which this widget is based
- */
- //@ requires option != null;
- //@ ensures this.option == option;
- //@ pure
- public StringWidget(AbstractPreference.StringOption option) {
- super(option);
- }
-
- /**
- * Creates the corresponding widget and adds it to the given
- * Composite widget; the UI widgets are recreated for each
- * instance of a property page.
- * @param parent The Composite that holds all of the option widgets
- */
- //@ requires option != null;
- //@ ensures widget != null;
- @Override
- public void addWidget(Composite parent) {
- Composite composite = new Widgets.HComposite(parent,2);
- org.eclipse.swt.widgets.Label label2 = new org.eclipse.swt.widgets.Label(composite,SWT.NONE);
- label2.setText(option.label());
- label2.setToolTipText(option.tooltip());
- widget = new Text(composite, SWT.SINGLE);
- widget.setText(((AbstractPreference.StringOption)option).getValue());
- widget.setToolTipText(option.tooltip());
- }
-
- /**
- * Returns the current setting of the widget; this method
- * may be called only when there is a current Properties Page.
- * @return The current setting of the widget
- */
- //@ requires widget != null;
- public String value() { return widget.getText(); }
-
- /**
- * Sets the UI widget to the built-in default value
- *
- */
- //@ requires widget != null;
- //@ requires option != null;
- @Override
- public void setDefault() {
- widget.setText(((AbstractPreference.StringOption)option).getDefault());
- }
-
- /**
- * Sets the workspace property value to be consistent with the
- * current setting of the UI's widget.
- */
- //@ requires widget != null;
- //@ requires option != null;
- @Override
- public void setOptionValue() {
- ((AbstractPreference.StringOption)option).setValue(value());
- }
- }
- /**
- * This class implements an PreferenceWidget that is a Label, so
- * that it can sit in lists of PreferenceWidgets. However, it does
- * not have an option associated with it.
- *
- * @author David Cok
- *
- */
- public static class Label extends PreferenceWidget {
-
- /** The UI widget that is a label. */
- /*@Nullable*/ protected Widgets.LabeledSeparator widget = null;
-
- /** The label value */
- protected String label;
-
- /**
- * Creates a Label widget on the given parent Composite widget.
- * @param label The label text for the widget
- */
- //@ requires label != null;
- //@ ensures this.label == label;
- //@ pure
- public Label(String label) {
- super(null);
- this.label = label;
- }
-
- /**
- * Creates the corresponding widget and adds it to the given
- * Composite widget; the UI widgets are recreated for each
- * instance of a property page.
- * @param parent The Composite that holds all of the option widgets
- */
- //@ ensures widget != null;
- @Override
- public void addWidget(Composite parent) {
- widget = new Widgets.LabeledSeparator(parent,label);
- }
-
- /**
- * Does nothing.
- */
- @Override
- public void setDefault() { }
-
- /**
- * Does nothing.
- */
- @Override
- public void setOptionValue() { }
- }
-
-}
+/*
+ * This file is part of the SMT plugin project.
+ * Copyright 2010 David R. Cok
+ * Created August 2010
+ */
+package org.smtlib.plugin;
+
+// FIXME : Needs a color selection widget
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This class is a base class for the controls that are used in
+ * the property page; each control is connected to an Option object.
+ *
+ * @author David Cok
+ *
+ */
+abstract public class PreferenceWidget {
+
+ /** The option object represented by this PreferenceWidget */
+ /*@Nullable*/ AbstractPreference option;
+
+
+ /**
+ * Base class constructor, taking some common arguments.
+ *
+ * @param option The option that this widget represents.
+ */
+ public PreferenceWidget(/*@Nullable*/ AbstractPreference option) {
+ this.option = option;
+ }
+
+ /**
+ * Creates and adds the widget to the given control
+ * @param parent The composite to add the widget to.
+ */
+ abstract public void addWidget(Composite parent);
+
+ /**
+ * Sets the UI widget to the built-in default value
+ *
+ */
+ abstract public void setDefault();
+
+ /**
+ * Sets the value of the associated option based on the
+ * current UI setting.
+ *
+ */
+ abstract public void setOptionValue();
+
+
+ /**
+ * A UI widget that offers a selection from a fixed
+ * set of strings,
+ * corresponding to a ChoiceOption.
+ *
+ * @author David Cok
+ *
+ */
+ public static class ChoiceWidget extends PreferenceWidget {
+
+ /** The widget used to get input from the user. */
+ /*@Nullable*/ protected Combo widget = null;
+
+ /**
+ * A constructor that creates a Combo widget, initializing
+ * it from the associated property.
+ *
+ * @param option The option with which the widget is associated
+ */
+ //@ pure
+ public ChoiceWidget(AbstractPreference.ChoiceOption option) {
+ super(option);
+ }
+
+ /**
+ * Creates the corresponding widget and adds it to the given
+ * Composite widget; the UI widgets are recreated for each
+ * instance of a property page.
+ * @param parent The Composite that holds all of the option widgets
+ */
+ //@ ensures widget != null;
+ @Override
+ public void addWidget(Composite parent) {
+ AbstractPreference.ChoiceOption opt = (AbstractPreference.ChoiceOption)option;
+ Composite composite = new Widgets.HComposite(parent,2);
+ widget = new Combo(composite, SWT.READ_ONLY);
+ widget.setItems(opt.choices());
+ widget.select(opt.getIndexValue());
+ widget.setVisibleItemCount(opt.choices().length);
+ widget.setToolTipText(opt.tooltip());
+ org.eclipse.swt.widgets.Label label2 = new org.eclipse.swt.widgets.Label(composite,SWT.NONE);
+ label2.setText(opt.label());
+ label2.setToolTipText(opt.tooltip());
+ }
+
+ /**
+ * Returns the current setting of the widget; this method
+ * may be called only when there is a current Properties Page.
+ * @return The current setting of the widget
+ */
+ //@ requires widget != null;
+ //@ ensures \result != null;
+ //@ pure
+ public String value() { return widget.getText(); }
+
+
+ /**
+ * Sets the UI widget to the option's default value
+ *
+ */
+ @Override
+ public void setDefault() {
+ widget.select(((AbstractPreference.ChoiceOption)option).getDefaultIndex());
+ }
+
+ /**
+ * Sets the option value to be consistent with the
+ * current setting of the UI's widget.
+ */
+ @Override
+ public void setOptionValue() { ((AbstractPreference.ChoiceOption)option).setValue(value()); }
+
+ /** Resets the list of choice items */
+ public void setChoices(String[] choices) { widget.setItems(choices); }
+ }
+
+ // FIXME - improve the handling of lengths of file/directory/string fields
+
+ /**
+ * This class implements an PreferenceWidget for a text field
+ * property that holds a file name, using the FileTextField widget, which
+ * incorporates a Browse button.
+ *
+ * @author David Cok
+ *
+ */
+ public static class FileWidget extends PreferenceWidget {
+
+ /** The UI widget representing a file browser. */
+ /*@Nullable*/ protected Widgets.FileTextField widget = null;
+
+ /**
+ * Creates a FileWidget (the underlying widget is not
+ * created until createContents is called).
+ * @param option The option on which this widget is based
+ */
+ //@ reqiures option != null;
+ //@ ensures widget == null;
+ //@ ensures this.option == option;
+ //@ pure
+ public FileWidget(AbstractPreference.StringOption option) {
+ super(option);
+ }
+
+
+ /**
+ * Creates the corresponding widget and adds it to the given
+ * Composite widget; the UI widgets are recreated for each
+ * instance of a property page.
+ * @param parent The Composite that holds all of the option widgets
+ */
+ //@ ensures widget != null;
+ @Override
+ public void addWidget(Composite parent) {
+ String fn = ((AbstractPreference.StringOption)option).getValue();
+ widget = new Widgets.FileTextField(parent,option.label(),fn,option.tooltip(),50);
+ }
+
+ /**
+ * Returns the current setting of the widget; this method
+ * may be called only when there is a current Properties Page.
+ * @return The current setting of the widget
+ */
+ //@ requires widget != null;
+ public String value() { return widget.value().trim(); }
+
+ /**
+ * Sets the UI widget to the built-in default value
+ *
+ */
+ //@ requires widget != null;
+ //@ requires option != null;
+ @Override
+ public void setDefault() {
+ widget.setText(((AbstractPreference.StringOption)option).getDefault());
+ }
+
+ /**
+ * Sets the option value to be consistent with the
+ * current setting of the UI's widget.
+ */
+ //@ requires widget != null;
+ //@ requires option != null;
+ @Override
+ public void setOptionValue() { ((AbstractPreference.StringOption)option).setValue(value()); }
+ }
+
+ /**
+ * This class implements an PreferenceWidget for a text field
+ * property that holds a directory name, using the DirTextField widget, which
+ * incorporates a Browse button.
+ *
+ * @author David Cok
+ *
+ */
+ public static class DirectoryWidget extends PreferenceWidget {
+
+ /** The UI widget representing a file browser. */
+ /*@Nullable*/ protected Widgets.DirTextField widget = null;
+
+ /**
+ * Creates a FileWidget (the underlying widget is not
+ * created until createContents is called).
+ * @param option The option on which this widget is based
+ */
+ //@ reqiures option != null;
+ //@ ensures widget == null;
+ //@ ensures this.option == option;
+ //@ pure
+ public DirectoryWidget(AbstractPreference.StringOption option) {
+ super(option);
+ }
+
+
+ /**
+ * Creates the corresponding widget and adds it to the given
+ * Composite widget; the UI widgets are recreated for each
+ * instance of a property page.
+ * @param parent The Composite that holds all of the option widgets
+ */
+ //@ ensures widget != null;
+ @Override
+ public void addWidget(Composite parent) {
+ String fn = ((AbstractPreference.StringOption)option).getValue();
+ widget = new Widgets.DirTextField(parent,option.label(),fn,option.tooltip(),80);
+ }
+
+ public void addModifyListener(ModifyListener listener) {
+ widget.addModifyListener(listener);
+ }
+
+ /**
+ * Returns the current setting of the widget; this method
+ * may be called only when there is a current Properties Page.
+ * @return The current setting of the widget
+ */
+ //@ requires widget != null;
+ public String value() { return widget.value().trim(); }
+
+ /**
+ * Sets the UI widget to the built-in default value
+ *
+ */
+ //@ requires widget != null;
+ //@ requires option != null;
+ @Override
+ public void setDefault() {
+ widget.setText(((AbstractPreference.StringOption)option).getDefault());
+ }
+
+ /**
+ * Sets the option value to be consistent with the
+ * current setting of the UI's widget.
+ */
+ //@ requires widget != null;
+ //@ requires option != null;
+ @Override
+ public void setOptionValue() { ((AbstractPreference.StringOption)option).setValue(value()); }
+ }
+
+ /**
+ * This class implements a PropertyWidget for a boolean-valued
+ * property, associating it with a check-box Button in the UI.
+ *
+ * @author David Cok
+ *
+ */
+ public static class BooleanWidget extends PreferenceWidget {
+
+ /** The UI widget representing a boolean choice. */
+ /*@Nullable*/ protected Button widget = null;
+
+ /**
+ * Creates a checkbox widget on the given parent Composite widget;
+ * initializes the widget with the value of the given option
+ * @param option The option on which this widget is based
+ */
+ //@ requires option != null;
+ //@ ensures this.option == option;
+ //@ pure
+ public BooleanWidget(AbstractPreference.BooleanOption option) {
+ super(option);
+ }
+
+ /**
+ * Creates the corresponding widget and adds it to the given
+ * Composite widget; the UI widgets are recreated for each
+ * instance of a property page.
+ * @param parent The Composite that holds all of the option widgets
+ */
+ //@ requires option != null;
+ //@ ensures widget != null;
+ @Override
+ public void addWidget(Composite parent) {
+ widget = new Button(parent,SWT.CHECK);
+ widget.setText(option.label());
+ widget.setToolTipText(option.tooltip());
+ widget.setSelection(((AbstractPreference.BooleanOption)option).getValue());
+ }
+
+ /**
+ * Returns the current setting of the widget; this method
+ * may be called only when there is a current Properties Page.
+ * @return The current setting of the widget
+ */
+ //@ requires widget != null;
+ public boolean value() { return widget.getSelection(); }
+
+ /**
+ * Sets the UI widget to the built-in default value
+ *
+ */
+ //@ requires widget != null;
+ //@ requires option != null;
+ @Override
+ public void setDefault() {
+ widget.setSelection(((AbstractPreference.BooleanOption)option).getDefault());
+ }
+
+ /**
+ * Sets the workspace property value to be consistent with the
+ * current setting of the UI's widget.
+ */
+ //@ requires widget != null;
+ //@ requires option != null;
+ @Override
+ public void setOptionValue() { ((AbstractPreference.BooleanOption)option).setValue(value()); }
+ }
+
+ /**
+ * This class implements a PropertyWidget for a boolean-valued
+ * property, associating it with a check-box Button in the UI.
+ *
+ * @author David Cok
+ *
+ */
+ public static class IntWidget extends PreferenceWidget {
+
+ // FIXME - change this to be an int field with arrow keys? Use FieldEditors?
+
+ /** The UI widget representing a choice. */
+ /*@Nullable*/ protected Combo widget = null;
+
+ /** The strings giving the specific choices displayed. */
+ protected String[] choices;
+
+ /**
+ * Creates a checkbox widget on the given parent Composite widget;
+ * initializes the widget with the value of the given option
+ * @param option The option on which this widget is based
+ * @param choices the specific alternates displayed as choices
+ */
+ //@ requires option != null;
+ //@ ensures this.option == option;
+ //@ pure
+ public IntWidget(AbstractPreference.IntOption option, String[] choices) {
+ super(option);
+ this.choices = choices;
+ }
+
+ /**
+ * Creates the corresponding widget and adds it to the given
+ * Composite widget; the UI widgets are recreated for each
+ * instance of a property page.
+ * @param parent The Composite that holds all of the option widgets
+ */
+ //@ requires option != null;
+ //@ ensures widget != null;
+ @Override
+ public void addWidget(Composite parent) {
+ AbstractPreference.IntOption opt = (AbstractPreference.IntOption)option;
+ Composite composite = new Widgets.HComposite(parent,2);
+ org.eclipse.swt.widgets.Label label2 = new org.eclipse.swt.widgets.Label(composite,SWT.NONE);
+ label2.setText(opt.label());
+ label2.setToolTipText(opt.tooltip());
+ widget = new Combo(composite, SWT.READ_ONLY);
+ widget.setItems(choices);
+ widget.select(opt.getValue());
+ widget.setVisibleItemCount(choices.length);
+ widget.setToolTipText(opt.tooltip());
+
+// widget = new Button(parent,SWT.CHECK);
+// widget.setText(option.label());
+// widget.setToolTipText(option.tooltip());
+// widget.setSelection(((AbstractPreference.BooleanOption)option).getValue());
+ }
+
+ /**
+ * Returns the current setting of the widget; this method
+ * may be called only when there is a current Properties Page.
+ * @return The current setting of the widget
+ */
+ //@ requires widget != null;
+ public int value() { return widget.getSelectionIndex(); }
+
+ /**
+ * Sets the UI widget to the built-in default value
+ *
+ */
+ //@ requires widget != null;
+ //@ requires option != null;
+ @Override
+ public void setDefault() {
+ widget.select(((AbstractPreference.IntOption)option).getDefault());
+ }
+
+ /**
+ * Sets the workspace property value to be consistent with the
+ * current setting of the UI's widget.
+ */
+ //@ requires widget != null;
+ //@ requires option != null;
+ @Override
+ public void setOptionValue() { ((AbstractPreference.IntOption)option).setValue(value()); }
+ }
+
+
+ /**
+ * This class implements a PropertyWidget for a String-valued
+ * property, associating it with an editable text box in the UI.
+ *
+ * @author David Cok
+ *
+ */
+ public static class StringWidget extends PreferenceWidget {
+
+ /** The UI widget representing a String value. */
+ /*@Nullable*/ protected Text widget = null;
+
+ /**
+ * Creates a checkbox widget on the given parent Composite widget;
+ * initializes the widget with the value of the given option
+ * @param option The option on which this widget is based
+ */
+ //@ requires option != null;
+ //@ ensures this.option == option;
+ //@ pure
+ public StringWidget(AbstractPreference.StringOption option) {
+ super(option);
+ }
+
+ /**
+ * Creates the corresponding widget and adds it to the given
+ * Composite widget; the UI widgets are recreated for each
+ * instance of a property page.
+ * @param parent The Composite that holds all of the option widgets
+ */
+ //@ requires option != null;
+ //@ ensures widget != null;
+ @Override
+ public void addWidget(Composite parent) {
+ Composite composite = new Widgets.HComposite(parent,2);
+ org.eclipse.swt.widgets.Label label2 = new org.eclipse.swt.widgets.Label(composite,SWT.NONE);
+ label2.setText(option.label());
+ label2.setToolTipText(option.tooltip());
+ widget = new Text(composite, SWT.SINGLE);
+ widget.setText(((AbstractPreference.StringOption)option).getValue());
+ widget.setToolTipText(option.tooltip());
+ }
+
+ /**
+ * Returns the current setting of the widget; this method
+ * may be called only when there is a current Properties Page.
+ * @return The current setting of the widget
+ */
+ //@ requires widget != null;
+ public String value() { return widget.getText(); }
+
+ /**
+ * Sets the UI widget to the built-in default value
+ *
+ */
+ //@ requires widget != null;
+ //@ requires option != null;
+ @Override
+ public void setDefault() {
+ widget.setText(((AbstractPreference.StringOption)option).getDefault());
+ }
+
+ /**
+ * Sets the workspace property value to be consistent with the
+ * current setting of the UI's widget.
+ */
+ //@ requires widget != null;
+ //@ requires option != null;
+ @Override
+ public void setOptionValue() {
+ ((AbstractPreference.StringOption)option).setValue(value());
+ }
+ }
+ /**
+ * This class implements an PreferenceWidget that is a Label, so
+ * that it can sit in lists of PreferenceWidgets. However, it does
+ * not have an option associated with it.
+ *
+ * @author David Cok
+ *
+ */
+ public static class Label extends PreferenceWidget {
+
+ /** The UI widget that is a label. */
+ /*@Nullable*/ protected Widgets.LabeledSeparator widget = null;
+
+ /** The label value */
+ protected String label;
+
+ /**
+ * Creates a Label widget on the given parent Composite widget.
+ * @param label The label text for the widget
+ */
+ //@ requires label != null;
+ //@ ensures this.label == label;
+ //@ pure
+ public Label(String label) {
+ super(null);
+ this.label = label;
+ }
+
+ /**
+ * Creates the corresponding widget and adds it to the given
+ * Composite widget; the UI widgets are recreated for each
+ * instance of a property page.
+ * @param parent The Composite that holds all of the option widgets
+ */
+ //@ ensures widget != null;
+ @Override
+ public void addWidget(Composite parent) {
+ widget = new Widgets.LabeledSeparator(parent,label);
+ }
+
+ /**
+ * Does nothing.
+ */
+ @Override
+ public void setDefault() { }
+
+ /**
+ * Does nothing.
+ */
+ @Override
+ public void setOptionValue() { }
+ }
+
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/Preferences.java b/SMTPlugin/src/org/smtlib/plugin/Preferences.java
index 6c4d684..f44eb5a 100644
--- a/SMTPlugin/src/org/smtlib/plugin/Preferences.java
+++ b/SMTPlugin/src/org/smtlib/plugin/Preferences.java
@@ -1,457 +1,457 @@
-/*
- * This file is part of the SMT plug-in project.
- * Copyright 2010 David R. Cok
- * Created August 2010
- */
-package org.smtlib.plugin;
-
-// FIXME implement logic, out, diag, port, relax -- check all options
-
-import java.io.File;
-import java.util.Enumeration;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.osgi.framework.Bundle;
-import org.smtlib.SMT.Configuration;
-
-/**
- * @author David Cok
- *
- * This class implements the preference page for the plugin.
- * To add a new Preference:
- * - add a String to POptions -- this is the key used in the preference database
- * - add an AbstractPreference for that key to POptions - this specifies the kind of preference (Boolean, String, Choice, ...)
- * - add a PreferenceWidget linked to the AbstractPreference to one of the PreferenceWidget arrays (e.g. options, pluginOptions)
- * - if you create a new array, alter createContents, performOK, performDefaults
- */
-public class Preferences extends org.eclipse.jface.preference.PreferencePage
-implements IWorkbenchPreferencePage {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- // FIXME _ what might go in here?
- public void init(IWorkbench workbench) {
- }
-
- /** This class defines all the items that have a persistent
- * presence in the Preferences store. */
- static public class POptions {
- /** The prefix to be put on each key. */
- final static public String prefix = "org.smtlib.plugin.";
-
- /** The preference store key for the verbose option. */
- final static public String verbosePluginKey = prefix + "verbosePlugin";
-
- /** The preference store key for the verbose SMT app option. */
- final static public String verboseKey = prefix + "verbose";
-
- /** The preference store key for the verbose SMT solver option. */
- final static public String solverVerbosityKey = prefix + "solverVerbosity";
-
- /** The preference store key for the print-success option. */
- final static public String printSuccessKey = prefix + "printSuccess";
-
- /** The preference store key for the abort-on-error option. */
- final static public String abortKey = prefix + "abort";
-
- /** The preference store key for the print-success option. */
- final static public String relaxKey = prefix + "relax";
-
- /** The preference store key for the print-success option. */
- final static public String echoKey = prefix + "echo";
-
- /** The preference store key for the logic option. */
- final static public String logicKey = prefix + "logic";
-
- /** The preference store key for the logics option. */
- final static public String logicsKey = prefix + "logics";
-
- /** The preference store key for the default solver choice option. */
- final static public String defaultSolverKey = prefix + "defaultSolver";
-
- /** The preference store key for option storing the path to the given solver's executable. */
- final static public String execKey(String solver) {
- return prefix + "execKey_" + solver;
- }
- // The various option objects
-
- public AbstractPreference.BooleanOption verbosePlugin =
- new AbstractPreference.BooleanOption(verbosePluginKey, false, "verbose plug-in?", "If true, progress and debugging information from the plug-in is printed.");
-
- public AbstractPreference.BooleanOption verbose =
- new AbstractPreference.BooleanOption(verboseKey, false, "verbose SMT app?", "If true, diagnostic information from the SMT app is printed.");
-
- public AbstractPreference.IntOption solverVerbosity =
- new AbstractPreference.IntOption(solverVerbosityKey, 0, "SMT solver verbosity", "Verbosity level of the SMT solver, 0 for quiet");
-
- public AbstractPreference.BooleanOption printSuccess =
- new AbstractPreference.BooleanOption(printSuccessKey, true, "print success?", "If true, all command results are printed; if false, all except success are printed.");
-
- public AbstractPreference.BooleanOption abort =
- new AbstractPreference.BooleanOption(abortKey, false, "abort on error?", "If true, an error aborts further processing.");
-
- public AbstractPreference.BooleanOption echo =
- new AbstractPreference.BooleanOption(echoKey, false, "echo batch commands?", "If true, batch commands are echoed to the output as they are executed");
- public AbstractPreference.BooleanOption relax =
- new AbstractPreference.BooleanOption(relaxKey, false, "relax conformity?", "If true, some not-strictlyu-SMT-LIB enahancements are allowed; if false, SMT-LIB is strictly enforced.");
-
- public AbstractPreference.StringOption logics =
- new AbstractPreference.StringOption(logicsKey,"","Directory containing logic files (if empty, built-in logic files are used)","Directory that contains the files defining SMT-LIB logics and theories");
-
- public String[] logicNames = new String[]{};
- {
- String logicsDir = logics.getValue();
- List logicList = new LinkedList();
- if (logicsDir.trim().length() != 0) {
- File dir = new File(logicsDir);
- logicList.add("");
- if (dir.isDirectory()) {
- for (String f : dir.list()) {
- if (f.endsWith(org.smtlib.Utils.SUFFIX)) {
- f = f.substring(0,f.length() - org.smtlib.Utils.SUFFIX.length());
- if (f.charAt(1) <= 'Z') {
- logicList.add(f);
- }
- }
- }
- }
- } else { // FIXME - unify this with findLogic in Activator
- Bundle b = Platform.getBundle(org.smtlib.Utils.PLUGIN_ID);
- @SuppressWarnings("unchecked")
- Enumeration e = (Enumeration)b.getEntryPaths("logics/");
- while (e.hasMoreElements()) {
- String p = e.nextElement();
- int n = 1 + p.indexOf('/');
- int nn = p.indexOf('.');
- if (nn != -1) logicList.add(p.substring(n,nn));
- }
- }
- logicNames = logicList.toArray(logicNames);
- }
-
- // FIXME - This gets set dynamically when the plugin first starts; changes in the logic path are not
- // changed until the plug-in restarts
-
- public AbstractPreference.ChoiceOption logic = dynamicLogicList(logicKey, logics.getValue());
-
- /** Names of solvers to include; test must be first */
- public static final String[] solverNames = new String[]{org.smtlib.Utils.TEST_SOLVER,"simplify","yices2","cvc4","z3_4_4","z3_4_3"};
-
- public AbstractPreference.ChoiceOption defaultSolver =
- new AbstractPreference.ChoiceOption(defaultSolverKey,
- solverNames,
- 0,
- "Default solver to use",
- "The default solver to use in response to menu commands");
-
- public List execOptions = new LinkedList();
-
- public POptions() {
- // Skip solverNames[0] ("test")
- for (int i = 1; i logicList = new LinkedList();
- logicList.add("");
- if (dir.isDirectory()) {
- for (String f : dir.list()) {
- if (f.endsWith(org.smtlib.Utils.SUFFIX)) {
- f = f.substring(0,f.length() - org.smtlib.Utils.SUFFIX.length());
- if (f.charAt(1) <= 'Z') {
- logicList.add(f);
- }
- }
- }
- }
- logicNames = logicList.toArray(logicNames);
-
- return
- new AbstractPreference.ChoiceOption(logicKey, logicNames, 0, "implicit logic:", "If set, the logic to set implicitly for each SMT execution.");
-
- }
-
- /** An instance of the object that holds all of the preference store items being used. */
- static POptions poptions = new POptions();
-
- /** This method fills in a Configuration structure whose values are set from
- * the current preference store settings (which should match those in the UI).
- * We use the preference store instead of the UI widgets so that this method
- * works even if the preference page has not yet been generated. If the
- * argument is null, a new Configuration structure is allocated; otherwise the
- * fields of the argument are filled in. The argument or newly allocated
- * object is returned.
- * @param options if not null, the structure to fill in
- * @return An Configuration structure initialized to the current preference store settings.
- */
- static public Configuration extractOptions(Configuration smtConfig) {
- if (smtConfig == null) {
- smtConfig = new Configuration();
- }
- Activator.verbose = poptions.verbosePlugin.getValue();
- smtConfig.verbose = poptions.verbose.getValue() ? 1 : 0;
- smtConfig.solverVerbosity = poptions.solverVerbosity.getValue();
- smtConfig.nosuccess = !poptions.printSuccess.getValue();
- smtConfig.abort = poptions.abort.getValue();
- smtConfig.echo = poptions.echo.getValue();
- smtConfig.relax = poptions.relax.getValue();
-
- smtConfig.logic = null;
-// if (poptions.logic.getIndexValue() == 0) options.logic = null; // FIXME - implement implicit logic?
-// else options.logic = poptions.logic.getStringValue();
-
- smtConfig.solvername = poptions.defaultSolver.getStringValue();
- smtConfig.logicPath = poptions.logics.getValue();
- if (smtConfig.logicPath.trim().isEmpty()) smtConfig.logicPath = null;
- if (Activator.verbose) Activator.log.logln("Extracted options");
- return smtConfig;
- }
-
-
- static PreferenceWidget.ChoiceWidget logicChoiceWidget;
- static PreferenceWidget.DirectoryWidget logicPathWidget;
- /**
- * An array of the SMT option widgets.
- */
- static private PreferenceWidget[] options = {
- new PreferenceWidget.BooleanWidget(poptions.verbose),
- new PreferenceWidget.IntWidget(poptions.solverVerbosity, new String[]{"0","1","2","3","4","5","6","7","8","9"}),
- new PreferenceWidget.BooleanWidget(poptions.printSuccess),
- new PreferenceWidget.BooleanWidget(poptions.abort),
- new PreferenceWidget.BooleanWidget(poptions.echo),
- new PreferenceWidget.BooleanWidget(poptions.relax),
- new PreferenceWidget.ChoiceWidget(poptions.defaultSolver),
- logicChoiceWidget=new PreferenceWidget.ChoiceWidget(poptions.logic),
- logicPathWidget=new PreferenceWidget.DirectoryWidget(poptions.logics),
- };
-
- static private PreferenceWidget[] solverConfig = new PreferenceWidget[poptions.execOptions.size()];
-
-
- static {
- List list = new LinkedList();
- for (AbstractPreference.StringOption s: poptions.execOptions) {
- list.add(new PreferenceWidget.FileWidget(s));
- }
- solverConfig = list.toArray(solverConfig);
- // FIXME _ have not been able to get this to work
-// logicPathWidget.addModifyListener( new ModifyListener() {
-// public void modifyText(ModifyEvent e) {
-// if (logicPathWidget != null && logicChoiceWidget != null && poptions != null && poptions.logic != null) {
-// poptions.logic = dynamicLogicList(POptions.logicKey,logicPathWidget.value());
-// logicChoiceWidget.setChoices(poptions.logic.choices());
-// }
-// }
-// });
- }
-
- static final public String getExec(String solver) throws java.lang.Exception {
- String key = POptions.execKey(solver);
- for (AbstractPreference.StringOption p: poptions.execOptions) {
- if (p.key().equals(key)) return p.getValue();
- }
- return null;
- }
-
- /**
- * An array of widgets for plugin options.
- */
- static final private PreferenceWidget[] pluginOptions = {
- new PreferenceWidget.BooleanWidget(poptions.verbosePlugin),
- };
-
-// static final private PreferenceWidget[] execOptions = new PreferenceWidget[poptions.execOptions.size()];
-// {
-// int i = 0;;
-// for (AbstractPreference.StringOption p: poptions.execOptions) {
-// execOptions[i++] = new PreferenceWidget.StringWidget(p);
-// }
-// }
-
- /**
- * Creates the property page controls and initializes them.
- *
- * @param parent The UI object into which to insert the controls
- * @return The new control that is added to 'parent'
- */
- protected Control createContents(Composite parent) {
-
- // Creates the contents of the property page view.
-
- CTabFolder tf = new CTabFolder(parent, SWT.TOP|SWT.MULTI|SWT.FLAT);
- CTabItem mainTab = new CTabItem(tf,SWT.NONE,0);
- mainTab.setText("General");
- CTabItem solverTab = new CTabItem(tf,SWT.NONE,1);
- solverTab.setText("Solvers");
- Composite generalComposite = new Widgets.VComposite(tf);
- mainTab.setControl(generalComposite);
- Composite solverComposite = new Widgets.VComposite(tf);
- solverTab.setControl(solverComposite);
- addWidgets(solverConfig,solverComposite);
-
- Composite composite0 = generalComposite;
- new Label(composite0, SWT.CENTER).setText("SMT version: " + org.smtlib.Version.version());
- new Label(composite0, SWT.CENTER)
- .setText("These choices are workspace options that apply to every SMT-LIB project.");
-
- new Widgets.LabeledSeparator(composite0, "Configuration relating to the plugin");
- addWidgets(pluginOptions, composite0);
- new Widgets.LabeledSeparator(composite0, "Configuration relating to SMT");
- addWidgets(options, composite0);
-
- tf.showItem(mainTab);
- tf.setSelection(mainTab);
- return composite0;
-
- }
-
-// /**
-// * Constructs the view of the property page by adding different features like
-// * labels, and setting the layout. Just a helper to createContents()
-// * .
-// *
-// * @param parent The parent composite to which the controls are added
-// * @return The resulting control that defined the looking of the property page
-// */
-// private Control addControl(Composite parent) {
-// Composite composite0 = new Widgets.VComposite(parent);
-//
-// new Label(composite0, SWT.CENTER).setText("SMT version: " + org.smtlib.Utils.SW_VERSION);
-// new Label(composite0, SWT.CENTER)
-// .setText("These options are workspace options that apply to every SMT-LIB project.");
-// // Composite composite0 = new Widgets.HComposite(composite0a, 2);
-// // Composite composite1 = new Widgets.VComposite(composite0);
-// // Composite composite2a = new Widgets.VComposite(composite0);
-// // Composite composite2 = new Widgets.HComposite(composite2a, 2);
-// // Composite composite3 = new Widgets.VComposite(composite2);
-// // Composite composite4 = new Widgets.VComposite(composite2);
-//
-// // new Widgets.LabeledSeparator(composite0, "Configuration relating to Eclipse");
-// // addWidgets(eclipseOptions, composite0);
-// // new Widgets.LabeledSeparator(composite0, "Configuration relating to Java");
-// // addWidgets(javaOptions, composite0);
-// new Widgets.LabeledSeparator(composite0, "Configuration relating to the plugin");
-// addWidgets(pluginOptions, composite0);
-// new Widgets.LabeledSeparator(composite0, "Configuration relating to SMT");
-// addWidgets(options, composite0);
-// // new Widgets.LabeledSeparator(composite0, "Configuration for debugging");
-// // addWidgets(debugOptions, composite0);
-//
-// return composite0;
-// }
-
- /**
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- // When OK is pressed, set all the options selected.
- setOptionValue(pluginOptions);
- setOptionValue(options);
- setOptionValue(solverConfig);
-
- if (false) {
- // FIXME _ hard coded array positions is fragile
- poptions.logic = dynamicLogicList(POptions.logicKey,logicPathWidget.value());
- logicChoiceWidget.setChoices(poptions.logic.choices());
- }
- AbstractPreference.notifyListeners();
- return true;
- }
-
- public void performDefaults() {
- // When OK is pressed, set all the options selected.
- setDefaults(pluginOptions);
- setDefaults(options);
- setDefaults(solverConfig);
- }
-
- /** Calls setDefault for each widget in the list
- *
- * @param ws an array of widgets to be processed
- */
- //@ requires ws != null;
- //@ requires \nonnullelements(ws);
- public void setDefaults(PreferenceWidget[] ws) {
- for (int i = 0; i= 0 && offset < ws.length;
- //@ requires num >= 0 && offset + num < ws.length;
- //@ requires \nonnullelements(ws);
- public void addWidgets(PreferenceWidget[] ws, int offset, int num, Composite composite) {
- for (int i=0; i logicList = new LinkedList();
+ if (logicsDir.trim().length() != 0) {
+ File dir = new File(logicsDir);
+ logicList.add("");
+ if (dir.isDirectory()) {
+ for (String f : dir.list()) {
+ if (f.endsWith(org.smtlib.Utils.SUFFIX)) {
+ f = f.substring(0,f.length() - org.smtlib.Utils.SUFFIX.length());
+ if (f.charAt(1) <= 'Z') {
+ logicList.add(f);
+ }
+ }
+ }
+ }
+ } else { // FIXME - unify this with findLogic in Activator
+ Bundle b = Platform.getBundle(org.smtlib.Utils.PLUGIN_ID);
+ @SuppressWarnings("unchecked")
+ Enumeration e = (Enumeration)b.getEntryPaths("logics/");
+ while (e.hasMoreElements()) {
+ String p = e.nextElement();
+ int n = 1 + p.indexOf('/');
+ int nn = p.indexOf('.');
+ if (nn != -1) logicList.add(p.substring(n,nn));
+ }
+ }
+ logicNames = logicList.toArray(logicNames);
+ }
+
+ // FIXME - This gets set dynamically when the plugin first starts; changes in the logic path are not
+ // changed until the plug-in restarts
+
+ public AbstractPreference.ChoiceOption logic = dynamicLogicList(logicKey, logics.getValue());
+
+ /** Names of solvers to include; test must be first */
+ public static final String[] solverNames = new String[]{org.smtlib.Utils.TEST_SOLVER,"simplify","yices2","cvc4","z3_4_4","z3_4_3"};
+
+ public AbstractPreference.ChoiceOption defaultSolver =
+ new AbstractPreference.ChoiceOption(defaultSolverKey,
+ solverNames,
+ 0,
+ "Default solver to use",
+ "The default solver to use in response to menu commands");
+
+ public List execOptions = new LinkedList();
+
+ public POptions() {
+ // Skip solverNames[0] ("test")
+ for (int i = 1; i logicList = new LinkedList();
+ logicList.add("");
+ if (dir.isDirectory()) {
+ for (String f : dir.list()) {
+ if (f.endsWith(org.smtlib.Utils.SUFFIX)) {
+ f = f.substring(0,f.length() - org.smtlib.Utils.SUFFIX.length());
+ if (f.charAt(1) <= 'Z') {
+ logicList.add(f);
+ }
+ }
+ }
+ }
+ logicNames = logicList.toArray(logicNames);
+
+ return
+ new AbstractPreference.ChoiceOption(logicKey, logicNames, 0, "implicit logic:", "If set, the logic to set implicitly for each SMT execution.");
+
+ }
+
+ /** An instance of the object that holds all of the preference store items being used. */
+ static POptions poptions = new POptions();
+
+ /** This method fills in a Configuration structure whose values are set from
+ * the current preference store settings (which should match those in the UI).
+ * We use the preference store instead of the UI widgets so that this method
+ * works even if the preference page has not yet been generated. If the
+ * argument is null, a new Configuration structure is allocated; otherwise the
+ * fields of the argument are filled in. The argument or newly allocated
+ * object is returned.
+ * @param options if not null, the structure to fill in
+ * @return An Configuration structure initialized to the current preference store settings.
+ */
+ static public Configuration extractOptions(Configuration smtConfig) {
+ if (smtConfig == null) {
+ smtConfig = new Configuration();
+ }
+ Activator.verbose = poptions.verbosePlugin.getValue();
+ smtConfig.verbose = poptions.verbose.getValue() ? 1 : 0;
+ smtConfig.solverVerbosity = poptions.solverVerbosity.getValue();
+ smtConfig.nosuccess = !poptions.printSuccess.getValue();
+ smtConfig.abort = poptions.abort.getValue();
+ smtConfig.echo = poptions.echo.getValue();
+ smtConfig.relax = poptions.relax.getValue();
+
+ smtConfig.logic = null;
+// if (poptions.logic.getIndexValue() == 0) options.logic = null; // FIXME - implement implicit logic?
+// else options.logic = poptions.logic.getStringValue();
+
+ smtConfig.solvername = poptions.defaultSolver.getStringValue();
+ smtConfig.logicPath = poptions.logics.getValue();
+ if (smtConfig.logicPath.trim().isEmpty()) smtConfig.logicPath = null;
+ if (Activator.verbose) Activator.log.logln("Extracted options");
+ return smtConfig;
+ }
+
+
+ static PreferenceWidget.ChoiceWidget logicChoiceWidget;
+ static PreferenceWidget.DirectoryWidget logicPathWidget;
+ /**
+ * An array of the SMT option widgets.
+ */
+ static private PreferenceWidget[] options = {
+ new PreferenceWidget.BooleanWidget(poptions.verbose),
+ new PreferenceWidget.IntWidget(poptions.solverVerbosity, new String[]{"0","1","2","3","4","5","6","7","8","9"}),
+ new PreferenceWidget.BooleanWidget(poptions.printSuccess),
+ new PreferenceWidget.BooleanWidget(poptions.abort),
+ new PreferenceWidget.BooleanWidget(poptions.echo),
+ new PreferenceWidget.BooleanWidget(poptions.relax),
+ new PreferenceWidget.ChoiceWidget(poptions.defaultSolver),
+ logicChoiceWidget=new PreferenceWidget.ChoiceWidget(poptions.logic),
+ logicPathWidget=new PreferenceWidget.DirectoryWidget(poptions.logics),
+ };
+
+ static private PreferenceWidget[] solverConfig = new PreferenceWidget[poptions.execOptions.size()];
+
+
+ static {
+ List list = new LinkedList();
+ for (AbstractPreference.StringOption s: poptions.execOptions) {
+ list.add(new PreferenceWidget.FileWidget(s));
+ }
+ solverConfig = list.toArray(solverConfig);
+ // FIXME _ have not been able to get this to work
+// logicPathWidget.addModifyListener( new ModifyListener() {
+// public void modifyText(ModifyEvent e) {
+// if (logicPathWidget != null && logicChoiceWidget != null && poptions != null && poptions.logic != null) {
+// poptions.logic = dynamicLogicList(POptions.logicKey,logicPathWidget.value());
+// logicChoiceWidget.setChoices(poptions.logic.choices());
+// }
+// }
+// });
+ }
+
+ static final public String getExec(String solver) throws java.lang.Exception {
+ String key = POptions.execKey(solver);
+ for (AbstractPreference.StringOption p: poptions.execOptions) {
+ if (p.key().equals(key)) return p.getValue();
+ }
+ return null;
+ }
+
+ /**
+ * An array of widgets for plugin options.
+ */
+ static final private PreferenceWidget[] pluginOptions = {
+ new PreferenceWidget.BooleanWidget(poptions.verbosePlugin),
+ };
+
+// static final private PreferenceWidget[] execOptions = new PreferenceWidget[poptions.execOptions.size()];
+// {
+// int i = 0;;
+// for (AbstractPreference.StringOption p: poptions.execOptions) {
+// execOptions[i++] = new PreferenceWidget.StringWidget(p);
+// }
+// }
+
+ /**
+ * Creates the property page controls and initializes them.
+ *
+ * @param parent The UI object into which to insert the controls
+ * @return The new control that is added to 'parent'
+ */
+ protected Control createContents(Composite parent) {
+
+ // Creates the contents of the property page view.
+
+ CTabFolder tf = new CTabFolder(parent, SWT.TOP|SWT.MULTI|SWT.FLAT);
+ CTabItem mainTab = new CTabItem(tf,SWT.NONE,0);
+ mainTab.setText("General");
+ CTabItem solverTab = new CTabItem(tf,SWT.NONE,1);
+ solverTab.setText("Solvers");
+ Composite generalComposite = new Widgets.VComposite(tf);
+ mainTab.setControl(generalComposite);
+ Composite solverComposite = new Widgets.VComposite(tf);
+ solverTab.setControl(solverComposite);
+ addWidgets(solverConfig,solverComposite);
+
+ Composite composite0 = generalComposite;
+ new Label(composite0, SWT.CENTER).setText("SMT version: " + org.smtlib.Version.version());
+ new Label(composite0, SWT.CENTER)
+ .setText("These choices are workspace options that apply to every SMT-LIB project.");
+
+ new Widgets.LabeledSeparator(composite0, "Configuration relating to the plugin");
+ addWidgets(pluginOptions, composite0);
+ new Widgets.LabeledSeparator(composite0, "Configuration relating to SMT");
+ addWidgets(options, composite0);
+
+ tf.showItem(mainTab);
+ tf.setSelection(mainTab);
+ return composite0;
+
+ }
+
+// /**
+// * Constructs the view of the property page by adding different features like
+// * labels, and setting the layout. Just a helper to createContents()
+// * .
+// *
+// * @param parent The parent composite to which the controls are added
+// * @return The resulting control that defined the looking of the property page
+// */
+// private Control addControl(Composite parent) {
+// Composite composite0 = new Widgets.VComposite(parent);
+//
+// new Label(composite0, SWT.CENTER).setText("SMT version: " + org.smtlib.Utils.SW_VERSION);
+// new Label(composite0, SWT.CENTER)
+// .setText("These options are workspace options that apply to every SMT-LIB project.");
+// // Composite composite0 = new Widgets.HComposite(composite0a, 2);
+// // Composite composite1 = new Widgets.VComposite(composite0);
+// // Composite composite2a = new Widgets.VComposite(composite0);
+// // Composite composite2 = new Widgets.HComposite(composite2a, 2);
+// // Composite composite3 = new Widgets.VComposite(composite2);
+// // Composite composite4 = new Widgets.VComposite(composite2);
+//
+// // new Widgets.LabeledSeparator(composite0, "Configuration relating to Eclipse");
+// // addWidgets(eclipseOptions, composite0);
+// // new Widgets.LabeledSeparator(composite0, "Configuration relating to Java");
+// // addWidgets(javaOptions, composite0);
+// new Widgets.LabeledSeparator(composite0, "Configuration relating to the plugin");
+// addWidgets(pluginOptions, composite0);
+// new Widgets.LabeledSeparator(composite0, "Configuration relating to SMT");
+// addWidgets(options, composite0);
+// // new Widgets.LabeledSeparator(composite0, "Configuration for debugging");
+// // addWidgets(debugOptions, composite0);
+//
+// return composite0;
+// }
+
+ /**
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ // When OK is pressed, set all the options selected.
+ setOptionValue(pluginOptions);
+ setOptionValue(options);
+ setOptionValue(solverConfig);
+
+ if (false) {
+ // FIXME _ hard coded array positions is fragile
+ poptions.logic = dynamicLogicList(POptions.logicKey,logicPathWidget.value());
+ logicChoiceWidget.setChoices(poptions.logic.choices());
+ }
+ AbstractPreference.notifyListeners();
+ return true;
+ }
+
+ public void performDefaults() {
+ // When OK is pressed, set all the options selected.
+ setDefaults(pluginOptions);
+ setDefaults(options);
+ setDefaults(solverConfig);
+ }
+
+ /** Calls setDefault for each widget in the list
+ *
+ * @param ws an array of widgets to be processed
+ */
+ //@ requires ws != null;
+ //@ requires \nonnullelements(ws);
+ public void setDefaults(PreferenceWidget[] ws) {
+ for (int i = 0; i= 0 && offset < ws.length;
+ //@ requires num >= 0 && offset + num < ws.length;
+ //@ requires \nonnullelements(ws);
+ public void addWidgets(PreferenceWidget[] ws, int offset, int num, Composite composite) {
+ for (int i=0; i= 1? finalLineNumber : 0);
- marker.setAttribute(IMarker.CHAR_START, finalOffset);
- marker.setAttribute(IMarker.CHAR_END, finalEnd);
-
- // Note - it appears that CHAR_START is measured from the beginning of the
- // file and overrides the line number
- // However, the LINE_NUMBER attribute is used for the 'Location' column
- // of the Problems view
-
- marker.setAttribute(IMarker.SEVERITY,finalSeverity);
- marker.setAttribute(IMarker.MESSAGE, finalErrorMessage);
- }
- };
- r.getWorkspace().run(runnable, null); // FIXME - should we use a specified ISchedulingRule?
- } catch (Exception e) {
- Activator.log.errorlog("Failed to make a marker " + e,e);
- }
- }
-}
+/*
+ * This file is part of the SMT plugin project.
+ * Copyright 2010 David R. Cok
+ * Created August 2010
+ */
+package org.smtlib.plugin;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.smtlib.IPos;
+
+/** This class listens to log messages from the org.smtlib.Log message logger;
+ * it converts any error messages it hears into Eclipse problem markers.
+ * @author David Cok
+ *
+ */
+public class ProblemListener implements org.smtlib.Log.IListener {
+
+ @Override
+ public void indent(String prompt) {
+ }
+
+ /** Hears error messages from the parent interface */
+ @Override
+ public void logError(org.smtlib.IResponse.IError r) {
+ notify(r);
+ }
+
+ /** Hears error messages from the parent interface */
+ @Override
+ public void logError(String msg) {
+ // Positionless error messages are shown in a dialog box
+ Activator.utils.showMessageInUI(null,"SMT Error", msg);
+ }
+
+ /** Hears regular messages from the parent interface */
+ @Override
+ public void logOut(String message) { // Don't capture these
+ }
+
+ /** Hears regular messages from the parent interface */
+ @Override
+ public void logOut(org.smtlib.IResponse r) { // Don't capture these
+ }
+
+ /** Hears diagnostic messages from the parent interface */
+ @Override
+ public void logDiag(String message) { // Don't capture these
+ }
+
+ /** Does the actual work of creating a marker for the given CommandResult */
+ public void notify(org.smtlib.IResponse.IError result) {
+ try {
+ IResource f = null;
+ String msg = Activator.smtConfiguration.defaultPrinter.toString(result);
+ if (!(result instanceof IPos.IPosable)) {
+ Activator.utils.showMessageInUI(null,"SMT Error", msg);
+ return;
+ }
+ IPos pos = ((IPos.IPosable)result).pos();
+ if (pos == null) {
+ Activator.utils.showMessageInUI(null,"SMT Error", msg);
+ return;
+ }
+ if (pos.source() == null) {
+ Activator.utils.showMessageInUI(null,"SMT Error", msg);
+ return;
+ }
+ Object location = pos.source().location();
+ if (location == null) {
+ Activator.utils.showMessageInUI(null,"SMT Error", msg);
+ return;
+ }
+
+ String filename = location.toString(); // Note: locations are not necessarily paths,
+ // but if it is not, I presume we'll just not find it
+ // in the workspace further on
+ IWorkspace w = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = w.getRoot();
+ //Activator.log.log("LOC " + root.getLocation() + " " + filename);
+ f = root.findMember(filename);
+ if (f == null) {
+ Path path = new Path(filename);
+ f = root.getFileForLocation(path);
+ filename = filename.substring(root.getLocation().toString().length());
+ }
+ if (f == null) {
+ Activator.log.logln("Could not find resource " + filename); // FIXME - errorlog?
+ f = root;
+ }
+ // Use the following if you want problems printed to the console
+ // as well as producing markers and annotations
+
+ final IResource r = f;
+ final int finalOffset = pos.charStart();
+ final int finalEnd = pos.charEnd();
+ final int finalLineNumber = pos.source().lineNumber(finalOffset);
+ final String finalErrorMessage = result.errorMsg();
+ final int finalSeverity = IMarker.SEVERITY_ERROR ; // All SMT problems are errors, not warnings
+
+ // Eclipse recommends that things that modify the resources
+ // in a workspace be performed in a IWorkspaceRunnable
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+ //JAVA16 @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ IMarker marker = r.createMarker(Utils.SMT_MARKER_ID);
+ marker.setAttribute(IMarker.LINE_NUMBER,
+ finalLineNumber >= 1? finalLineNumber : 0);
+ marker.setAttribute(IMarker.CHAR_START, finalOffset);
+ marker.setAttribute(IMarker.CHAR_END, finalEnd);
+
+ // Note - it appears that CHAR_START is measured from the beginning of the
+ // file and overrides the line number
+ // However, the LINE_NUMBER attribute is used for the 'Location' column
+ // of the Problems view
+
+ marker.setAttribute(IMarker.SEVERITY,finalSeverity);
+ marker.setAttribute(IMarker.MESSAGE, finalErrorMessage);
+ }
+ };
+ r.getWorkspace().run(runnable, null); // FIXME - should we use a specified ISchedulingRule?
+ } catch (Exception e) {
+ Activator.log.errorlog("Failed to make a marker " + e,e);
+ }
+ }
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/SMTPropertyPage.java b/SMTPlugin/src/org/smtlib/plugin/SMTPropertyPage.java
index 691a348..503da0f 100644
--- a/SMTPlugin/src/org/smtlib/plugin/SMTPropertyPage.java
+++ b/SMTPlugin/src/org/smtlib/plugin/SMTPropertyPage.java
@@ -1,132 +1,132 @@
-/*
- * This file is part of the SMT plugin project.
- * Copyright 2010 David R. Cok
- * Created August 2010
- */
-package org.smtlib.plugin;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-// FIXME - not actually using this class - this is for a project specific property page, I think.
-
-public class SMTPropertyPage extends PropertyPage {
-
- private static final String PATH_TITLE = "Path:";
- private static final String OWNER_TITLE = "&Owner:";
- private static final String OWNER_PROPERTY = "OWNER";
- private static final String DEFAULT_OWNER = "John Doe";
-
- private static final int TEXT_FIELD_WIDTH = 50;
-
- private Text ownerText;
-
- /**
- * Constructor for SamplePropertyPage.
- */
- public SMTPropertyPage() {
- super();
- }
-
- private void addFirstSection(Composite parent) {
- Composite composite = createDefaultComposite(parent);
-
- //Label for path field
- Label pathLabel = new Label(composite, SWT.NONE);
- pathLabel.setText(PATH_TITLE);
-
- // Path text field
- Text pathValueText = new Text(composite, SWT.WRAP | SWT.READ_ONLY);
- pathValueText.setText(((IResource) getElement()).getFullPath().toString());
- }
-
- private void addSeparator(Composite parent) {
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- separator.setLayoutData(gridData);
- }
-
- private void addSecondSection(Composite parent) {
- Composite composite = createDefaultComposite(parent);
-
- // Label for owner field
- Label ownerLabel = new Label(composite, SWT.NONE);
- ownerLabel.setText(OWNER_TITLE);
-
- // Owner text field
- ownerText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- GridData gd = new GridData();
- gd.widthHint = convertWidthInCharsToPixels(TEXT_FIELD_WIDTH);
- ownerText.setLayoutData(gd);
-
- // Populate owner text field
- try {
- String owner =
- ((IResource) getElement()).getPersistentProperty(
- new QualifiedName("", OWNER_PROPERTY));
- ownerText.setText((owner != null) ? owner : DEFAULT_OWNER);
- } catch (CoreException e) {
- ownerText.setText(DEFAULT_OWNER);
- }
- }
-
- /**
- * @see Preferences#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL);
- data.grabExcessHorizontalSpace = true;
- composite.setLayoutData(data);
-
- addFirstSection(composite);
- addSeparator(composite);
- addSecondSection(composite);
- return composite;
- }
-
- private Composite createDefaultComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
-
- return composite;
- }
-
- protected void performDefaults() {
- super.performDefaults();
- // Populate the owner text field with the default value
- ownerText.setText(DEFAULT_OWNER);
- }
-
- public boolean performOk() {
- // store the value in the owner text field
- try {
- ((IResource) getElement()).setPersistentProperty(
- new QualifiedName("", OWNER_PROPERTY),
- ownerText.getText());
- } catch (CoreException e) {
- return false;
- }
- return true;
- }
-
-}
+/*
+ * This file is part of the SMT plugin project.
+ * Copyright 2010 David R. Cok
+ * Created August 2010
+ */
+package org.smtlib.plugin;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+// FIXME - not actually using this class - this is for a project specific property page, I think.
+
+public class SMTPropertyPage extends PropertyPage {
+
+ private static final String PATH_TITLE = "Path:";
+ private static final String OWNER_TITLE = "&Owner:";
+ private static final String OWNER_PROPERTY = "OWNER";
+ private static final String DEFAULT_OWNER = "John Doe";
+
+ private static final int TEXT_FIELD_WIDTH = 50;
+
+ private Text ownerText;
+
+ /**
+ * Constructor for SamplePropertyPage.
+ */
+ public SMTPropertyPage() {
+ super();
+ }
+
+ private void addFirstSection(Composite parent) {
+ Composite composite = createDefaultComposite(parent);
+
+ //Label for path field
+ Label pathLabel = new Label(composite, SWT.NONE);
+ pathLabel.setText(PATH_TITLE);
+
+ // Path text field
+ Text pathValueText = new Text(composite, SWT.WRAP | SWT.READ_ONLY);
+ pathValueText.setText(((IResource) getElement()).getFullPath().toString());
+ }
+
+ private void addSeparator(Composite parent) {
+ Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ separator.setLayoutData(gridData);
+ }
+
+ private void addSecondSection(Composite parent) {
+ Composite composite = createDefaultComposite(parent);
+
+ // Label for owner field
+ Label ownerLabel = new Label(composite, SWT.NONE);
+ ownerLabel.setText(OWNER_TITLE);
+
+ // Owner text field
+ ownerText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ GridData gd = new GridData();
+ gd.widthHint = convertWidthInCharsToPixels(TEXT_FIELD_WIDTH);
+ ownerText.setLayoutData(gd);
+
+ // Populate owner text field
+ try {
+ String owner =
+ ((IResource) getElement()).getPersistentProperty(
+ new QualifiedName("", OWNER_PROPERTY));
+ ownerText.setText((owner != null) ? owner : DEFAULT_OWNER);
+ } catch (CoreException e) {
+ ownerText.setText(DEFAULT_OWNER);
+ }
+ }
+
+ /**
+ * @see Preferences#createContents(Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ composite.setLayout(layout);
+ GridData data = new GridData(GridData.FILL);
+ data.grabExcessHorizontalSpace = true;
+ composite.setLayoutData(data);
+
+ addFirstSection(composite);
+ addSeparator(composite);
+ addSecondSection(composite);
+ return composite;
+ }
+
+ private Composite createDefaultComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ composite.setLayoutData(data);
+
+ return composite;
+ }
+
+ protected void performDefaults() {
+ super.performDefaults();
+ // Populate the owner text field with the default value
+ ownerText.setText(DEFAULT_OWNER);
+ }
+
+ public boolean performOk() {
+ // store the value in the owner text field
+ try {
+ ((IResource) getElement()).setPersistentProperty(
+ new QualifiedName("", OWNER_PROPERTY),
+ ownerText.getText());
+ } catch (CoreException e) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/SettingsPage.java b/SMTPlugin/src/org/smtlib/plugin/SettingsPage.java
index e57a662..4d26632 100644
--- a/SMTPlugin/src/org/smtlib/plugin/SettingsPage.java
+++ b/SMTPlugin/src/org/smtlib/plugin/SettingsPage.java
@@ -1,43 +1,43 @@
-package org.smtlib.plugin;
-
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.DirectoryFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * This class creates a Code Sonar Preferences page in Eclipse
- * This page hold data needed for CodeSonar and Eclipse interaction
- *
- * @author sjohnson
- *
- */
-public class SettingsPage extends FieldEditorPreferencePage implements
-IWorkbenchPreferencePage {
-
- @Override
- public void init(IWorkbench workbench) {
- setPreferenceStore(Activator.getDefault().getPreferenceStore());
- }
-
- @Override
- protected void createFieldEditors() {
-// addField(new DirectoryFieldEditor("CODESONARPATH" ,
-// "&Code Sonar Path",
-// getFieldEditorParent()));
-// addField(new StringFieldEditor("HUB", "&Code Sonar Hub",
-// getFieldEditorParent()));
-// addField(new StringFieldEditor("USERNAME", "&Code Sonar Username",
-// getFieldEditorParent()));
-// Composite fieldEditorParent = getFieldEditorParent();
-// password = new StringFieldEditor("PASSWORD", "&Code Sonar Password",
-// fieldEditorParent);
-// password.getTextControl(fieldEditorParent).setEchoChar('*');
-// addField(password);
-// addField(new BooleanFieldEditor("NO_SERVICES", "&No Services",
-// getFieldEditorParent()));
- }
-}
+package org.smtlib.plugin;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.DirectoryFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * This class creates a Code Sonar Preferences page in Eclipse
+ * This page hold data needed for CodeSonar and Eclipse interaction
+ *
+ * @author sjohnson
+ *
+ */
+public class SettingsPage extends FieldEditorPreferencePage implements
+IWorkbenchPreferencePage {
+
+ @Override
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ }
+
+ @Override
+ protected void createFieldEditors() {
+// addField(new DirectoryFieldEditor("CODESONARPATH" ,
+// "&Code Sonar Path",
+// getFieldEditorParent()));
+// addField(new StringFieldEditor("HUB", "&Code Sonar Hub",
+// getFieldEditorParent()));
+// addField(new StringFieldEditor("USERNAME", "&Code Sonar Username",
+// getFieldEditorParent()));
+// Composite fieldEditorParent = getFieldEditorParent();
+// password = new StringFieldEditor("PASSWORD", "&Code Sonar Password",
+// fieldEditorParent);
+// password.getTextControl(fieldEditorParent).setEchoChar('*');
+// addField(password);
+// addField(new BooleanFieldEditor("NO_SERVICES", "&No Services",
+// getFieldEditorParent()));
+ }
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/Utils.java b/SMTPlugin/src/org/smtlib/plugin/Utils.java
index 8625ea0..522ee95 100644
--- a/SMTPlugin/src/org/smtlib/plugin/Utils.java
+++ b/SMTPlugin/src/org/smtlib/plugin/Utils.java
@@ -1,789 +1,789 @@
-/*
- * This file is part of the SMT plugin project.
- * Copyright 2010 David R. Cok
- * Created August 2010
- */
-package org.smtlib.plugin;
-
-// FIXME - still needs review
-// FIXME - need to be sure that the showMessage... methods are called in the UI context when they need to be
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringBufferInputStream;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.smtlib.IResponse;
-import org.smtlib.SMT;
-
-/** This class holds utility values and methods to support the Eclipse plugin.
- *
- * @author David Cok
- *
- */
-public class Utils {
-
- final static String windowHeader = "SMT Plugin";
-
- /** This class is used to wrap arbitrary exceptions coming from the plug-in */
- public static class PluginException extends RuntimeException {
- /** Default serial version Symbol */
- private static final long serialVersionUID = 1L;
-
- /** Used to signal some unexpected error situation during plug-in processing. */
- public PluginException(String error) {
- super(error);
- }
- /** Used to signal some unexpected error situation during plug-in processing. */
- public PluginException(String error, /*@NonNull*/ java.lang.Exception e) {
- super(error,e);
- }
- }
-
- /** The Symbol of the marker, which must match that in the plugin file. */
- final public static String SMT_MARKER_ID = Activator.PLUGIN_ID + ".SMTProblem";
-
-
- /** Run a specific solver on the given text, belonging to the given file (unsaved edits), in a computational job.
- * If solver is null, then use the default from the options. Call the method from the UI thread.
- */
- public void runSolver(String solver, IFile file, String text) {
- if (solver == null) solver = Preferences.poptions.defaultSolver.getStringValue();
- String exec = "";
- // FIXME - there is a lot of code in common with the previous method
- if (!solver.equals(org.smtlib.Utils.TEST_SOLVER)) try {// FIXME - make "test" a symbolic constant
- exec = Preferences.getExec(solver);
- if (exec == null) {
- Activator.log.errorlog("SMT: INTERNAL ERROR: Could not find an executable option for " + solver,null);
- return;
- }
- File execFile = new File(exec);
- if (!execFile.exists()) {
- Activator.utils.showMessageInUI(null,windowHeader,"The executable path for this solver does not appear to exist: " + solver + " \"" + exec + "\"");
- return;
- }
- if (!execFile.canExecute()) {
- Activator.utils.showMessageInUI(null,windowHeader,"The executable path for this solver does not appear to be executable: " + solver + " " + exec);
- return;
- }
- } catch (java.lang.Exception e) {
- Activator.log.errorlog("SMT: Could not find the executable for the solver " + solver,e);
- return;
- }
- if (Activator.verbose) Activator.log.logln("ISolver = " + solver);
- try {
- SMT smt = new SMT();
- smt.smtConfig = Activator.smtConfiguration.clone();
- smt.smtConfig.files = null;
- String[] cmd = text == null ? new String[]{ "-s", solver, "--exec", exec, file.getLocation().toString() }
- : new String[]{ "-s", solver, "--exec", exec, "--text", text, file.getLocation().toString() };
- deleteMarkers(file,null);
- boolean batch = false;
- if (batch) { // FIXME - get rid of launchJob now?
- launchJob(file.getLocation().toString(),smt,cmd,null);
- } else {
- interactiveJob(file.getLocation().toString(),smt,cmd,null);
- }
- } catch (java.lang.Exception e) {
- Activator.log.errorlog("SMT - Internal exception",e);
- }
- }
-
- SMT saved_smt = null;
-
- /** Executes the given command (cmd) by the smt instance as a computational (non-UI) Job
- *
- * @param name name of the Job
- * @param smt the SMT instance in which to execute the commands
- * @param cmd the command to execute
- * @param shell the shell in which to display any UI messages
- */
- public void launchJob(String name, final SMT smt, final String[] cmd, /*@Nullable*/ final Shell shell) {
- Job j = new Job("SMT Solver: " + name) {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- boolean c = false;
- try {
- smt.smtConfig.log.numErrors = 0;
- int exitCode = smt.exec(cmd);
- String timestring = "[" + new Date().toString() + "] ";
- Activator.log.logln(timestring + "Completed " + cmd[1]
- + (exitCode == 0 ? "" : " (exitcode=" + exitCode +")")
- + (smt.smtConfig.log.numErrors == 0? "" : (" : " + smt.smtConfig.log.numErrors + " errors"))
- + (smt.checkSatStatus == null ? "(no result)" : (" " + smt.smtConfig.defaultPrinter.toString(smt.checkSatStatus)))
- );
- } catch (PluginException e) {
- showMessageInUI(shell,"SMT PluginException",e.getClass() + " - " + e.getMessage());
- c = true;
- }
- return c ? Status.CANCEL_STATUS : Status.OK_STATUS;
- }
- };
- j.setUser(true); // true = initiated by an end-user
- j.schedule();
- }
-
- /** Executes the given command within the given SMT object,
- * reporting results on the console and to the given shell;
- * 'name' is an informational name giving the file being working on;
- * this method must be called in a computational thread.
- */
- public void interactiveJob(String name, SMT smt, String[] cmd, /*@Nullable*/ final Shell shell) {
- try {
- smt.smtConfig.log.numErrors = 0;
- int exitCode = smt.exec(cmd);
- String timestring = "[" + new Date().toString() + "] ";
- Activator.log.logln(timestring + "Completed " + cmd[1] + " on " + name + " :"
- + (exitCode == 0 ? "" : " (exitcode=" + exitCode +")")
- + (smt.smtConfig.log.numErrors == 0? "" : (" : " + smt.smtConfig.log.numErrors + " errors"))
- + (smt.checkSatStatus == null ? "(no result)" : (" " + smt.smtConfig.defaultPrinter.toString(smt.checkSatStatus)))
- );
- } catch (PluginException e) {
- showMessageInUI(shell,"SMT PluginException",e.getClass() + " - " + e.getMessage());
- }
- saved_smt = smt;
- }
-
- /** This runs a type-check only on the given text, in the UI thread. */
- public void runCheck(IFile file, String text) {
- if (text.length() > 1000000) return; // FIXME - disable for large text
- try {
- SMT smt = new SMT();
- // FIXME - would rather not clone the configuration and allocate
- // a new log and ProblemListener on each edit, but we might want
- // to have any configuration parameters in force as they change
- smt.smtConfig = Activator.smtConfiguration.clone();
- smt.smtConfig.log = new org.smtlib.Log(smt.smtConfig);
- smt.smtConfig.log.clearListeners(); // This removes the standard listener that would otherwise send log information to the console
- smt.smtConfig.log.addListener(new ProblemListener());
-
- smt.smtConfig.files = null;
- String[] cmd = new String[]{ "-s", org.smtlib.Utils.TEST_SOLVER, "--text", text, file.getFullPath().toString() };
- deleteMarkers(file,null);
- smt.exec(cmd);
- //launchJob("interactive",smt,cmd,null);
- } catch (java.lang.Exception e) {
- Activator.log.errorlog("SMT - Internal exception",e);
- }
- }
-
-
- /** Returns the ITextSelection corresponding to a selection, if there is one (null otherwise). */
- /*@Nullable*/
- static public ITextSelection getSelectedText(ISelection selection) {
- if (!selection.isEmpty() && selection instanceof ITextSelection) {
- return (ITextSelection)selection;
- } else {
- return null;
- }
- }
-
-
- /**
- * This method interprets the selection returning a List of IResources, and
- * ignoring things it does not know how to handle. The selection is ignored
- * if it is not an IStructuredSelection (e.g. ITextSelections are ignored).
- * If the selection is empty and 'window'
- * is non-null, then the routine attempts to find a resource that corresponds
- * to the currently active editor. The method expects to be called in the UI thread,
- *
- *
IResource - added directly to list, whether a file or a container
- *
working set - adds the elements of the working set if they can be
- * converted (through IAdaptor) to an IResource
- *
IJavaElement - adds the IResource that contains the element
- *
otherwise - ignored
- *
- *
- * @param selection The selection to inspect
- * @param window The window in which a selected editor exists
- * @param shell the shell to use in displaying information dialogs
- * @return A List of IResources found in the selection
- */
- public List getSelectedResources(ISelection selection,
- /*@Nullable*/ IWorkbenchWindow window, /*@Nullable*/ Shell shell) {
- List list = new LinkedList();
- if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- for (Iterator> iter = structuredSelection.iterator(); iter.hasNext(); ) {
- Object element = iter.next();
- if (element instanceof IResource) {
- list.add((IResource)element);
- } else if (element instanceof IWorkingSet) {
- for (IAdaptable a: ((IWorkingSet)element).getElements()) {
- IResource r = (IResource) a.getAdapter(IResource.class);
- if (r != null) list.add(r);
- }
- continue;
- } else if (element instanceof IAdaptable) {
- IResource r = (IResource) ((IAdaptable)element).getAdapter(IResource.class);
- if (r != null) list.add(r);
- }
- }
- } else {
- // We had nothing selected
- // Look for the active editor instead
- try {
- IEditorPart p = window.getActivePage().getActiveEditor();
- IEditorInput e = p==null? null : p.getEditorInput();
- IResource o = e==null ? null : (IFile)e.getAdapter(IFile.class);
- if (o != null) {
- list.add(o); // This is an IFile
- }
- } catch (PluginException ee) {
- // These methods expect to be called in the UI thread.
- Activator.log.errorlog("PluginException when finding selected targets: " + ee,ee);
- showMessage(shell,"JML Plugin PluginException","PluginException occurred when finding selected targets: " + ee);
- }
- }
- return list;
- }
-
- /** Creates a list of all the selected files, or files that are in selected containers. */
- public List getSelectedFiles(ISelection selection,
- /*@Nullable*/ IWorkbenchWindow window, /*@Nullable*/ Shell shell) throws CoreException {
- List list = new LinkedList();
- if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- for (Iterator> iter = structuredSelection.iterator(); iter.hasNext(); ) {
- Object element = iter.next();
- if (element instanceof IResource) {
- addFiles((IResource)element,list);
- } else if (element instanceof IWorkingSet) {
- for (IAdaptable a: ((IWorkingSet)element).getElements()) {
- IResource r = (IResource) a.getAdapter(IResource.class);
- if (r != null) addFiles(r,list);
- }
- } else if (element instanceof IAdaptable) {
- IResource r = (IResource) ((IAdaptable)element).getAdapter(IResource.class);
- if (r != null) addFiles(r,list);
- }
- }
- }
- return list;
- }
-
- // TODO - duplicated with Preferences.solverNames, and should be made configurable
- final String[] solverList = new String[]{ "simplify", "yices", "cvc", "z3_2_11", "z3_4_3"};
-
- /** Interprets the input string (the action id, as in action.getId()) to
- * determine which solvers to run, returning their names in a list.
- */
- public List getSolvers(String id) {
- List solvers = new LinkedList();
- int i = id.lastIndexOf('.');
- String name = id.substring(i+1);
- if ("All".equals(name)) {
- for (String s: solverList) solvers.add(s);
- } else if ("default".equals(name)) {
- name = Preferences.poptions.defaultSolver.getStringValue();
- solvers.add(name);
- } else {
- solvers.add(name);
- }
- return solvers;
- }
-
- public void runJobs(final List solvers, final List files) {
- Job j = new Job("SMT Solving") {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- IStatus status = Status.OK_STATUS;
- if (monitor != null) {
- monitor.beginTask("SMT solving", solvers.size() * (files.isEmpty() ? 1 : files.size()));
- }
- for (IFile file: files) {
- for (String solver: solvers) {
- try {
- if (monitor != null) monitor.subTask(solver + " on " + file.getName().substring(file.getName().lastIndexOf('/')+1));
- runSolver(solver,file,text);
- } catch (Exception e) {
- Activator.log.errorlog("Exception while executing " + solver + " on " + file.getName() + ": " + e,e);
- }
- if (monitor != null) {
- monitor.worked(1);
- if (monitor.isCanceled()) {
- status = Status.CANCEL_STATUS;
- break;
- }
- }
- }
- }
- if (monitor != null) {
- monitor.done();
- }
- return status;
- }
- };
- j.setUser(true); // true = initiated by an end-user
- j.schedule();
- }
-
- /** Finds the selected editor; if it is a TextEditor, then if the editor is
- * dirty, runs the solver on the text; if the editor is not dirty, runs the
- * solver on the file. Returns true if successfully found file or text on which
- * to run; returns false otherwise.
- *
- * This must be called in the UI thread; executes the check in a computational Job.
- * */
- public boolean runSolverOnSelectedEditor(String solver, List files) throws CoreException {
- for (IFile r: files) runSolver(solver,r,text);
- return true;
- }
-
- String text;
-
- // FIXME - document
- public List resources(ISelection selection,
- /*@Nullable*/ IWorkbenchWindow window, /*@Nullable*/ Shell shell) throws CoreException {
- IFile file = null;
- List list = new LinkedList();
- text = null;
- try {
- IWorkbenchPage page = window == null ? null : window.getActivePage();
- IEditorPart p = page == null ? null : window.getActivePage().getActiveEditor();
- IEditorInput e = p==null? null : p.getEditorInput();
- file = e==null ? null : (IFile)e.getAdapter(IFile.class);
- if (file == null) return null;
- if (p instanceof ITextEditor) {
- list.add(file);
- if (p.isDirty()) {
- IDocumentProvider doc = ((ITextEditor)p).getDocumentProvider();
- if (doc == null) return null;
- IDocument d = doc.getDocument(e);
- if (d == null) return null;
- text = d.get();
- }
- }
- } catch (PluginException ee) {
- // These calls expect to be in the UI thread
- Activator.log.errorlog("PluginException when finding selected targets: " + ee,ee);
- showMessage(shell,"JML Plugin PluginException","PluginException occurred when finding selected targets: " + ee);
- }
- return list;
- }
-
- /** This adds files in the given resource to the list; if the resource is a container, it
- * adds the files that are in the container.
- */
- private void addFiles(IResource resource, List list) throws CoreException {
- if (resource instanceof IFile) {
- if (resource.getName().toString().endsWith(org.smtlib.Utils.SUFFIX)) {
- //Activator.log.log("ADDING " + resource.getLocation().toString());
- list.add((IFile)resource);
- }
- return;
- } else if (resource instanceof IContainer) {
- for (IResource r: ((IContainer)resource).members()) {
- addFiles(r,list);
- }
- }
- }
-
-
- // FIXME - should resource things be happening in another thread?
- /** Deletes all JML markers from the items selected, right within the UI thread,
- * without a progress dialog. The resources for which markers are deleted are
- * those returned by Utils.getSelectedResources. This should be called from
- * the UI thread.
- * @param selection the IStructuredSelection whose markers are to be deleted
- * @param window the current workbench window, or null (used in getSelectedResources)
- * @param shell the current Shell, or null for the default shell (for message dialogs)
- */
- public void deleteMarkersInSelection(ISelection selection, IWorkbenchWindow window, Shell shell) {
- List list = getSelectedResources(selection,window,shell);
- //list.add(ResourcesPlugin.getWorkspace().getRoot()); // FIXME - temporarily here to clear out unrooted markers
- if (list.isEmpty()) {
- showMessage(shell,windowHeader,"Nothing appropriate to delete markers of");
- return;
- }
- deleteMarkers(list,shell);
- return;
- }
-
-
- /** This class is an implementation of the interfaces needed to provide input
- * to and launch editors in the workspace.
- * @author David R. Cok
- */
- public static class StringStorage implements IStorage, IStorageEditorInput {
- /** The initial content of the editor */
- private String content;
- /** The name of storage unit (e.g. the file name) */
- private String name;
-
- /** A constructor for a new storage unit */
- //@ assignable this.*;
- public StringStorage(String content, String name) {
- this.content = content;
- this.name = name;
- }
-
- /** Interface method that returns the contents of the storage unit */
- //JAVA16 @Override
- public InputStream getContents() throws CoreException {
- return new StringBufferInputStream(content);
- }
-
- /** Returns the path to the underlying resource
- * @return null (not needed for readonly Strings)
- */
- //JAVA16 @Override
- public IPath getFullPath() {
- return null;
- }
-
- /** Returns the name of the storage object
- * @return the name of the storage unit
- */
- //JAVA16 @Override
- public String getName() { return name; }
-
- /** Returns whether the storage object is read only
- * @return always true
- */
- //JAVA16 @Override
- public boolean isReadOnly() { return true; }
-
- /** Returns the object adapted to the given class. It appears we can
- * ignore this and always return null.
- * @return null
- */
- //JAVA16 @Override
- public /*@Nullable*/ Object getAdapter(Class arg0) { return null; }
-
- /** Returns self
- * @return this object
- */
- //@ ensures \return == this;
- //JAVA16 @Override
- public IStorage getStorage() throws CoreException {
- return (IStorage)this;
- }
-
- /** Returns whether the underlying storage object exists
- * @return always true
- */
- //JAVA16 @Override
- public boolean exists() {
- return true;
- }
-
- /** Returns an ImageDescriptor, here ignored
- * @return always null
- */
- //JAVA16 @Override
- public /*@Nullable*/ ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /** Returns a corresponding Persistable object, here ignored
- * @return always null
- */
- //JAVA16 @Override
- public /*@Nullable*/ IPersistableElement getPersistable() {
- return null;
- }
-
- /** Return the text desired in a tool tip, here the name of the
- * storage unit
- */
- //@NonNull
- //JAVA16 @Override
- public String getToolTipText() {
- return name;
- }
-
- }
-
- /** Launches a read-only text editor with the given content and name
- * @param content the content of the editor
- * @param name the name (as in the title) of the editor
- */
- public void launchEditor(String content,String name) {
- try {
- IEditorInput editorInput = new StringStorage(content,name);
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- showMessageInUI(null,"SMT PluginException","No window found for editor named " + name);
- return;
- }
- IWorkbenchPage page = window.getActivePage();
- if (page == null) {
- showMessageInUI(null,"SMT PluginException","No active page found for editor named " + name);
- return;
- }
-
- // IEditorPart[] parts = page.getEditors();
- // for (IEditorPart e: parts) Log.log("EDITOR " + e.getEditorSite().getId());
- page.openEditor(editorInput, "org.eclipse.ui.DefaultTextEditor");
- } catch (java.lang.Exception e) {
- showMessageInUI(null,"SMT PluginException",e.getMessage());
- }
- }
-
- /** Deletes the SMT_MARKER_ID markers in any of the objects in the List that are
- * IResource objects; if the object is a container, markers are deleted for
- * any resources in the container; other kinds of objects are ignored.
- * Expects to be called from the UI thread.
- * @param just the type of the list
- * @param list a list of objects whose markers are to be deleted
- * @param shell the current shell for dialogs (or null for default)
- */
- public void deleteMarkers(List list, /*@Nullable*/ Shell shell) {
- StringBuilder sb = new StringBuilder();
- for (T t: list) {
- IResource resource = (IResource)t;
- String s = deleteMarkers(resource,shell);
- if (s != null) { sb.append(s); sb.append("\n"); }
- }
- String ss = sb.toString();
- if (!ss.isEmpty()) Activator.utils.showMessage(shell,windowHeader,ss);
- }
-
- /** Deletes any SMT_MARKER_ID markers on the given resource, returns an error message, if any (else null);
- * expects to be called from the UI thread. */
- public /*@Nullable*/ String deleteMarkers(IResource resource, /*@Nullable*/ Shell shell) {
- try {
- try {
- if (Activator.verbose) Activator.log.logln("Deleting markers in " + resource.getName());
- resource.deleteMarkers(SMT_MARKER_ID, false,
- IResource.DEPTH_INFINITE);
- } catch (CoreException e) {
- String msg = "Failed to delete markers on "
- + resource.getProject();
- Activator.log.errorlog(msg, e);
- }
- } catch (PluginException e) {
- Activator.log.errorlog("PluginException while deleting markers: " + e, e);
- return "PluginException while deleting markers "
- + (resource != null ? "on " + resource.getName()
- : "");
- }
- return null;
- }
-
- /**
- * Displays a message in a dialog in the UI thread - this may
- * be called from other threads.
- * @param sh The shell to use to display the dialog, or
- * a top-level shell if the parameter is null
- * @param title The title of the dialog window
- * @param msg The message to display in the dialog
- */
- public void showMessageInUI(/*@Nullable*/ Shell sh,
- final String title, final String msg) {
- final Shell shell = sh;
- Display d = shell == null ? Display.getDefault() : shell.getDisplay();
- d.asyncExec(new Runnable() {
- public void run() {
- MessageDialog.openInformation(
- shell,
- title,
- msg);
- }
- });
- }
-
- /**
- * Displays a message in a non-modal dialog in the UI thread - this may
- * be called from other threads.
- * @param sh The shell to use to display the dialog, or
- * a top-level shell if the parameter is null
- * @param title The title of the dialog window
- * @param msg The message to display in the dialog
- */
- public void showMessageInUINM(/*@Nullable*/ Shell sh,
- final String title, final String msg) {
- final Shell shell = sh;
- Display d = shell == null ? Display.getDefault() : shell.getDisplay();
- d.asyncExec(new Runnable() {
- public void run() {
- Dialog d = new NonModalDialog(
- shell,
- title,
- msg);
- d.open();
- }
- });
- }
-
- // FIXME this does not seem to be working
- static public class NonModalDialog extends MessageDialog {
- final static String[] buttons = { "OK" };
- public NonModalDialog(Shell shell, String title, String message) {
- super(new Shell(),title,null,message,INFORMATION,buttons,0);
- setShellStyle(getShellStyle()|SWT.MODELESS);
- setBlockOnOpen(false);
- }
- }
-
-
- /**
- * Displays a message in a information dialog; must be called from the UI thread.
- * @param shell Either the parent shell
- * @param title A title for the dialog window
- * @param msg The message to display in the dialog window
- */
- //@ requires msg != null;
- public void showMessage(/*@Nullable*/Shell shell, /*@Nullable*/String title, String msg) {
- MessageDialog.openInformation(
- shell,
- title,
- msg);
- }
-
- /** Shows an error dialog box for an exception; must be called from the UI thread */
- public void topLevelException(/*@Nullable*/Shell shell, String title, java.lang.Exception e) {
- //e.printStackTrace(sw); // TODO
- showMessage(shell,"SMT Top-level PluginException: " + title,
- e.toString());
- }
-
- /** Shows the logic or theory file of the selected text; error dialogs if can't find an appropriate file to show. */
- public void viewLogic(Shell shell, ISelection selection) {
- String name = "";
- String path = "";
- Reader r = null;
- InputStream stream = null;
- try {
- ITextSelection tsel = Utils.getSelectedText(selection);
- if (tsel == null) {
- Activator.utils.showMessage(shell,windowHeader,"Select the name of a logic or theory to show");
- return;
- }
- name = tsel.getText();
- if (name == null || name.length() == 0) {
- Activator.utils.showMessage(shell,windowHeader,"Select the name of a logic or theory to show");
- return;
- }
- String dir = Preferences.poptions.logics.getValue();
- if (dir != null) dir = dir.trim();
-
- if (dir == null || dir.isEmpty()) {
- try {
- stream = SMT.logicFinder.find(null,name,null);
- if (stream == null) {
- return;
- }
- r = new InputStreamReader(stream);
- } catch (IOException e) {
- showMessage(shell,"SMT View Logic","Could not read the definition file for " + name
- + "\n" + e.getMessage());
- return;
- } catch (org.smtlib.Utils.SMTLIBException e) {
- showMessage(shell,"SMT View Logic","Could not read the definition file for " + name
- + "\n" + e.errorResponse);
- return;
- }
- } else {
- String fname = dir + File.separator + name + org.smtlib.Utils.SUFFIX;
- if (Activator.verbose) Activator.log.logln("Trying to read logic file " + fname);
- File f = new File(fname);
- if (f.isFile()) r = new FileReader(f);
- }
- if (r == null) {
- showMessage(shell,"SMT View Logic","Could not find a definition file for " + name
- + "\nTry setting the directory for logic definitions in the SMT preferences");
- return;
- }
-
- char[] buf = new char[10000];
- int p = 0;
- int n = 0;
- try {
- while (p < buf.length) {
- n = r.read(buf,p,buf.length-p);
- if (n == -1) break;
- p += n;
- }
- Activator.utils.launchEditor(new String(buf,0,p),name);
- } catch (IOException e) {
- Activator.utils.showMessage(shell,windowHeader,"Failed to read logic file for " + name);
- Activator.log.errorlog("Failed to read logic file for " + name,e);
- }
- } catch (FileNotFoundException e) {
- Activator.utils.showMessage(shell,windowHeader,"Could not find logic or theory named " + name + "\n(" + path + ")");
-
- } catch (PluginException e) {
- Activator.utils.topLevelException(shell,windowHeader,e);
- } finally {
- try {
- if (r != null) r.close();
- if (stream != null) stream.close();
- } catch (IOException e) {
- Activator.log.errorlog("Failed to close reader for the logic file",e);
- }
- }
- }
-
- /** Performs a get-value command on the selected text. */
- public void getValue(Shell shell, ISelection selection) {
- String text = "";
- try {
- ITextSelection tsel = Utils.getSelectedText(selection);
- if (tsel == null) {
- Activator.utils.showMessage(shell,windowHeader,"Select an expression whose value is wanted");
- return;
- }
- text = tsel.getText();
- if (text == null || text.length() == 0) {
- Activator.utils.showMessage(shell,windowHeader,"Select an expression whose value is wanted");
- return;
- }
- if (saved_smt == null) {
- Activator.utils.showMessage(shell,windowHeader,"There is no current model");
- return;
- }
-
- int e = saved_smt.execCommand("(get-value (" + text + "))");
- if (e != 0) {
- Activator.utils.showMessage(shell,windowHeader,"The selected text is not a valid expression:\n" + text);
- } else {
- IResponse response = saved_smt.lastResponse;
- Activator.utils.showMessage(shell,windowHeader,"Value: " + saved_smt.smtConfig.defaultPrinter.toString(response));
- }
- } catch (PluginException e) {
- Activator.utils.topLevelException(shell,windowHeader,e);
- }
- }
-
-}
+/*
+ * This file is part of the SMT plugin project.
+ * Copyright 2010 David R. Cok
+ * Created August 2010
+ */
+package org.smtlib.plugin;
+
+// FIXME - still needs review
+// FIXME - need to be sure that the showMessage... methods are called in the UI context when they need to be
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringBufferInputStream;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.IStorageEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.smtlib.IResponse;
+import org.smtlib.SMT;
+
+/** This class holds utility values and methods to support the Eclipse plugin.
+ *
+ * @author David Cok
+ *
+ */
+public class Utils {
+
+ final static String windowHeader = "SMT Plugin";
+
+ /** This class is used to wrap arbitrary exceptions coming from the plug-in */
+ public static class PluginException extends RuntimeException {
+ /** Default serial version Symbol */
+ private static final long serialVersionUID = 1L;
+
+ /** Used to signal some unexpected error situation during plug-in processing. */
+ public PluginException(String error) {
+ super(error);
+ }
+ /** Used to signal some unexpected error situation during plug-in processing. */
+ public PluginException(String error, /*@NonNull*/ java.lang.Exception e) {
+ super(error,e);
+ }
+ }
+
+ /** The Symbol of the marker, which must match that in the plugin file. */
+ final public static String SMT_MARKER_ID = Activator.PLUGIN_ID + ".SMTProblem";
+
+
+ /** Run a specific solver on the given text, belonging to the given file (unsaved edits), in a computational job.
+ * If solver is null, then use the default from the options. Call the method from the UI thread.
+ */
+ public void runSolver(String solver, IFile file, String text) {
+ if (solver == null) solver = Preferences.poptions.defaultSolver.getStringValue();
+ String exec = "";
+ // FIXME - there is a lot of code in common with the previous method
+ if (!solver.equals(org.smtlib.Utils.TEST_SOLVER)) try {// FIXME - make "test" a symbolic constant
+ exec = Preferences.getExec(solver);
+ if (exec == null) {
+ Activator.log.errorlog("SMT: INTERNAL ERROR: Could not find an executable option for " + solver,null);
+ return;
+ }
+ File execFile = new File(exec);
+ if (!execFile.exists()) {
+ Activator.utils.showMessageInUI(null,windowHeader,"The executable path for this solver does not appear to exist: " + solver + " \"" + exec + "\"");
+ return;
+ }
+ if (!execFile.canExecute()) {
+ Activator.utils.showMessageInUI(null,windowHeader,"The executable path for this solver does not appear to be executable: " + solver + " " + exec);
+ return;
+ }
+ } catch (java.lang.Exception e) {
+ Activator.log.errorlog("SMT: Could not find the executable for the solver " + solver,e);
+ return;
+ }
+ if (Activator.verbose) Activator.log.logln("ISolver = " + solver);
+ try {
+ SMT smt = new SMT();
+ smt.smtConfig = Activator.smtConfiguration.clone();
+ smt.smtConfig.files = null;
+ String[] cmd = text == null ? new String[]{ "-s", solver, "--exec", exec, file.getLocation().toString() }
+ : new String[]{ "-s", solver, "--exec", exec, "--text", text, file.getLocation().toString() };
+ deleteMarkers(file,null);
+ boolean batch = false;
+ if (batch) { // FIXME - get rid of launchJob now?
+ launchJob(file.getLocation().toString(),smt,cmd,null);
+ } else {
+ interactiveJob(file.getLocation().toString(),smt,cmd,null);
+ }
+ } catch (java.lang.Exception e) {
+ Activator.log.errorlog("SMT - Internal exception",e);
+ }
+ }
+
+ SMT saved_smt = null;
+
+ /** Executes the given command (cmd) by the smt instance as a computational (non-UI) Job
+ *
+ * @param name name of the Job
+ * @param smt the SMT instance in which to execute the commands
+ * @param cmd the command to execute
+ * @param shell the shell in which to display any UI messages
+ */
+ public void launchJob(String name, final SMT smt, final String[] cmd, /*@Nullable*/ final Shell shell) {
+ Job j = new Job("SMT Solver: " + name) {
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ boolean c = false;
+ try {
+ smt.smtConfig.log.numErrors = 0;
+ int exitCode = smt.exec(cmd);
+ String timestring = "[" + new Date().toString() + "] ";
+ Activator.log.logln(timestring + "Completed " + cmd[1]
+ + (exitCode == 0 ? "" : " (exitcode=" + exitCode +")")
+ + (smt.smtConfig.log.numErrors == 0? "" : (" : " + smt.smtConfig.log.numErrors + " errors"))
+ + (smt.checkSatStatus == null ? "(no result)" : (" " + smt.smtConfig.defaultPrinter.toString(smt.checkSatStatus)))
+ );
+ } catch (PluginException e) {
+ showMessageInUI(shell,"SMT PluginException",e.getClass() + " - " + e.getMessage());
+ c = true;
+ }
+ return c ? Status.CANCEL_STATUS : Status.OK_STATUS;
+ }
+ };
+ j.setUser(true); // true = initiated by an end-user
+ j.schedule();
+ }
+
+ /** Executes the given command within the given SMT object,
+ * reporting results on the console and to the given shell;
+ * 'name' is an informational name giving the file being working on;
+ * this method must be called in a computational thread.
+ */
+ public void interactiveJob(String name, SMT smt, String[] cmd, /*@Nullable*/ final Shell shell) {
+ try {
+ smt.smtConfig.log.numErrors = 0;
+ int exitCode = smt.exec(cmd);
+ String timestring = "[" + new Date().toString() + "] ";
+ Activator.log.logln(timestring + "Completed " + cmd[1] + " on " + name + " :"
+ + (exitCode == 0 ? "" : " (exitcode=" + exitCode +")")
+ + (smt.smtConfig.log.numErrors == 0? "" : (" : " + smt.smtConfig.log.numErrors + " errors"))
+ + (smt.checkSatStatus == null ? "(no result)" : (" " + smt.smtConfig.defaultPrinter.toString(smt.checkSatStatus)))
+ );
+ } catch (PluginException e) {
+ showMessageInUI(shell,"SMT PluginException",e.getClass() + " - " + e.getMessage());
+ }
+ saved_smt = smt;
+ }
+
+ /** This runs a type-check only on the given text, in the UI thread. */
+ public void runCheck(IFile file, String text) {
+ if (text.length() > 1000000) return; // FIXME - disable for large text
+ try {
+ SMT smt = new SMT();
+ // FIXME - would rather not clone the configuration and allocate
+ // a new log and ProblemListener on each edit, but we might want
+ // to have any configuration parameters in force as they change
+ smt.smtConfig = Activator.smtConfiguration.clone();
+ smt.smtConfig.log = new org.smtlib.Log(smt.smtConfig);
+ smt.smtConfig.log.clearListeners(); // This removes the standard listener that would otherwise send log information to the console
+ smt.smtConfig.log.addListener(new ProblemListener());
+
+ smt.smtConfig.files = null;
+ String[] cmd = new String[]{ "-s", org.smtlib.Utils.TEST_SOLVER, "--text", text, file.getFullPath().toString() };
+ deleteMarkers(file,null);
+ smt.exec(cmd);
+ //launchJob("interactive",smt,cmd,null);
+ } catch (java.lang.Exception e) {
+ Activator.log.errorlog("SMT - Internal exception",e);
+ }
+ }
+
+
+ /** Returns the ITextSelection corresponding to a selection, if there is one (null otherwise). */
+ /*@Nullable*/
+ static public ITextSelection getSelectedText(ISelection selection) {
+ if (!selection.isEmpty() && selection instanceof ITextSelection) {
+ return (ITextSelection)selection;
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * This method interprets the selection returning a List of IResources, and
+ * ignoring things it does not know how to handle. The selection is ignored
+ * if it is not an IStructuredSelection (e.g. ITextSelections are ignored).
+ * If the selection is empty and 'window'
+ * is non-null, then the routine attempts to find a resource that corresponds
+ * to the currently active editor. The method expects to be called in the UI thread,
+ *
+ *
IResource - added directly to list, whether a file or a container
+ *
working set - adds the elements of the working set if they can be
+ * converted (through IAdaptor) to an IResource
+ *
IJavaElement - adds the IResource that contains the element
+ *
otherwise - ignored
+ *
+ *
+ * @param selection The selection to inspect
+ * @param window The window in which a selected editor exists
+ * @param shell the shell to use in displaying information dialogs
+ * @return A List of IResources found in the selection
+ */
+ public List getSelectedResources(ISelection selection,
+ /*@Nullable*/ IWorkbenchWindow window, /*@Nullable*/ Shell shell) {
+ List list = new LinkedList();
+ if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ for (Iterator> iter = structuredSelection.iterator(); iter.hasNext(); ) {
+ Object element = iter.next();
+ if (element instanceof IResource) {
+ list.add((IResource)element);
+ } else if (element instanceof IWorkingSet) {
+ for (IAdaptable a: ((IWorkingSet)element).getElements()) {
+ IResource r = (IResource) a.getAdapter(IResource.class);
+ if (r != null) list.add(r);
+ }
+ continue;
+ } else if (element instanceof IAdaptable) {
+ IResource r = (IResource) ((IAdaptable)element).getAdapter(IResource.class);
+ if (r != null) list.add(r);
+ }
+ }
+ } else {
+ // We had nothing selected
+ // Look for the active editor instead
+ try {
+ IEditorPart p = window.getActivePage().getActiveEditor();
+ IEditorInput e = p==null? null : p.getEditorInput();
+ IResource o = e==null ? null : (IFile)e.getAdapter(IFile.class);
+ if (o != null) {
+ list.add(o); // This is an IFile
+ }
+ } catch (PluginException ee) {
+ // These methods expect to be called in the UI thread.
+ Activator.log.errorlog("PluginException when finding selected targets: " + ee,ee);
+ showMessage(shell,"JML Plugin PluginException","PluginException occurred when finding selected targets: " + ee);
+ }
+ }
+ return list;
+ }
+
+ /** Creates a list of all the selected files, or files that are in selected containers. */
+ public List getSelectedFiles(ISelection selection,
+ /*@Nullable*/ IWorkbenchWindow window, /*@Nullable*/ Shell shell) throws CoreException {
+ List list = new LinkedList();
+ if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ for (Iterator> iter = structuredSelection.iterator(); iter.hasNext(); ) {
+ Object element = iter.next();
+ if (element instanceof IResource) {
+ addFiles((IResource)element,list);
+ } else if (element instanceof IWorkingSet) {
+ for (IAdaptable a: ((IWorkingSet)element).getElements()) {
+ IResource r = (IResource) a.getAdapter(IResource.class);
+ if (r != null) addFiles(r,list);
+ }
+ } else if (element instanceof IAdaptable) {
+ IResource r = (IResource) ((IAdaptable)element).getAdapter(IResource.class);
+ if (r != null) addFiles(r,list);
+ }
+ }
+ }
+ return list;
+ }
+
+ // TODO - duplicated with Preferences.solverNames, and should be made configurable
+ final String[] solverList = new String[]{ "simplify", "yices", "cvc", "z3_2_11", "z3_4_3"};
+
+ /** Interprets the input string (the action id, as in action.getId()) to
+ * determine which solvers to run, returning their names in a list.
+ */
+ public List getSolvers(String id) {
+ List solvers = new LinkedList();
+ int i = id.lastIndexOf('.');
+ String name = id.substring(i+1);
+ if ("All".equals(name)) {
+ for (String s: solverList) solvers.add(s);
+ } else if ("default".equals(name)) {
+ name = Preferences.poptions.defaultSolver.getStringValue();
+ solvers.add(name);
+ } else {
+ solvers.add(name);
+ }
+ return solvers;
+ }
+
+ public void runJobs(final List solvers, final List files) {
+ Job j = new Job("SMT Solving") {
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ IStatus status = Status.OK_STATUS;
+ if (monitor != null) {
+ monitor.beginTask("SMT solving", solvers.size() * (files.isEmpty() ? 1 : files.size()));
+ }
+ for (IFile file: files) {
+ for (String solver: solvers) {
+ try {
+ if (monitor != null) monitor.subTask(solver + " on " + file.getName().substring(file.getName().lastIndexOf('/')+1));
+ runSolver(solver,file,text);
+ } catch (Exception e) {
+ Activator.log.errorlog("Exception while executing " + solver + " on " + file.getName() + ": " + e,e);
+ }
+ if (monitor != null) {
+ monitor.worked(1);
+ if (monitor.isCanceled()) {
+ status = Status.CANCEL_STATUS;
+ break;
+ }
+ }
+ }
+ }
+ if (monitor != null) {
+ monitor.done();
+ }
+ return status;
+ }
+ };
+ j.setUser(true); // true = initiated by an end-user
+ j.schedule();
+ }
+
+ /** Finds the selected editor; if it is a TextEditor, then if the editor is
+ * dirty, runs the solver on the text; if the editor is not dirty, runs the
+ * solver on the file. Returns true if successfully found file or text on which
+ * to run; returns false otherwise.
+ *
+ * This must be called in the UI thread; executes the check in a computational Job.
+ * */
+ public boolean runSolverOnSelectedEditor(String solver, List files) throws CoreException {
+ for (IFile r: files) runSolver(solver,r,text);
+ return true;
+ }
+
+ String text;
+
+ // FIXME - document
+ public List resources(ISelection selection,
+ /*@Nullable*/ IWorkbenchWindow window, /*@Nullable*/ Shell shell) throws CoreException {
+ IFile file = null;
+ List list = new LinkedList();
+ text = null;
+ try {
+ IWorkbenchPage page = window == null ? null : window.getActivePage();
+ IEditorPart p = page == null ? null : window.getActivePage().getActiveEditor();
+ IEditorInput e = p==null? null : p.getEditorInput();
+ file = e==null ? null : (IFile)e.getAdapter(IFile.class);
+ if (file == null) return null;
+ if (p instanceof ITextEditor) {
+ list.add(file);
+ if (p.isDirty()) {
+ IDocumentProvider doc = ((ITextEditor)p).getDocumentProvider();
+ if (doc == null) return null;
+ IDocument d = doc.getDocument(e);
+ if (d == null) return null;
+ text = d.get();
+ }
+ }
+ } catch (PluginException ee) {
+ // These calls expect to be in the UI thread
+ Activator.log.errorlog("PluginException when finding selected targets: " + ee,ee);
+ showMessage(shell,"JML Plugin PluginException","PluginException occurred when finding selected targets: " + ee);
+ }
+ return list;
+ }
+
+ /** This adds files in the given resource to the list; if the resource is a container, it
+ * adds the files that are in the container.
+ */
+ private void addFiles(IResource resource, List list) throws CoreException {
+ if (resource instanceof IFile) {
+ if (resource.getName().toString().endsWith(org.smtlib.Utils.SUFFIX)) {
+ //Activator.log.log("ADDING " + resource.getLocation().toString());
+ list.add((IFile)resource);
+ }
+ return;
+ } else if (resource instanceof IContainer) {
+ for (IResource r: ((IContainer)resource).members()) {
+ addFiles(r,list);
+ }
+ }
+ }
+
+
+ // FIXME - should resource things be happening in another thread?
+ /** Deletes all JML markers from the items selected, right within the UI thread,
+ * without a progress dialog. The resources for which markers are deleted are
+ * those returned by Utils.getSelectedResources. This should be called from
+ * the UI thread.
+ * @param selection the IStructuredSelection whose markers are to be deleted
+ * @param window the current workbench window, or null (used in getSelectedResources)
+ * @param shell the current Shell, or null for the default shell (for message dialogs)
+ */
+ public void deleteMarkersInSelection(ISelection selection, IWorkbenchWindow window, Shell shell) {
+ List list = getSelectedResources(selection,window,shell);
+ //list.add(ResourcesPlugin.getWorkspace().getRoot()); // FIXME - temporarily here to clear out unrooted markers
+ if (list.isEmpty()) {
+ showMessage(shell,windowHeader,"Nothing appropriate to delete markers of");
+ return;
+ }
+ deleteMarkers(list,shell);
+ return;
+ }
+
+
+ /** This class is an implementation of the interfaces needed to provide input
+ * to and launch editors in the workspace.
+ * @author David R. Cok
+ */
+ public static class StringStorage implements IStorage, IStorageEditorInput {
+ /** The initial content of the editor */
+ private String content;
+ /** The name of storage unit (e.g. the file name) */
+ private String name;
+
+ /** A constructor for a new storage unit */
+ //@ assignable this.*;
+ public StringStorage(String content, String name) {
+ this.content = content;
+ this.name = name;
+ }
+
+ /** Interface method that returns the contents of the storage unit */
+ //JAVA16 @Override
+ public InputStream getContents() throws CoreException {
+ return new StringBufferInputStream(content);
+ }
+
+ /** Returns the path to the underlying resource
+ * @return null (not needed for readonly Strings)
+ */
+ //JAVA16 @Override
+ public IPath getFullPath() {
+ return null;
+ }
+
+ /** Returns the name of the storage object
+ * @return the name of the storage unit
+ */
+ //JAVA16 @Override
+ public String getName() { return name; }
+
+ /** Returns whether the storage object is read only
+ * @return always true
+ */
+ //JAVA16 @Override
+ public boolean isReadOnly() { return true; }
+
+ /** Returns the object adapted to the given class. It appears we can
+ * ignore this and always return null.
+ * @return null
+ */
+ //JAVA16 @Override
+ public /*@Nullable*/ Object getAdapter(Class arg0) { return null; }
+
+ /** Returns self
+ * @return this object
+ */
+ //@ ensures \return == this;
+ //JAVA16 @Override
+ public IStorage getStorage() throws CoreException {
+ return (IStorage)this;
+ }
+
+ /** Returns whether the underlying storage object exists
+ * @return always true
+ */
+ //JAVA16 @Override
+ public boolean exists() {
+ return true;
+ }
+
+ /** Returns an ImageDescriptor, here ignored
+ * @return always null
+ */
+ //JAVA16 @Override
+ public /*@Nullable*/ ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ /** Returns a corresponding Persistable object, here ignored
+ * @return always null
+ */
+ //JAVA16 @Override
+ public /*@Nullable*/ IPersistableElement getPersistable() {
+ return null;
+ }
+
+ /** Return the text desired in a tool tip, here the name of the
+ * storage unit
+ */
+ //@NonNull
+ //JAVA16 @Override
+ public String getToolTipText() {
+ return name;
+ }
+
+ }
+
+ /** Launches a read-only text editor with the given content and name
+ * @param content the content of the editor
+ * @param name the name (as in the title) of the editor
+ */
+ public void launchEditor(String content,String name) {
+ try {
+ IEditorInput editorInput = new StringStorage(content,name);
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window == null) {
+ showMessageInUI(null,"SMT PluginException","No window found for editor named " + name);
+ return;
+ }
+ IWorkbenchPage page = window.getActivePage();
+ if (page == null) {
+ showMessageInUI(null,"SMT PluginException","No active page found for editor named " + name);
+ return;
+ }
+
+ // IEditorPart[] parts = page.getEditors();
+ // for (IEditorPart e: parts) Log.log("EDITOR " + e.getEditorSite().getId());
+ page.openEditor(editorInput, "org.eclipse.ui.DefaultTextEditor");
+ } catch (java.lang.Exception e) {
+ showMessageInUI(null,"SMT PluginException",e.getMessage());
+ }
+ }
+
+ /** Deletes the SMT_MARKER_ID markers in any of the objects in the List that are
+ * IResource objects; if the object is a container, markers are deleted for
+ * any resources in the container; other kinds of objects are ignored.
+ * Expects to be called from the UI thread.
+ * @param just the type of the list
+ * @param list a list of objects whose markers are to be deleted
+ * @param shell the current shell for dialogs (or null for default)
+ */
+ public void deleteMarkers(List list, /*@Nullable*/ Shell shell) {
+ StringBuilder sb = new StringBuilder();
+ for (T t: list) {
+ IResource resource = (IResource)t;
+ String s = deleteMarkers(resource,shell);
+ if (s != null) { sb.append(s); sb.append("\n"); }
+ }
+ String ss = sb.toString();
+ if (!ss.isEmpty()) Activator.utils.showMessage(shell,windowHeader,ss);
+ }
+
+ /** Deletes any SMT_MARKER_ID markers on the given resource, returns an error message, if any (else null);
+ * expects to be called from the UI thread. */
+ public /*@Nullable*/ String deleteMarkers(IResource resource, /*@Nullable*/ Shell shell) {
+ try {
+ try {
+ if (Activator.verbose) Activator.log.logln("Deleting markers in " + resource.getName());
+ resource.deleteMarkers(SMT_MARKER_ID, false,
+ IResource.DEPTH_INFINITE);
+ } catch (CoreException e) {
+ String msg = "Failed to delete markers on "
+ + resource.getProject();
+ Activator.log.errorlog(msg, e);
+ }
+ } catch (PluginException e) {
+ Activator.log.errorlog("PluginException while deleting markers: " + e, e);
+ return "PluginException while deleting markers "
+ + (resource != null ? "on " + resource.getName()
+ : "");
+ }
+ return null;
+ }
+
+ /**
+ * Displays a message in a dialog in the UI thread - this may
+ * be called from other threads.
+ * @param sh The shell to use to display the dialog, or
+ * a top-level shell if the parameter is null
+ * @param title The title of the dialog window
+ * @param msg The message to display in the dialog
+ */
+ public void showMessageInUI(/*@Nullable*/ Shell sh,
+ final String title, final String msg) {
+ final Shell shell = sh;
+ Display d = shell == null ? Display.getDefault() : shell.getDisplay();
+ d.asyncExec(new Runnable() {
+ public void run() {
+ MessageDialog.openInformation(
+ shell,
+ title,
+ msg);
+ }
+ });
+ }
+
+ /**
+ * Displays a message in a non-modal dialog in the UI thread - this may
+ * be called from other threads.
+ * @param sh The shell to use to display the dialog, or
+ * a top-level shell if the parameter is null
+ * @param title The title of the dialog window
+ * @param msg The message to display in the dialog
+ */
+ public void showMessageInUINM(/*@Nullable*/ Shell sh,
+ final String title, final String msg) {
+ final Shell shell = sh;
+ Display d = shell == null ? Display.getDefault() : shell.getDisplay();
+ d.asyncExec(new Runnable() {
+ public void run() {
+ Dialog d = new NonModalDialog(
+ shell,
+ title,
+ msg);
+ d.open();
+ }
+ });
+ }
+
+ // FIXME this does not seem to be working
+ static public class NonModalDialog extends MessageDialog {
+ final static String[] buttons = { "OK" };
+ public NonModalDialog(Shell shell, String title, String message) {
+ super(new Shell(),title,null,message,INFORMATION,buttons,0);
+ setShellStyle(getShellStyle()|SWT.MODELESS);
+ setBlockOnOpen(false);
+ }
+ }
+
+
+ /**
+ * Displays a message in a information dialog; must be called from the UI thread.
+ * @param shell Either the parent shell
+ * @param title A title for the dialog window
+ * @param msg The message to display in the dialog window
+ */
+ //@ requires msg != null;
+ public void showMessage(/*@Nullable*/Shell shell, /*@Nullable*/String title, String msg) {
+ MessageDialog.openInformation(
+ shell,
+ title,
+ msg);
+ }
+
+ /** Shows an error dialog box for an exception; must be called from the UI thread */
+ public void topLevelException(/*@Nullable*/Shell shell, String title, java.lang.Exception e) {
+ //e.printStackTrace(sw); // TODO
+ showMessage(shell,"SMT Top-level PluginException: " + title,
+ e.toString());
+ }
+
+ /** Shows the logic or theory file of the selected text; error dialogs if can't find an appropriate file to show. */
+ public void viewLogic(Shell shell, ISelection selection) {
+ String name = "";
+ String path = "";
+ Reader r = null;
+ InputStream stream = null;
+ try {
+ ITextSelection tsel = Utils.getSelectedText(selection);
+ if (tsel == null) {
+ Activator.utils.showMessage(shell,windowHeader,"Select the name of a logic or theory to show");
+ return;
+ }
+ name = tsel.getText();
+ if (name == null || name.length() == 0) {
+ Activator.utils.showMessage(shell,windowHeader,"Select the name of a logic or theory to show");
+ return;
+ }
+ String dir = Preferences.poptions.logics.getValue();
+ if (dir != null) dir = dir.trim();
+
+ if (dir == null || dir.isEmpty()) {
+ try {
+ stream = SMT.logicFinder.find(null,name,null);
+ if (stream == null) {
+ return;
+ }
+ r = new InputStreamReader(stream);
+ } catch (IOException e) {
+ showMessage(shell,"SMT View Logic","Could not read the definition file for " + name
+ + "\n" + e.getMessage());
+ return;
+ } catch (org.smtlib.Utils.SMTLIBException e) {
+ showMessage(shell,"SMT View Logic","Could not read the definition file for " + name
+ + "\n" + e.errorResponse);
+ return;
+ }
+ } else {
+ String fname = dir + File.separator + name + org.smtlib.Utils.SUFFIX;
+ if (Activator.verbose) Activator.log.logln("Trying to read logic file " + fname);
+ File f = new File(fname);
+ if (f.isFile()) r = new FileReader(f);
+ }
+ if (r == null) {
+ showMessage(shell,"SMT View Logic","Could not find a definition file for " + name
+ + "\nTry setting the directory for logic definitions in the SMT preferences");
+ return;
+ }
+
+ char[] buf = new char[10000];
+ int p = 0;
+ int n = 0;
+ try {
+ while (p < buf.length) {
+ n = r.read(buf,p,buf.length-p);
+ if (n == -1) break;
+ p += n;
+ }
+ Activator.utils.launchEditor(new String(buf,0,p),name);
+ } catch (IOException e) {
+ Activator.utils.showMessage(shell,windowHeader,"Failed to read logic file for " + name);
+ Activator.log.errorlog("Failed to read logic file for " + name,e);
+ }
+ } catch (FileNotFoundException e) {
+ Activator.utils.showMessage(shell,windowHeader,"Could not find logic or theory named " + name + "\n(" + path + ")");
+
+ } catch (PluginException e) {
+ Activator.utils.topLevelException(shell,windowHeader,e);
+ } finally {
+ try {
+ if (r != null) r.close();
+ if (stream != null) stream.close();
+ } catch (IOException e) {
+ Activator.log.errorlog("Failed to close reader for the logic file",e);
+ }
+ }
+ }
+
+ /** Performs a get-value command on the selected text. */
+ public void getValue(Shell shell, ISelection selection) {
+ String text = "";
+ try {
+ ITextSelection tsel = Utils.getSelectedText(selection);
+ if (tsel == null) {
+ Activator.utils.showMessage(shell,windowHeader,"Select an expression whose value is wanted");
+ return;
+ }
+ text = tsel.getText();
+ if (text == null || text.length() == 0) {
+ Activator.utils.showMessage(shell,windowHeader,"Select an expression whose value is wanted");
+ return;
+ }
+ if (saved_smt == null) {
+ Activator.utils.showMessage(shell,windowHeader,"There is no current model");
+ return;
+ }
+
+ int e = saved_smt.execCommand("(get-value (" + text + "))");
+ if (e != 0) {
+ Activator.utils.showMessage(shell,windowHeader,"The selected text is not a valid expression:\n" + text);
+ } else {
+ IResponse response = saved_smt.lastResponse;
+ Activator.utils.showMessage(shell,windowHeader,"Value: " + saved_smt.smtConfig.defaultPrinter.toString(response));
+ }
+ } catch (PluginException e) {
+ Activator.utils.topLevelException(shell,windowHeader,e);
+ }
+ }
+
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/Widgets.java b/SMTPlugin/src/org/smtlib/plugin/Widgets.java
index d1c00bd..c6764d8 100644
--- a/SMTPlugin/src/org/smtlib/plugin/Widgets.java
+++ b/SMTPlugin/src/org/smtlib/plugin/Widgets.java
@@ -1,316 +1,316 @@
-/*
- * This file is part of the SMT plugin project.
- * Copyright 2010 David R. Cok
- * Created August 2010
- */
-package org.smtlib.plugin;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * This class just holds a bunch of related classes which are
- * custom widgets for building dialogs.
- *
- * @author David Cok
- *
- */
-public class Widgets {
-
-
- /**
- * A composite that lays its children out in a number of
- * columns.
- *
- * @author David Cok
- *
- */
- public static class HComposite extends Composite {
- /**
- * Constructs the composite as a member of the given
- * parent and with the given number of columns.
- *
- * @param parent The container into which to place this new widget
- * @param cols The number of columns of this widget
- */
- //@ requires cols > 0;
- public HComposite(/*@ non_null */ Composite parent,int cols) {
- super(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = cols;
- setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- setLayoutData(data);
- }
- }
-
- /**
- * A custom widget that lays out its children in one vertical
- * column.
- */
- public static class VComposite extends Composite {
- /**
- * Constructs the composite as a member of the given
- * parent.
- *
- * @param parent The container into which to place this new widget
- */
- public VComposite(/*@ non_null */ Composite parent) {
- super(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- setLayoutData(data);
- }
- }
-
- /**
- * A custom widget that is a separator followed by a label,
- * typically used as a title to a set of widgets below it.
- *
- * @author David Cok
- */
- public static class LabeledSeparator extends Composite {
- /**
- * @param parent The container this widget is made part of
- * @param label The text to be used as the label in the widget
- */
- public LabeledSeparator(/*@ non_null */ Composite parent,
- /*@ non_null */ String label) {
- super(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- setLayoutData(data);
- new Label(this,SWT.SEPARATOR|SWT.HORIZONTAL);
- new Label(this,SWT.NONE).setText(label);
- }
- }
-
-
- /**
- * A custom widget that is used to provide a way for the user
- * to specify a file; it combines a label, a Browse button,
- * and a text field. The Browse button pops up a file browser;
- * that lets the user browse for a file; the path of the selected
- * file is then put into the text field. Or the user can type into
- * the text field directly.
- *
- * @author David Cok
- */
- public static class FileTextField extends VComposite {
- /** The text field that shows the file path */
- private Text text;
- /** A String used for spaces */
- final private static String tenspaces = " ";
- // The length of this string defines the minimum size of the text field.
- // FIXME - there must be a better way to set the size,
- // and a better way to make a long string
- /** A String used for spaces that helps set the size of the text widget */
- final private static String spaces = tenspaces + tenspaces + tenspaces
- + tenspaces + tenspaces + tenspaces + tenspaces + tenspaces + tenspaces;
-
-
- /**
- * Constructs the composite widget as a member of the given
- * parent and with the given parameters.
- * @param parent The container this new widget is made part of
- * @param label The label to be used for this widget (e.g. the purpose of the directory being identified)
- * @param initialValue The initial value for the text field (a directory path)
- * @param toolTipText The explantory text used as a tooltip
- * @param length The size of the visible part of the field, in characters
- * */
- public FileTextField(/*@ non_null */ Composite parent,
- /*@ non_null */ String label,
- /*@ non_null */ String initialValue,
- /*@ non_null */ String toolTipText,
- int length) {
- super(parent);
- final Shell shell = parent.getShell();
-
- // This is a composite widget with internals
- // arranged as follows:
- // *********************************************
- // * label * Browse button *
- // *********************************************
- // * Text field *
- // *********************************************
-
- Composite hc = new HComposite(this,2);
-
- new Label(hc,SWT.NONE).setText(label);
-
- text = new Text(this,SWT.SINGLE);
- String s = initialValue;
- int n = spaces.length();
- if (length < n) n = length;
- if (s.length() < n) s += spaces.substring(0,n-s.length());
- text.setText(s);
- text.setToolTipText(toolTipText);
- // Make the text fixed width and bold
- Font f = JFaceResources.getFontRegistry().getBold(JFaceResources.TEXT_FONT);
- text.setFont(f);
- final Text t = text;
-
- Button browse = new Button(hc, SWT.PUSH);
- browse.setText("Browse");
- browse.setToolTipText(toolTipText);
- browse.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseUp(MouseEvent e) {
- // TODO: Would be nice to start the directory browser
- // in the location that is currently set in the text
- // field, but there does not seem to be away to do that
- FileDialog dd = new FileDialog(shell,SWT.OPEN);
- String result = dd.open();
- if (result != null) t.setText(result);
- }
- });
- }
-
- /** Returns the current value of the specified file path.
- *
- * @return the current value of the specified file path
- */
- //@ modifies \nothing;
- //@ ensures \result != null;
- public String value() {
- return text.getText();
- }
-
- /**
- * Sets the current value in the text field.
- *
- * @param v The text to display
- */
- public void setText(String v) {
- text.setText(v);
- }
- }
-
- /**
- * A custom widget that is used to provide a way for the user
- * to specify a directory; it combines a label, a Browse button,
- * and a text field. The Browse button pops up a file system browser;
- * that lets the user browse for a directory; the path of the selected
- * directory is then put into the text field. Or the user can type into
- * the text field directly.
- *
- * @author David Cok
- */
- public static class DirTextField extends VComposite {
- /** The text field that shows the directory path */
- private Text text;
- /** A String used for spaces */
- final private static String tenspaces = " ";
- // The length of this string defines the minimum size of the text field.
- // FIXME - there must be a better way to set the size,
- // and a better way to make a long string
- /** A String used for spaces that helps set the size of the text widget */
- final private static String spaces = tenspaces + tenspaces + tenspaces
- + tenspaces + tenspaces + tenspaces + tenspaces + tenspaces + tenspaces;
-
-
- /**
- * Constructs the composite widget as a member of the given
- * parent and with the given parameters.
- * @param parent The container this new widget is made part of
- * @param label The label to be used for this widget (e.g. the purpose of the directory being identified)
- * @param initialValue The initial value for the text field (a directory path)
- * @param toolTipText The explanatory text used as a tooltip
- * @param length The size of the visible part of the field, in characters
- * */
- public DirTextField(/*@ non_null */ Composite parent,
- /*@ non_null */ String label,
- /*@ non_null */ String initialValue,
- /*@ non_null */ String toolTipText,
- int length) {
- super(parent);
- final Shell shell = parent.getShell();
-
- // This is a composite widget with internals
- // arranged as follows:
- // *********************************************
- // * label * Browse button *
- // *********************************************
- // * Text field *
- // *********************************************
-
- Composite hc = new HComposite(this,2);
-
- new Label(hc,SWT.NONE).setText(label);
-
- text = new Text(this,SWT.SINGLE);
- String s = initialValue;
- int n = spaces.length();
- if (length < n) n = length;
- if (s.length() < n) s += spaces.substring(0,n-s.length());
- text.setText(s);
- text.setToolTipText(toolTipText);
- // Make the text fixed width and bold
- Font f = JFaceResources.getFontRegistry().getBold(JFaceResources.TEXT_FONT);
- text.setFont(f);
- final Text t = text;
-
- Button browse = new Button(hc, SWT.PUSH);
- browse.setText("Browse");
- browse.setToolTipText(toolTipText);
- browse.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseUp(MouseEvent e) {
- // TODO: Would be nice to start the directory browser
- // in the location that is currently set in the text
- // field, but there does not seem to be away to do that
- DirectoryDialog dd = new DirectoryDialog(shell,SWT.OPEN);
- String result = dd.open();
- if (result != null) t.setText(result);
- }
- });
- }
-
- public void addModifyListener(ModifyListener listener) {
- text.addModifyListener(listener);
- }
-
- /** Returns the current value of the specified directory path.
- *
- * @return the current value of the specified directory path
- */
- //@ modifies \nothing;
- //@ ensures \result != null;
- public String value() {
- return text.getText();
- }
-
- /**
- * Sets the current value in the text field.
- *
- * @param v The text to display
- */
- public void setText(String v) {
- text.setText(v);
- }
- }
-
-}
+/*
+ * This file is part of the SMT plugin project.
+ * Copyright 2010 David R. Cok
+ * Created August 2010
+ */
+package org.smtlib.plugin;
+
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * This class just holds a bunch of related classes which are
+ * custom widgets for building dialogs.
+ *
+ * @author David Cok
+ *
+ */
+public class Widgets {
+
+
+ /**
+ * A composite that lays its children out in a number of
+ * columns.
+ *
+ * @author David Cok
+ *
+ */
+ public static class HComposite extends Composite {
+ /**
+ * Constructs the composite as a member of the given
+ * parent and with the given number of columns.
+ *
+ * @param parent The container into which to place this new widget
+ * @param cols The number of columns of this widget
+ */
+ //@ requires cols > 0;
+ public HComposite(/*@ non_null */ Composite parent,int cols) {
+ super(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = cols;
+ setLayout(layout);
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ setLayoutData(data);
+ }
+ }
+
+ /**
+ * A custom widget that lays out its children in one vertical
+ * column.
+ */
+ public static class VComposite extends Composite {
+ /**
+ * Constructs the composite as a member of the given
+ * parent.
+ *
+ * @param parent The container into which to place this new widget
+ */
+ public VComposite(/*@ non_null */ Composite parent) {
+ super(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ setLayout(layout);
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ setLayoutData(data);
+ }
+ }
+
+ /**
+ * A custom widget that is a separator followed by a label,
+ * typically used as a title to a set of widgets below it.
+ *
+ * @author David Cok
+ */
+ public static class LabeledSeparator extends Composite {
+ /**
+ * @param parent The container this widget is made part of
+ * @param label The text to be used as the label in the widget
+ */
+ public LabeledSeparator(/*@ non_null */ Composite parent,
+ /*@ non_null */ String label) {
+ super(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ setLayout(layout);
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ setLayoutData(data);
+ new Label(this,SWT.SEPARATOR|SWT.HORIZONTAL);
+ new Label(this,SWT.NONE).setText(label);
+ }
+ }
+
+
+ /**
+ * A custom widget that is used to provide a way for the user
+ * to specify a file; it combines a label, a Browse button,
+ * and a text field. The Browse button pops up a file browser;
+ * that lets the user browse for a file; the path of the selected
+ * file is then put into the text field. Or the user can type into
+ * the text field directly.
+ *
+ * @author David Cok
+ */
+ public static class FileTextField extends VComposite {
+ /** The text field that shows the file path */
+ private Text text;
+ /** A String used for spaces */
+ final private static String tenspaces = " ";
+ // The length of this string defines the minimum size of the text field.
+ // FIXME - there must be a better way to set the size,
+ // and a better way to make a long string
+ /** A String used for spaces that helps set the size of the text widget */
+ final private static String spaces = tenspaces + tenspaces + tenspaces
+ + tenspaces + tenspaces + tenspaces + tenspaces + tenspaces + tenspaces;
+
+
+ /**
+ * Constructs the composite widget as a member of the given
+ * parent and with the given parameters.
+ * @param parent The container this new widget is made part of
+ * @param label The label to be used for this widget (e.g. the purpose of the directory being identified)
+ * @param initialValue The initial value for the text field (a directory path)
+ * @param toolTipText The explantory text used as a tooltip
+ * @param length The size of the visible part of the field, in characters
+ * */
+ public FileTextField(/*@ non_null */ Composite parent,
+ /*@ non_null */ String label,
+ /*@ non_null */ String initialValue,
+ /*@ non_null */ String toolTipText,
+ int length) {
+ super(parent);
+ final Shell shell = parent.getShell();
+
+ // This is a composite widget with internals
+ // arranged as follows:
+ // *********************************************
+ // * label * Browse button *
+ // *********************************************
+ // * Text field *
+ // *********************************************
+
+ Composite hc = new HComposite(this,2);
+
+ new Label(hc,SWT.NONE).setText(label);
+
+ text = new Text(this,SWT.SINGLE);
+ String s = initialValue;
+ int n = spaces.length();
+ if (length < n) n = length;
+ if (s.length() < n) s += spaces.substring(0,n-s.length());
+ text.setText(s);
+ text.setToolTipText(toolTipText);
+ // Make the text fixed width and bold
+ Font f = JFaceResources.getFontRegistry().getBold(JFaceResources.TEXT_FONT);
+ text.setFont(f);
+ final Text t = text;
+
+ Button browse = new Button(hc, SWT.PUSH);
+ browse.setText("Browse");
+ browse.setToolTipText(toolTipText);
+ browse.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ // TODO: Would be nice to start the directory browser
+ // in the location that is currently set in the text
+ // field, but there does not seem to be away to do that
+ FileDialog dd = new FileDialog(shell,SWT.OPEN);
+ String result = dd.open();
+ if (result != null) t.setText(result);
+ }
+ });
+ }
+
+ /** Returns the current value of the specified file path.
+ *
+ * @return the current value of the specified file path
+ */
+ //@ modifies \nothing;
+ //@ ensures \result != null;
+ public String value() {
+ return text.getText();
+ }
+
+ /**
+ * Sets the current value in the text field.
+ *
+ * @param v The text to display
+ */
+ public void setText(String v) {
+ text.setText(v);
+ }
+ }
+
+ /**
+ * A custom widget that is used to provide a way for the user
+ * to specify a directory; it combines a label, a Browse button,
+ * and a text field. The Browse button pops up a file system browser;
+ * that lets the user browse for a directory; the path of the selected
+ * directory is then put into the text field. Or the user can type into
+ * the text field directly.
+ *
+ * @author David Cok
+ */
+ public static class DirTextField extends VComposite {
+ /** The text field that shows the directory path */
+ private Text text;
+ /** A String used for spaces */
+ final private static String tenspaces = " ";
+ // The length of this string defines the minimum size of the text field.
+ // FIXME - there must be a better way to set the size,
+ // and a better way to make a long string
+ /** A String used for spaces that helps set the size of the text widget */
+ final private static String spaces = tenspaces + tenspaces + tenspaces
+ + tenspaces + tenspaces + tenspaces + tenspaces + tenspaces + tenspaces;
+
+
+ /**
+ * Constructs the composite widget as a member of the given
+ * parent and with the given parameters.
+ * @param parent The container this new widget is made part of
+ * @param label The label to be used for this widget (e.g. the purpose of the directory being identified)
+ * @param initialValue The initial value for the text field (a directory path)
+ * @param toolTipText The explanatory text used as a tooltip
+ * @param length The size of the visible part of the field, in characters
+ * */
+ public DirTextField(/*@ non_null */ Composite parent,
+ /*@ non_null */ String label,
+ /*@ non_null */ String initialValue,
+ /*@ non_null */ String toolTipText,
+ int length) {
+ super(parent);
+ final Shell shell = parent.getShell();
+
+ // This is a composite widget with internals
+ // arranged as follows:
+ // *********************************************
+ // * label * Browse button *
+ // *********************************************
+ // * Text field *
+ // *********************************************
+
+ Composite hc = new HComposite(this,2);
+
+ new Label(hc,SWT.NONE).setText(label);
+
+ text = new Text(this,SWT.SINGLE);
+ String s = initialValue;
+ int n = spaces.length();
+ if (length < n) n = length;
+ if (s.length() < n) s += spaces.substring(0,n-s.length());
+ text.setText(s);
+ text.setToolTipText(toolTipText);
+ // Make the text fixed width and bold
+ Font f = JFaceResources.getFontRegistry().getBold(JFaceResources.TEXT_FONT);
+ text.setFont(f);
+ final Text t = text;
+
+ Button browse = new Button(hc, SWT.PUSH);
+ browse.setText("Browse");
+ browse.setToolTipText(toolTipText);
+ browse.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ // TODO: Would be nice to start the directory browser
+ // in the location that is currently set in the text
+ // field, but there does not seem to be away to do that
+ DirectoryDialog dd = new DirectoryDialog(shell,SWT.OPEN);
+ String result = dd.open();
+ if (result != null) t.setText(result);
+ }
+ });
+ }
+
+ public void addModifyListener(ModifyListener listener) {
+ text.addModifyListener(listener);
+ }
+
+ /** Returns the current value of the specified directory path.
+ *
+ * @return the current value of the specified directory path
+ */
+ //@ modifies \nothing;
+ //@ ensures \result != null;
+ public String value() {
+ return text.getText();
+ }
+
+ /**
+ * Sets the current value in the text field.
+ *
+ * @param v The text to display
+ */
+ public void setText(String v) {
+ text.setText(v);
+ }
+ }
+
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/editor/ISMTColorConstants.java b/SMTPlugin/src/org/smtlib/plugin/editor/ISMTColorConstants.java
index 9daa4ad..7462a56 100644
--- a/SMTPlugin/src/org/smtlib/plugin/editor/ISMTColorConstants.java
+++ b/SMTPlugin/src/org/smtlib/plugin/editor/ISMTColorConstants.java
@@ -1,27 +1,27 @@
-/**
- * This class is part of the SMT Plugin
- * @author David R. Cok
- * September 2010
- */
-package org.smtlib.plugin.editor;
-
-import org.eclipse.swt.graphics.RGB;
-
-/** This class defines color constants to be used for syntax coloring. */
-// FIXME - should allow setting these from the preferences
-public interface ISMTColorConstants {
- RGB DEFAULT = new RGB(0, 0, 0); // default text color is black
- RGB SMT_COMMENT = new RGB(128, 128, 128); // gray for comments
- RGB SMT_KEYWORD = new RGB(0, 0, 255);
- RGB SMT_NUMERAL = new RGB(0, 0, 255);
- RGB SMT_DECIMAL = new RGB(0, 128, 255);
- RGB SMT_STRING = new RGB(0, 0, 255);
- RGB SMT_SYMBOL = new RGB(0, 128, 0);
- RGB SMT_QSYMBOL = new RGB(0, 255, 0);
- RGB SMT_PAREN = new RGB(255, 0, 255);
- RGB SMT_COMMAND = new RGB(128, 128, 255);
- RGB SMT_HEX = new RGB(0, 0, 255);
- RGB SMT_BINARY = new RGB(0, 0, 255);
- RGB SMT_INVALID = new RGB(255, 0, 0);
- RGB SMT_RESERVED_WORD = new RGB(0, 0, 128);
-}
+/**
+ * This class is part of the SMT Plugin
+ * @author David R. Cok
+ * September 2010
+ */
+package org.smtlib.plugin.editor;
+
+import org.eclipse.swt.graphics.RGB;
+
+/** This class defines color constants to be used for syntax coloring. */
+// FIXME - should allow setting these from the preferences
+public interface ISMTColorConstants {
+ RGB DEFAULT = new RGB(0, 0, 0); // default text color is black
+ RGB SMT_COMMENT = new RGB(128, 128, 128); // gray for comments
+ RGB SMT_KEYWORD = new RGB(0, 0, 255);
+ RGB SMT_NUMERAL = new RGB(0, 0, 255);
+ RGB SMT_DECIMAL = new RGB(0, 128, 255);
+ RGB SMT_STRING = new RGB(0, 0, 255);
+ RGB SMT_SYMBOL = new RGB(0, 128, 0);
+ RGB SMT_QSYMBOL = new RGB(0, 255, 0);
+ RGB SMT_PAREN = new RGB(255, 0, 255);
+ RGB SMT_COMMAND = new RGB(128, 128, 255);
+ RGB SMT_HEX = new RGB(0, 0, 255);
+ RGB SMT_BINARY = new RGB(0, 0, 255);
+ RGB SMT_INVALID = new RGB(255, 0, 0);
+ RGB SMT_RESERVED_WORD = new RGB(0, 0, 128);
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/editor/SMTConfiguration.java b/SMTPlugin/src/org/smtlib/plugin/editor/SMTConfiguration.java
index a170056..5d23756 100644
--- a/SMTPlugin/src/org/smtlib/plugin/editor/SMTConfiguration.java
+++ b/SMTPlugin/src/org/smtlib/plugin/editor/SMTConfiguration.java
@@ -1,87 +1,87 @@
-/**
- * This class is part of the SMT Plugin
- * @author David R. Cok
- * September 2010
- */
-package org.smtlib.plugin.editor;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextDoubleClickStrategy;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.presentation.PresentationReconciler;
-import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
-
-/** This file extends its super class in order to add customized syntax coloring
- * Using TextSourceViewerConfiguration instead of SourceViewerConfiguration
- * gives hover information on problem icons. It can also provide double-click
- * and quick-assist functionality, but these are not yet implemented.
- * @author David R. Cok
- *
- */
-// FIXME - document
-// FIXME - implement double click and quick assist
-public class SMTConfiguration extends TextSourceViewerConfiguration {
- private SMTDoubleClickStrategy doubleClickStrategy;
- private RuleBasedScanner scanner;
-
- public SMTConfiguration() {
- }
-
- @Override
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return SMTPartitionScanner.tokenNamesWithDefault; // Must include the default
- }
-
- @Override
- public ITextDoubleClickStrategy getDoubleClickStrategy(
- ISourceViewer sourceViewer,
- String contentType) {
- if (doubleClickStrategy == null)
- doubleClickStrategy = new SMTDoubleClickStrategy();
- return doubleClickStrategy;
- }
-
- protected RuleBasedScanner getScanner() {
- if (scanner == null) {
- scanner = new SMTPartitionScanner();
- scanner.setDefaultReturnToken(
- SMTPartitionScanner.smtDefault);
- }
- return scanner;
- }
-
- final static public RGB[] colors = {
- ISMTColorConstants.SMT_COMMENT, ISMTColorConstants.SMT_NUMERAL, ISMTColorConstants.SMT_DECIMAL,
- ISMTColorConstants.SMT_SYMBOL, ISMTColorConstants.SMT_QSYMBOL, ISMTColorConstants.SMT_RESERVED_WORD,
- ISMTColorConstants.SMT_KEYWORD, ISMTColorConstants.SMT_COMMAND,
- ISMTColorConstants.SMT_HEX, ISMTColorConstants.SMT_BINARY, ISMTColorConstants.SMT_STRING,
- ISMTColorConstants.SMT_PAREN, ISMTColorConstants.SMT_INVALID,
- };
-
- final static public String[] tokens = {
- SMTPartitionScanner.SMT_COMMENT, SMTPartitionScanner.SMT_NUMERAL, SMTPartitionScanner.SMT_DECIMAL,
- SMTPartitionScanner.SMT_SYMBOL, SMTPartitionScanner.SMT_QSYMBOL, SMTPartitionScanner.SMT_RESERVED_WORD,
- SMTPartitionScanner.SMT_KEYWORD, SMTPartitionScanner.SMT_COMMAND,
- SMTPartitionScanner.SMT_HEX, SMTPartitionScanner.SMT_BINARY, SMTPartitionScanner.SMT_STRING,
- SMTPartitionScanner.SMT_PAREN, SMTPartitionScanner.SMT_INVALID,
- };
-
- @Override
- public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
- PresentationReconciler reconciler = new PresentationReconciler();
-
- DefaultDamagerRepairer dr;
-
- dr = new DefaultDamagerRepairer(getScanner());
-
- reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
- reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
-
- return reconciler;
- }
-
+/**
+ * This class is part of the SMT Plugin
+ * @author David R. Cok
+ * September 2010
+ */
+package org.smtlib.plugin.editor;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.presentation.IPresentationReconciler;
+import org.eclipse.jface.text.presentation.PresentationReconciler;
+import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
+
+/** This file extends its super class in order to add customized syntax coloring
+ * Using TextSourceViewerConfiguration instead of SourceViewerConfiguration
+ * gives hover information on problem icons. It can also provide double-click
+ * and quick-assist functionality, but these are not yet implemented.
+ * @author David R. Cok
+ *
+ */
+// FIXME - document
+// FIXME - implement double click and quick assist
+public class SMTConfiguration extends TextSourceViewerConfiguration {
+ private SMTDoubleClickStrategy doubleClickStrategy;
+ private RuleBasedScanner scanner;
+
+ public SMTConfiguration() {
+ }
+
+ @Override
+ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+ return SMTPartitionScanner.tokenNamesWithDefault; // Must include the default
+ }
+
+ @Override
+ public ITextDoubleClickStrategy getDoubleClickStrategy(
+ ISourceViewer sourceViewer,
+ String contentType) {
+ if (doubleClickStrategy == null)
+ doubleClickStrategy = new SMTDoubleClickStrategy();
+ return doubleClickStrategy;
+ }
+
+ protected RuleBasedScanner getScanner() {
+ if (scanner == null) {
+ scanner = new SMTPartitionScanner();
+ scanner.setDefaultReturnToken(
+ SMTPartitionScanner.smtDefault);
+ }
+ return scanner;
+ }
+
+ final static public RGB[] colors = {
+ ISMTColorConstants.SMT_COMMENT, ISMTColorConstants.SMT_NUMERAL, ISMTColorConstants.SMT_DECIMAL,
+ ISMTColorConstants.SMT_SYMBOL, ISMTColorConstants.SMT_QSYMBOL, ISMTColorConstants.SMT_RESERVED_WORD,
+ ISMTColorConstants.SMT_KEYWORD, ISMTColorConstants.SMT_COMMAND,
+ ISMTColorConstants.SMT_HEX, ISMTColorConstants.SMT_BINARY, ISMTColorConstants.SMT_STRING,
+ ISMTColorConstants.SMT_PAREN, ISMTColorConstants.SMT_INVALID,
+ };
+
+ final static public String[] tokens = {
+ SMTPartitionScanner.SMT_COMMENT, SMTPartitionScanner.SMT_NUMERAL, SMTPartitionScanner.SMT_DECIMAL,
+ SMTPartitionScanner.SMT_SYMBOL, SMTPartitionScanner.SMT_QSYMBOL, SMTPartitionScanner.SMT_RESERVED_WORD,
+ SMTPartitionScanner.SMT_KEYWORD, SMTPartitionScanner.SMT_COMMAND,
+ SMTPartitionScanner.SMT_HEX, SMTPartitionScanner.SMT_BINARY, SMTPartitionScanner.SMT_STRING,
+ SMTPartitionScanner.SMT_PAREN, SMTPartitionScanner.SMT_INVALID,
+ };
+
+ @Override
+ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
+ PresentationReconciler reconciler = new PresentationReconciler();
+
+ DefaultDamagerRepairer dr;
+
+ dr = new DefaultDamagerRepairer(getScanner());
+
+ reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+
+ return reconciler;
+ }
+
}
\ No newline at end of file
diff --git a/SMTPlugin/src/org/smtlib/plugin/editor/SMTDocumentProvider.java b/SMTPlugin/src/org/smtlib/plugin/editor/SMTDocumentProvider.java
index edbb264..1c8bf51 100644
--- a/SMTPlugin/src/org/smtlib/plugin/editor/SMTDocumentProvider.java
+++ b/SMTPlugin/src/org/smtlib/plugin/editor/SMTDocumentProvider.java
@@ -1,31 +1,31 @@
-/**
- * This class is part of the SMT Plugin
- * @author David R. Cok
- * September 2010
- */
-package org.smtlib.plugin.editor;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.rules.FastPartitioner;
-import org.eclipse.ui.editors.text.FileDocumentProvider;
-
-/** This class is a DocumentProvider, connecting a document partitioner with
- * the argument to createDocument*/
-public class SMTDocumentProvider extends FileDocumentProvider {
-
- @Override
- protected IDocument createDocument(Object element) throws CoreException {
- IDocument document = super.createDocument(element);
- if (document != null) {
- IDocumentPartitioner partitioner =
- new FastPartitioner(
- new SMTPartitionScanner(),
- SMTPartitionScanner.tokenNames); // No default listed here
- partitioner.connect(document);
- document.setDocumentPartitioner(partitioner);
- }
- return document;
- }
+/**
+ * This class is part of the SMT Plugin
+ * @author David R. Cok
+ * September 2010
+ */
+package org.smtlib.plugin.editor;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.jface.text.rules.FastPartitioner;
+import org.eclipse.ui.editors.text.FileDocumentProvider;
+
+/** This class is a DocumentProvider, connecting a document partitioner with
+ * the argument to createDocument*/
+public class SMTDocumentProvider extends FileDocumentProvider {
+
+ @Override
+ protected IDocument createDocument(Object element) throws CoreException {
+ IDocument document = super.createDocument(element);
+ if (document != null) {
+ IDocumentPartitioner partitioner =
+ new FastPartitioner(
+ new SMTPartitionScanner(),
+ SMTPartitionScanner.tokenNames); // No default listed here
+ partitioner.connect(document);
+ document.setDocumentPartitioner(partitioner);
+ }
+ return document;
+ }
}
\ No newline at end of file
diff --git a/SMTPlugin/src/org/smtlib/plugin/editor/SMTDoubleClickStrategy.java b/SMTPlugin/src/org/smtlib/plugin/editor/SMTDoubleClickStrategy.java
index ba4593d..f777ed7 100644
--- a/SMTPlugin/src/org/smtlib/plugin/editor/SMTDoubleClickStrategy.java
+++ b/SMTPlugin/src/org/smtlib/plugin/editor/SMTDoubleClickStrategy.java
@@ -1,131 +1,131 @@
-/**
- * This class is part of the SMT Plugin
- * @author David R. Cok
- * September 2010
- */
-package org.smtlib.plugin.editor;
-
-import org.eclipse.jface.text.*;
-
-/** This class implements the action that happens when a double-click happens on text - for example
- * selecting the whole word or token.
- * @author David R. Cok
- *
- */
-
-// FIXME - the double-click strategy is not implemented for SMT
-public class SMTDoubleClickStrategy implements ITextDoubleClickStrategy {
- protected ITextViewer fText;
-
- @Override
- public void doubleClicked(ITextViewer part) {
- int pos = part.getSelectedRange().x;
-
- if (pos < 0)
- return;
-
- fText = part;
-
- //if (!selectComment(pos)) {
- selectWord(pos);
- //}
- }
-
- // FIXME - this selects a Java comment - don't need this here - change it??
- protected boolean selectComment(int caretPos) {
- IDocument doc = fText.getDocument();
- int startPos, endPos;
-
- try {
- int pos = caretPos;
- char c = ' ';
-
- while (pos >= 0) {
- c = doc.getChar(pos);
- if (c == '\\') {
- pos -= 2;
- continue;
- }
- if (c == Character.LINE_SEPARATOR || c == '\"')
- break;
- --pos;
- }
-
- if (c != '\"')
- return false;
-
- startPos = pos;
-
- pos = caretPos;
- int length = doc.getLength();
- c = ' ';
-
- while (pos < length) {
- c = doc.getChar(pos);
- if (c == Character.LINE_SEPARATOR || c == '\"')
- break;
- ++pos;
- }
- if (c != '\"')
- return false;
-
- endPos = pos;
-
- int offset = startPos + 1;
- int len = endPos - offset;
- fText.setSelectedRange(offset, len);
- return true;
- } catch (BadLocationException x) {
- }
-
- return false;
- }
-
- // FIXME - this selects a Java word
- protected boolean selectWord(int caretPos) {
-
-
- IDocument doc = fText.getDocument();
- int startPos, endPos;
-
- try {
-// ITypedRegion region = doc.getPartition(caretPos);
-// startPos = region.getOffset();
-// endPos = startPos + region.getLength();
-
- int pos = caretPos;
- char c;
-
- while (pos >= 0) {
- c = doc.getChar(pos);
- if (c == '(' || c == ')' || c <= ' ') break;
- --pos;
- }
-
- startPos = pos;
-
- pos = caretPos;
- int length = doc.getLength();
-
- while (pos < length) {
- c = doc.getChar(pos);
- if (c == '(' || c == ')' || c <= ' ') break;
- ++pos;
- }
-
- endPos = pos;
- selectRange(startPos, endPos);
- return true;
-
- } catch (BadLocationException x) {
- }
-
- return false;
- }
-
- private void selectRange(int startPos, int stopPos) {
- int offset = startPos + 1;
- int length = stopPos - offset;
- fText.setSelectedRange(offset, length);
- }
+/**
+ * This class is part of the SMT Plugin
+ * @author David R. Cok
+ * September 2010
+ */
+package org.smtlib.plugin.editor;
+
+import org.eclipse.jface.text.*;
+
+/** This class implements the action that happens when a double-click happens on text - for example
+ * selecting the whole word or token.
+ * @author David R. Cok
+ *
+ */
+
+// FIXME - the double-click strategy is not implemented for SMT
+public class SMTDoubleClickStrategy implements ITextDoubleClickStrategy {
+ protected ITextViewer fText;
+
+ @Override
+ public void doubleClicked(ITextViewer part) {
+ int pos = part.getSelectedRange().x;
+
+ if (pos < 0)
+ return;
+
+ fText = part;
+
+ //if (!selectComment(pos)) {
+ selectWord(pos);
+ //}
+ }
+
+ // FIXME - this selects a Java comment - don't need this here - change it??
+ protected boolean selectComment(int caretPos) {
+ IDocument doc = fText.getDocument();
+ int startPos, endPos;
+
+ try {
+ int pos = caretPos;
+ char c = ' ';
+
+ while (pos >= 0) {
+ c = doc.getChar(pos);
+ if (c == '\\') {
+ pos -= 2;
+ continue;
+ }
+ if (c == Character.LINE_SEPARATOR || c == '\"')
+ break;
+ --pos;
+ }
+
+ if (c != '\"')
+ return false;
+
+ startPos = pos;
+
+ pos = caretPos;
+ int length = doc.getLength();
+ c = ' ';
+
+ while (pos < length) {
+ c = doc.getChar(pos);
+ if (c == Character.LINE_SEPARATOR || c == '\"')
+ break;
+ ++pos;
+ }
+ if (c != '\"')
+ return false;
+
+ endPos = pos;
+
+ int offset = startPos + 1;
+ int len = endPos - offset;
+ fText.setSelectedRange(offset, len);
+ return true;
+ } catch (BadLocationException x) {
+ }
+
+ return false;
+ }
+
+ // FIXME - this selects a Java word
+ protected boolean selectWord(int caretPos) {
+
+
+ IDocument doc = fText.getDocument();
+ int startPos, endPos;
+
+ try {
+// ITypedRegion region = doc.getPartition(caretPos);
+// startPos = region.getOffset();
+// endPos = startPos + region.getLength();
+
+ int pos = caretPos;
+ char c;
+
+ while (pos >= 0) {
+ c = doc.getChar(pos);
+ if (c == '(' || c == ')' || c <= ' ') break;
+ --pos;
+ }
+
+ startPos = pos;
+
+ pos = caretPos;
+ int length = doc.getLength();
+
+ while (pos < length) {
+ c = doc.getChar(pos);
+ if (c == '(' || c == ')' || c <= ' ') break;
+ ++pos;
+ }
+
+ endPos = pos;
+ selectRange(startPos, endPos);
+ return true;
+
+ } catch (BadLocationException x) {
+ }
+
+ return false;
+ }
+
+ private void selectRange(int startPos, int stopPos) {
+ int offset = startPos + 1;
+ int length = stopPos - offset;
+ fText.setSelectedRange(offset, length);
+ }
}
\ No newline at end of file
diff --git a/SMTPlugin/src/org/smtlib/plugin/editor/SMTEditor.java b/SMTPlugin/src/org/smtlib/plugin/editor/SMTEditor.java
index b59ab48..cf57b21 100644
--- a/SMTPlugin/src/org/smtlib/plugin/editor/SMTEditor.java
+++ b/SMTPlugin/src/org/smtlib/plugin/editor/SMTEditor.java
@@ -1,56 +1,56 @@
-/**
- * This class is part of the SMT Plugin
- * @author David R. Cok
- * September 2010
- */
-package org.smtlib.plugin.editor;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.smtlib.plugin.Activator;
-
-
-/** This class defines a custom text editor, adding syntax coloring
- * and automatic type checking when a file is edited. */
-public class SMTEditor extends TextEditor {
-
- public SMTEditor() {
- super();
- setSourceViewerConfiguration(new SMTConfiguration());
- setDocumentProvider(new SMTDocumentProvider());
- }
-
- @Override
- protected void doSetInput(final IEditorInput input) throws CoreException {
- super.doSetInput(input);
- IDocument d = getDocumentProvider().getDocument(input);
- d.addDocumentListener(new IDocumentListener() {
-
- @Override
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- @Override
- public void documentChanged(DocumentEvent event) {
- IFile f = (IFile)input.getAdapter(IFile.class);
- Activator.utils.runCheck(f,event.getDocument().get());
- // FIXME _ create a class so we can move these dependencies out of this file?
- // FIXME - do the rechecking in a background thread?
- // FIXME - condition the checking on an option - on edit? on save? manual only? in the background?
-
- }
- });
-
- }
-
- @Override
- public void dispose() {
- super.dispose();
- }
-
-}
+/**
+ * This class is part of the SMT Plugin
+ * @author David R. Cok
+ * September 2010
+ */
+package org.smtlib.plugin.editor;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentListener;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.smtlib.plugin.Activator;
+
+
+/** This class defines a custom text editor, adding syntax coloring
+ * and automatic type checking when a file is edited. */
+public class SMTEditor extends TextEditor {
+
+ public SMTEditor() {
+ super();
+ setSourceViewerConfiguration(new SMTConfiguration());
+ setDocumentProvider(new SMTDocumentProvider());
+ }
+
+ @Override
+ protected void doSetInput(final IEditorInput input) throws CoreException {
+ super.doSetInput(input);
+ IDocument d = getDocumentProvider().getDocument(input);
+ d.addDocumentListener(new IDocumentListener() {
+
+ @Override
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ }
+
+ @Override
+ public void documentChanged(DocumentEvent event) {
+ IFile f = (IFile)input.getAdapter(IFile.class);
+ Activator.utils.runCheck(f,event.getDocument().get());
+ // FIXME _ create a class so we can move these dependencies out of this file?
+ // FIXME - do the rechecking in a background thread?
+ // FIXME - condition the checking on an option - on edit? on save? manual only? in the background?
+
+ }
+ });
+
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/editor/SMTPartitionScanner.java b/SMTPlugin/src/org/smtlib/plugin/editor/SMTPartitionScanner.java
index 7ca711f..394de0d 100644
--- a/SMTPlugin/src/org/smtlib/plugin/editor/SMTPartitionScanner.java
+++ b/SMTPlugin/src/org/smtlib/plugin/editor/SMTPartitionScanner.java
@@ -1,340 +1,340 @@
-/**
- * This class is part of the SMT Plugin
- * @author David R. Cok
- * September 2010
- */
-package org.smtlib.plugin.editor;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.*;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-
-/** This class defines tokens and the syntax rules that go along with those tokens, and sets the
- * associated syntax coloring.
- *
- * If you are going to add a new token type you need to do the following:
- *
- *
Add a String constant in SMTPartitionScanner (e.g. SMT_SYMBOL)
- *
Add the string to SMTPartitionScanner.tokenNames
- *
Define a new IToken in SMTPartitionScanner (e.g. smtSymbol)
- *
Associate the token with a rule in SMTPartitionScanner()
- *
Define a color for the token in ISMTColorConstants (e.g. ISMTColorConstants.SMT_SYMBOL)
- *
In SMTConfiguration.getPresentationReconciler(ISourceViewer sourceViewer) follow the
- * pattern to add code that associates the desired color with the symbol
- *
- * @author David R. Cok
- */
-// TODO - fix the documentation above
-public class SMTPartitionScanner extends RuleBasedScanner implements IPartitionTokenScanner {
- /* Define unique strings that identify each token */
- public final static String SMT_DEFAULT = "__smt_default";
- public final static String SMT_COMMENT = "__smt_comment";
- public final static String SMT_PAREN = "__smt_paren";
- public final static String SMT_NUMERAL = "__smt_numeral";
- public final static String SMT_KEYWORD = "__smt_keyword";
- public final static String SMT_SYMBOL = "__smt_symbol";
- public final static String SMT_QSYMBOL = "__smt_qsymbol";
- public final static String SMT_DECIMAL = "__smt_decimal";
- public final static String SMT_HEX = "__smt_hex";
- public final static String SMT_BINARY = "__smt_binary";
- public final static String SMT_COMMAND = "__smt_command";
- public final static String SMT_STRING = "__smt_string";
- public final static String SMT_RESERVED_WORD = "__smt_reserved_word";
- public final static String SMT_INVALID = "__smt_invalid";
-
- public final static String[] tokenNamesWithDefault = new String[]{
- SMT_COMMENT, SMT_NUMERAL, SMT_SYMBOL, SMT_KEYWORD, SMT_STRING, SMT_QSYMBOL, SMT_PAREN,
- SMT_DECIMAL,
- SMT_HEX, SMT_BINARY, SMT_COMMAND, SMT_RESERVED_WORD, SMT_INVALID,
- IDocument.DEFAULT_CONTENT_TYPE,
- };
-
- public final static String[] tokenNames = new String[]{
- SMT_COMMENT, SMT_PAREN, SMT_NUMERAL, SMT_DECIMAL, SMT_SYMBOL, SMT_KEYWORD,
- SMT_QSYMBOL, SMT_HEX, SMT_BINARY, SMT_COMMAND, SMT_STRING, SMT_RESERVED_WORD, SMT_INVALID
- };
-
- public final static Token token(RGB rgb) {
- return new Token(new TextAttribute(new Color(Display.getCurrent(),rgb)));
- }
-
- /* Create a token, each one associated with a token that contains the text attribute we want for that token. */
- public final static IToken smtDefault = token(ISMTColorConstants.DEFAULT);
- public final static IToken smtComment = token(ISMTColorConstants.SMT_COMMENT);
- public final static IToken smtParen = token(ISMTColorConstants.SMT_PAREN);
- public final static IToken smtBinary = token(ISMTColorConstants.SMT_BINARY);
- public final static IToken smtHex = token(ISMTColorConstants.SMT_HEX);
- public final static IToken smtNumeral = token(ISMTColorConstants.SMT_NUMERAL);
- public final static IToken smtKeyword = token(ISMTColorConstants.SMT_KEYWORD);
- public final static IToken smtSymbol = token(ISMTColorConstants.SMT_SYMBOL);
- public final static IToken smtQSymbol = token(ISMTColorConstants.SMT_QSYMBOL);
- public final static IToken smtDecimal = token(ISMTColorConstants.SMT_DECIMAL);
- public final static IToken smtString = token(ISMTColorConstants.SMT_STRING);
- public final static IToken smtCommand = token(ISMTColorConstants.SMT_COMMAND);
- public final static IToken smtReservedWord = token(ISMTColorConstants.SMT_RESERVED_WORD);
- public final static IToken smtInvalid = token(ISMTColorConstants.SMT_INVALID);
-
-
- // FIXME - would be nice if this list could be created automatically
- final static public String[] _reservedWords = {
- "_", "!", "as", "NUMERAL", "DECIMAL", "STRING", "forall", "exists", "let", "par",
- "assert", "check-sat", "check-sat-assuming",
- "declare-const", "declare-fun", "define-fun", "declare-sort", "define-sort",
- "echo", "exit", "get-info", "get-option",
- "get-proof", "get-assertions", "get-assignment", "get-info", "get-model",
- "get-option", "get-proof", "get-unsat-core", "get-value",
- "push", "pop", "reset-assertions", "reset",
- "set-logic", "set-info", "set-option"};
-
- final static public Set reservedWords = new HashSet();
- static {
- for (String s: _reservedWords) reservedWords.add(s);
- }
-
- public SMTPartitionScanner() {
- /* Associate a rule with each token */
- /*@Mutable*/
- IRule[] rules = new IRule[] {
- new EndOfLineRule(";", smtComment),
- new WhitespaceRule(new IWhitespaceDetector() { public boolean isWhitespace(char c) { return c == ' ' || c == '\t' || c == '\n' || c == '\r'; }}),
- new NumberDecimalRule(smtNumeral,smtDecimal,smtInvalid),
-// new NumberRule(smtNumeral),
- new WordRule(new CharDetector("()"), smtParen),
-
- new WordRule(new KeywordDetector(), smtKeyword),
-// new WordRule(new SymbolDetector(), smtSymbol),
- new SymbolRWRule(smtSymbol,smtReservedWord,reservedWords),
-// //new WordRule(new StringDetector(), smtString),
- new PatternRule("\"","\"", smtString, '\\',false),
- new PatternRule("\"","\"", smtInvalid, '\\', false, true), // unclosed string
- new PatternRule("|","|", smtQSymbol, (char)-1, false),
- new PatternRule("|","|", smtInvalid, (char)-1, false, true), // unclosed symbol
-
- // FIXME - bad characters in |-symbol, in string
-
- new BinHexRule(smtBinary,smtHex,smtInvalid),
- new WordRule(new PrintableDetector(), smtInvalid),
- };
-
- setRules(rules);
- }
-
- @Override
- public void setPartialRange(IDocument arg0, int arg1, int arg2,
- String arg3, int arg4) {
- // TODO Auto-generated method stub ????? Don't know what this is supposed to do
- }
-
- // FIXME - some performance improvement could be done here
-
- // FIXME - this needs to be expanded to include UNICODE characters, which are now allowed.
-
- /* Define a bunch of useful character classes */
- public final static String whitespace = " \t\r\n";
- public final static String digits = "0123456789";
- public final static String alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- public final static String sympunc = "_-+~!@$%^&*=<>.?/";
- public final static String allpunc = "_-+~!@$%^&*=<>.?/';:|{}[]()`,#\"\\";
- public final static String nondigitsymchar = alpha + sympunc;
- public final static String symchar = digits + alpha + sympunc;
- public final static String printable = whitespace + digits + alpha + allpunc;
-
- /** Defines a IRule detector for an SMTLIB keyword */
- static private class KeywordDetector implements IWordDetector {
-
- @Override
- public boolean isWordPart(char c) {
- return symchar.indexOf(c) >= 0;
- }
-
- @Override
- public boolean isWordStart(char c) {
- return c == ':';
- }
-
- }
-
-// /** Defines a IRule detector for an SMTLIB non-quoted symbol */
-// static private class SymbolDetector implements IWordDetector {
-//
-// @Override
-// public boolean isWordPart(char c) {
-// return symchar.indexOf(c) >= 0;
-// }
-//
-// @Override
-// public boolean isWordStart(char c) {
-// return nondigitsymchar.indexOf(c) >= 0;
-// }
-// }
-
- /** Defines a IRule detector for a sequence of given characters. */
- static private class CharDetector implements IWordDetector {
- String ch;
- public CharDetector(String ch) {
- this.ch = ch;
- }
- @Override
- public boolean isWordPart(char c) {
- return ch.indexOf(c) >= 0;
- }
-
- @Override
- public boolean isWordStart(char c) {
- return isWordPart(c);
- }
- }
-
- /** Defines a IRule detector for a sequence of printable characters */
- static private class PrintableDetector implements IWordDetector {
- public PrintableDetector() {
- }
-
- @Override
- public boolean isWordPart(char c) {
- //return c >= '!' && c <= '~';
- return ",;'{}[]`".indexOf(c) >= 0;
- }
-
- @Override
- public boolean isWordStart(char c) {
- return isWordPart(c);
- }
- }
-
-// /** Defines a IRule detector for an SMTLIB string literal */
-// static private class StringDetector implements IWordDetector {
-//
-// @Override
-// public boolean isWordPart(char c) {
-// return c != '"';
-// }
-//
-// @Override
-// public boolean isWordStart(char c) {
-// return c == '"';
-// }
-// }
-
- /** This detector identifies a numeral, decimal or invalid token, once
- * a beginning digit is seen.
- */
- static private class NumberDecimalRule implements IRule {
- private IToken numberToken;
- private IToken decimalToken;
- private IToken invalidToken;
-
- public NumberDecimalRule(IToken numberToken, IToken decimalToken, IToken invalidToken) {
- this.numberToken = numberToken;
- this.decimalToken = decimalToken;
- this.invalidToken = invalidToken;
- }
-
- @Override
- public IToken evaluate(ICharacterScanner scanner) {
- int c = scanner.read();
- if (!Character.isDigit(c)) {
- scanner.unread();
- return Token.UNDEFINED;
- }
- boolean leadingZero = c == '0';
- boolean more = false;
- while (Character.isDigit(c = scanner.read())) {
- more = true;
- }
- if (!more) leadingZero = false;
- if (c != '.') {
- scanner.unread();
- if (leadingZero) return invalidToken;
- return numberToken;
- }
- more = false;
- while (Character.isDigit(c = scanner.read())) { more = true; }
- scanner.unread();
- if (!more || leadingZero) return invalidToken;
- return decimalToken;
- }
-
- }
-
- /** This detector identifies a reserved word or unquoted symbol. */
- static private class SymbolRWRule implements IRule {
- private IToken symbolToken;
- private IToken reservedWordToken;
- private Collection reservedWords;
-
- public SymbolRWRule(IToken symbolToken, IToken reservedWordToken, Set reservedWords) {
- this.symbolToken = symbolToken;
- this.reservedWordToken = reservedWordToken;
- this.reservedWords = reservedWords;
- }
-
- @Override
- public IToken evaluate(ICharacterScanner scanner) {
- StringBuilder sb = new StringBuilder();
- int c = scanner.read();
- if (nondigitsymchar.indexOf(c) < 0) {
- scanner.unread();
- return Token.UNDEFINED;
- }
- sb.append((char)c);
- while (symchar.indexOf(c=scanner.read()) >= 0) { sb.append((char)c); }
- scanner.unread();
- if (reservedWords.contains(sb.toString())) return reservedWordToken;
- return symbolToken;
- }
- }
-
- /** This detector identifies binary literals, hex literals, or invalid literals
- * that begin with #.
- * @author David R. Cok
- */
- static private class BinHexRule implements IRule {
- private IToken binToken;
- private IToken hexToken;
- private IToken invalidToken;
-
- public BinHexRule(IToken binToken, IToken hexToken, IToken invalidToken) {
- this.binToken = binToken;
- this.hexToken = hexToken;
- this.invalidToken = invalidToken;
- }
-
- @Override
- public IToken evaluate(ICharacterScanner scanner) {
- int c = scanner.read();
- if (c != '#') {
- scanner.unread();
- return Token.UNDEFINED;
- }
- c = scanner.read();
- int n = 0;
- if (c == 'b') {
- do {
- c = scanner.read();
- ++n;
- } while (c == '0' || c == '1');
- scanner.unread();
- if (n == 1) return invalidToken;
- return binToken;
- } else if (c == 'x') {
- do {
- c = scanner.read();
- ++n;
- } while ((c>='0'&&c<='9')||(c>='a'&&c<='f')||(c>='A'&&c<='F'));
- scanner.unread();
- if (n == 1) return invalidToken;
- return hexToken;
- } else {
- return invalidToken;
- }
- }
- }
-}
+/**
+ * This class is part of the SMT Plugin
+ * @author David R. Cok
+ * September 2010
+ */
+package org.smtlib.plugin.editor;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.rules.*;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+
+/** This class defines tokens and the syntax rules that go along with those tokens, and sets the
+ * associated syntax coloring.
+ *
+ * If you are going to add a new token type you need to do the following:
+ *
+ *
Add a String constant in SMTPartitionScanner (e.g. SMT_SYMBOL)
+ *
Add the string to SMTPartitionScanner.tokenNames
+ *
Define a new IToken in SMTPartitionScanner (e.g. smtSymbol)
+ *
Associate the token with a rule in SMTPartitionScanner()
+ *
Define a color for the token in ISMTColorConstants (e.g. ISMTColorConstants.SMT_SYMBOL)
+ *
In SMTConfiguration.getPresentationReconciler(ISourceViewer sourceViewer) follow the
+ * pattern to add code that associates the desired color with the symbol
+ *
+ * @author David R. Cok
+ */
+// TODO - fix the documentation above
+public class SMTPartitionScanner extends RuleBasedScanner implements IPartitionTokenScanner {
+ /* Define unique strings that identify each token */
+ public final static String SMT_DEFAULT = "__smt_default";
+ public final static String SMT_COMMENT = "__smt_comment";
+ public final static String SMT_PAREN = "__smt_paren";
+ public final static String SMT_NUMERAL = "__smt_numeral";
+ public final static String SMT_KEYWORD = "__smt_keyword";
+ public final static String SMT_SYMBOL = "__smt_symbol";
+ public final static String SMT_QSYMBOL = "__smt_qsymbol";
+ public final static String SMT_DECIMAL = "__smt_decimal";
+ public final static String SMT_HEX = "__smt_hex";
+ public final static String SMT_BINARY = "__smt_binary";
+ public final static String SMT_COMMAND = "__smt_command";
+ public final static String SMT_STRING = "__smt_string";
+ public final static String SMT_RESERVED_WORD = "__smt_reserved_word";
+ public final static String SMT_INVALID = "__smt_invalid";
+
+ public final static String[] tokenNamesWithDefault = new String[]{
+ SMT_COMMENT, SMT_NUMERAL, SMT_SYMBOL, SMT_KEYWORD, SMT_STRING, SMT_QSYMBOL, SMT_PAREN,
+ SMT_DECIMAL,
+ SMT_HEX, SMT_BINARY, SMT_COMMAND, SMT_RESERVED_WORD, SMT_INVALID,
+ IDocument.DEFAULT_CONTENT_TYPE,
+ };
+
+ public final static String[] tokenNames = new String[]{
+ SMT_COMMENT, SMT_PAREN, SMT_NUMERAL, SMT_DECIMAL, SMT_SYMBOL, SMT_KEYWORD,
+ SMT_QSYMBOL, SMT_HEX, SMT_BINARY, SMT_COMMAND, SMT_STRING, SMT_RESERVED_WORD, SMT_INVALID
+ };
+
+ public final static Token token(RGB rgb) {
+ return new Token(new TextAttribute(new Color(Display.getCurrent(),rgb)));
+ }
+
+ /* Create a token, each one associated with a token that contains the text attribute we want for that token. */
+ public final static IToken smtDefault = token(ISMTColorConstants.DEFAULT);
+ public final static IToken smtComment = token(ISMTColorConstants.SMT_COMMENT);
+ public final static IToken smtParen = token(ISMTColorConstants.SMT_PAREN);
+ public final static IToken smtBinary = token(ISMTColorConstants.SMT_BINARY);
+ public final static IToken smtHex = token(ISMTColorConstants.SMT_HEX);
+ public final static IToken smtNumeral = token(ISMTColorConstants.SMT_NUMERAL);
+ public final static IToken smtKeyword = token(ISMTColorConstants.SMT_KEYWORD);
+ public final static IToken smtSymbol = token(ISMTColorConstants.SMT_SYMBOL);
+ public final static IToken smtQSymbol = token(ISMTColorConstants.SMT_QSYMBOL);
+ public final static IToken smtDecimal = token(ISMTColorConstants.SMT_DECIMAL);
+ public final static IToken smtString = token(ISMTColorConstants.SMT_STRING);
+ public final static IToken smtCommand = token(ISMTColorConstants.SMT_COMMAND);
+ public final static IToken smtReservedWord = token(ISMTColorConstants.SMT_RESERVED_WORD);
+ public final static IToken smtInvalid = token(ISMTColorConstants.SMT_INVALID);
+
+
+ // FIXME - would be nice if this list could be created automatically
+ final static public String[] _reservedWords = {
+ "_", "!", "as", "NUMERAL", "DECIMAL", "STRING", "forall", "exists", "let", "par",
+ "assert", "check-sat", "check-sat-assuming",
+ "declare-const", "declare-fun", "define-fun", "declare-sort", "define-sort",
+ "echo", "exit", "get-info", "get-option",
+ "get-proof", "get-assertions", "get-assignment", "get-info", "get-model",
+ "get-option", "get-proof", "get-unsat-core", "get-value",
+ "push", "pop", "reset-assertions", "reset",
+ "set-logic", "set-info", "set-option"};
+
+ final static public Set reservedWords = new HashSet();
+ static {
+ for (String s: _reservedWords) reservedWords.add(s);
+ }
+
+ public SMTPartitionScanner() {
+ /* Associate a rule with each token */
+ /*@Mutable*/
+ IRule[] rules = new IRule[] {
+ new EndOfLineRule(";", smtComment),
+ new WhitespaceRule(new IWhitespaceDetector() { public boolean isWhitespace(char c) { return c == ' ' || c == '\t' || c == '\n' || c == '\r'; }}),
+ new NumberDecimalRule(smtNumeral,smtDecimal,smtInvalid),
+// new NumberRule(smtNumeral),
+ new WordRule(new CharDetector("()"), smtParen),
+
+ new WordRule(new KeywordDetector(), smtKeyword),
+// new WordRule(new SymbolDetector(), smtSymbol),
+ new SymbolRWRule(smtSymbol,smtReservedWord,reservedWords),
+// //new WordRule(new StringDetector(), smtString),
+ new PatternRule("\"","\"", smtString, '\\',false),
+ new PatternRule("\"","\"", smtInvalid, '\\', false, true), // unclosed string
+ new PatternRule("|","|", smtQSymbol, (char)-1, false),
+ new PatternRule("|","|", smtInvalid, (char)-1, false, true), // unclosed symbol
+
+ // FIXME - bad characters in |-symbol, in string
+
+ new BinHexRule(smtBinary,smtHex,smtInvalid),
+ new WordRule(new PrintableDetector(), smtInvalid),
+ };
+
+ setRules(rules);
+ }
+
+ @Override
+ public void setPartialRange(IDocument arg0, int arg1, int arg2,
+ String arg3, int arg4) {
+ // TODO Auto-generated method stub ????? Don't know what this is supposed to do
+ }
+
+ // FIXME - some performance improvement could be done here
+
+ // FIXME - this needs to be expanded to include UNICODE characters, which are now allowed.
+
+ /* Define a bunch of useful character classes */
+ public final static String whitespace = " \t\r\n";
+ public final static String digits = "0123456789";
+ public final static String alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ public final static String sympunc = "_-+~!@$%^&*=<>.?/";
+ public final static String allpunc = "_-+~!@$%^&*=<>.?/';:|{}[]()`,#\"\\";
+ public final static String nondigitsymchar = alpha + sympunc;
+ public final static String symchar = digits + alpha + sympunc;
+ public final static String printable = whitespace + digits + alpha + allpunc;
+
+ /** Defines a IRule detector for an SMTLIB keyword */
+ static private class KeywordDetector implements IWordDetector {
+
+ @Override
+ public boolean isWordPart(char c) {
+ return symchar.indexOf(c) >= 0;
+ }
+
+ @Override
+ public boolean isWordStart(char c) {
+ return c == ':';
+ }
+
+ }
+
+// /** Defines a IRule detector for an SMTLIB non-quoted symbol */
+// static private class SymbolDetector implements IWordDetector {
+//
+// @Override
+// public boolean isWordPart(char c) {
+// return symchar.indexOf(c) >= 0;
+// }
+//
+// @Override
+// public boolean isWordStart(char c) {
+// return nondigitsymchar.indexOf(c) >= 0;
+// }
+// }
+
+ /** Defines a IRule detector for a sequence of given characters. */
+ static private class CharDetector implements IWordDetector {
+ String ch;
+ public CharDetector(String ch) {
+ this.ch = ch;
+ }
+ @Override
+ public boolean isWordPart(char c) {
+ return ch.indexOf(c) >= 0;
+ }
+
+ @Override
+ public boolean isWordStart(char c) {
+ return isWordPart(c);
+ }
+ }
+
+ /** Defines a IRule detector for a sequence of printable characters */
+ static private class PrintableDetector implements IWordDetector {
+ public PrintableDetector() {
+ }
+
+ @Override
+ public boolean isWordPart(char c) {
+ //return c >= '!' && c <= '~';
+ return ",;'{}[]`".indexOf(c) >= 0;
+ }
+
+ @Override
+ public boolean isWordStart(char c) {
+ return isWordPart(c);
+ }
+ }
+
+// /** Defines a IRule detector for an SMTLIB string literal */
+// static private class StringDetector implements IWordDetector {
+//
+// @Override
+// public boolean isWordPart(char c) {
+// return c != '"';
+// }
+//
+// @Override
+// public boolean isWordStart(char c) {
+// return c == '"';
+// }
+// }
+
+ /** This detector identifies a numeral, decimal or invalid token, once
+ * a beginning digit is seen.
+ */
+ static private class NumberDecimalRule implements IRule {
+ private IToken numberToken;
+ private IToken decimalToken;
+ private IToken invalidToken;
+
+ public NumberDecimalRule(IToken numberToken, IToken decimalToken, IToken invalidToken) {
+ this.numberToken = numberToken;
+ this.decimalToken = decimalToken;
+ this.invalidToken = invalidToken;
+ }
+
+ @Override
+ public IToken evaluate(ICharacterScanner scanner) {
+ int c = scanner.read();
+ if (!Character.isDigit(c)) {
+ scanner.unread();
+ return Token.UNDEFINED;
+ }
+ boolean leadingZero = c == '0';
+ boolean more = false;
+ while (Character.isDigit(c = scanner.read())) {
+ more = true;
+ }
+ if (!more) leadingZero = false;
+ if (c != '.') {
+ scanner.unread();
+ if (leadingZero) return invalidToken;
+ return numberToken;
+ }
+ more = false;
+ while (Character.isDigit(c = scanner.read())) { more = true; }
+ scanner.unread();
+ if (!more || leadingZero) return invalidToken;
+ return decimalToken;
+ }
+
+ }
+
+ /** This detector identifies a reserved word or unquoted symbol. */
+ static private class SymbolRWRule implements IRule {
+ private IToken symbolToken;
+ private IToken reservedWordToken;
+ private Collection reservedWords;
+
+ public SymbolRWRule(IToken symbolToken, IToken reservedWordToken, Set reservedWords) {
+ this.symbolToken = symbolToken;
+ this.reservedWordToken = reservedWordToken;
+ this.reservedWords = reservedWords;
+ }
+
+ @Override
+ public IToken evaluate(ICharacterScanner scanner) {
+ StringBuilder sb = new StringBuilder();
+ int c = scanner.read();
+ if (nondigitsymchar.indexOf(c) < 0) {
+ scanner.unread();
+ return Token.UNDEFINED;
+ }
+ sb.append((char)c);
+ while (symchar.indexOf(c=scanner.read()) >= 0) { sb.append((char)c); }
+ scanner.unread();
+ if (reservedWords.contains(sb.toString())) return reservedWordToken;
+ return symbolToken;
+ }
+ }
+
+ /** This detector identifies binary literals, hex literals, or invalid literals
+ * that begin with #.
+ * @author David R. Cok
+ */
+ static private class BinHexRule implements IRule {
+ private IToken binToken;
+ private IToken hexToken;
+ private IToken invalidToken;
+
+ public BinHexRule(IToken binToken, IToken hexToken, IToken invalidToken) {
+ this.binToken = binToken;
+ this.hexToken = hexToken;
+ this.invalidToken = invalidToken;
+ }
+
+ @Override
+ public IToken evaluate(ICharacterScanner scanner) {
+ int c = scanner.read();
+ if (c != '#') {
+ scanner.unread();
+ return Token.UNDEFINED;
+ }
+ c = scanner.read();
+ int n = 0;
+ if (c == 'b') {
+ do {
+ c = scanner.read();
+ ++n;
+ } while (c == '0' || c == '1');
+ scanner.unread();
+ if (n == 1) return invalidToken;
+ return binToken;
+ } else if (c == 'x') {
+ do {
+ c = scanner.read();
+ ++n;
+ } while ((c>='0'&&c<='9')||(c>='a'&&c<='f')||(c>='A'&&c<='F'));
+ scanner.unread();
+ if (n == 1) return invalidToken;
+ return hexToken;
+ } else {
+ return invalidToken;
+ }
+ }
+ }
+}
diff --git a/SMTPlugin/src/org/smtlib/plugin/editor/package.html b/SMTPlugin/src/org/smtlib/plugin/editor/package.html
index 6c43322..c560f05 100644
--- a/SMTPlugin/src/org/smtlib/plugin/editor/package.html
+++ b/SMTPlugin/src/org/smtlib/plugin/editor/package.html
@@ -1,5 +1,5 @@
-
-
-This package contains the implementation of a specialized editor for SMT-LIB text files; for the most part the editor is a standard text editor, but the syntax coloring options reflect the SMT-LIB concrete syntax.
-
-
+
+
+This package contains the implementation of a specialized editor for SMT-LIB text files; for the most part the editor is a standard text editor, but the syntax coloring options reflect the SMT-LIB concrete syntax.
+
+
diff --git a/SMTPlugin/src/org/smtlib/plugin/package.html b/SMTPlugin/src/org/smtlib/plugin/package.html
index 7715da7..6580672 100644
--- a/SMTPlugin/src/org/smtlib/plugin/package.html
+++ b/SMTPlugin/src/org/smtlib/plugin/package.html
@@ -1,6 +1,6 @@
-
-
-This package contains the implementation that wraps the org.smtlib tool as an
-Eclipse plug-in.
-
-
+
+
+This package contains the implementation that wraps the org.smtlib tool as an
+Eclipse plug-in.
+
+
diff --git a/SMTPlugin/test-output/Default suite/Default test.html b/SMTPlugin/test-output/Default suite/Default test.html
index 1c683db..97ec418 100644
--- a/SMTPlugin/test-output/Default suite/Default test.html
+++ b/SMTPlugin/test-output/Default suite/Default test.html
@@ -1,71 +1,71 @@
-
-
-TestNG: Default test
-
-
-
-
-
-
-
-
-
Default test
-
-
Tests passed/Failed/Skipped:
0/0/0
-
-
Started on:
Wed Dec 22 22:01:03 EST 2010
-
-
Total time:
0 seconds (4 ms)
-
-
Included groups:
-
-
Excluded groups:
-
-
-(Hover the method name to see the test class name)
-
+
+
+TestNG: Default test
+
+
+
+
+
+
+
+
+
Default test
+
+
Tests passed/Failed/Skipped:
0/0/0
+
+
Started on:
Wed Dec 22 22:01:03 EST 2010
+
+
Total time:
0 seconds (4 ms)
+
+
Included groups:
+
+
Excluded groups:
+
+
+(Hover the method name to see the test class name)
+
\ No newline at end of file
diff --git a/SMTPlugin/test-output/Default suite/Default test.xml b/SMTPlugin/test-output/Default suite/Default test.xml
index 8a2e585..961c718 100644
--- a/SMTPlugin/test-output/Default suite/Default test.xml
+++ b/SMTPlugin/test-output/Default suite/Default test.xml
@@ -1,3 +1,3 @@
-
-
-
+
+
+
diff --git a/SMTPlugin/test-output/Default suite/classes.html b/SMTPlugin/test-output/Default suite/classes.html
index d67b927..b296fe8 100644
--- a/SMTPlugin/test-output/Default suite/classes.html
+++ b/SMTPlugin/test-output/Default suite/classes.html
@@ -1,6 +1,6 @@
-
-
-
Class name
-
Method name
-
Groups
-
+
+
+
Class name
+
Method name
+
Groups
+
diff --git a/SMTPlugin/test-output/Default suite/index.html b/SMTPlugin/test-output/Default suite/index.html
index 6064b6e..8ed202c 100644
--- a/SMTPlugin/test-output/Default suite/index.html
+++ b/SMTPlugin/test-output/Default suite/index.html
@@ -1,6 +1,6 @@
-Results for Default suite
-
-
+Results for Default suite
+
+
diff --git a/SMTPlugin/test-output/Default suite/main.html b/SMTPlugin/test-output/Default suite/main.html
index 853de68..5888ae0 100644
--- a/SMTPlugin/test-output/Default suite/main.html
+++ b/SMTPlugin/test-output/Default suite/main.html
@@ -1,2 +1,2 @@
-Results for Default suite
-Select a result on the left-hand pane.
+Results for Default suite
+Select a result on the left-hand pane.
diff --git a/SMTPlugin/test-output/Default suite/methods-alphabetical.html b/SMTPlugin/test-output/Default suite/methods-alphabetical.html
index 2b68dfa..f5684cb 100644
--- a/SMTPlugin/test-output/Default suite/methods-alphabetical.html
+++ b/SMTPlugin/test-output/Default suite/methods-alphabetical.html
@@ -1,2 +1,2 @@
-
Methods run, sorted chronologically
>> means before, << means after
Default suite(Hover the method name to see the test class name)
-
+
Methods run, sorted chronologically
>> means before, << means after
Default suite(Hover the method name to see the test class name)
+
diff --git a/SMTPlugin/test-output/Default suite/methods-not-run.html b/SMTPlugin/test-output/Default suite/methods-not-run.html
index 7ce7026..54b14cb 100644
--- a/SMTPlugin/test-output/Default suite/methods-not-run.html
+++ b/SMTPlugin/test-output/Default suite/methods-not-run.html
@@ -1,2 +1,2 @@
-
Methods that were not run
+
Methods that were not run
\ No newline at end of file
diff --git a/SMTPlugin/test-output/Default suite/methods.html b/SMTPlugin/test-output/Default suite/methods.html
index 2b68dfa..f5684cb 100644
--- a/SMTPlugin/test-output/Default suite/methods.html
+++ b/SMTPlugin/test-output/Default suite/methods.html
@@ -1,2 +1,2 @@
-
Methods run, sorted chronologically
>> means before, << means after
Default suite(Hover the method name to see the test class name)
-
+
Methods run, sorted chronologically
>> means before, << means after
Default suite(Hover the method name to see the test class name)
+
diff --git a/SMTPlugin/test-output/Default suite/toc.html b/SMTPlugin/test-output/Default suite/toc.html
index 7812d22..be39c8e 100644
--- a/SMTPlugin/test-output/Default suite/toc.html
+++ b/SMTPlugin/test-output/Default suite/toc.html
@@ -1,30 +1,30 @@
-
-
-Results for Default suite
-
-
-
-
-
\ No newline at end of file
diff --git a/SMTPlugin/test-output/emailable-report.html b/SMTPlugin/test-output/emailable-report.html
index c2e64e9..3dba06e 100644
--- a/SMTPlugin/test-output/emailable-report.html
+++ b/SMTPlugin/test-output/emailable-report.html
@@ -1,39 +1,39 @@
-
-
-
-TestNG: Unit Test
-
-
-
-
-GrammaTech, Inc. ("GrammaTech") may provide hyperlinks to third party Web sites or access to third party content, including, but not limited to software through its website, www.grammatech.com ("Site"). GrammaTech does not control, endorse, or guarantee content found in such sites or software. You agree that GrammaTech is not responsible for any content, associated links, resources, software, or services associated with a third party site or material. You further agree that GrammaTech shall not be liable for any loss or claim of any sort associated with your use of third party content. Links and access to these sites are provided for your convenience only.
-
-EXCEPT AS EXPRESSLY STATED IN AN AGREEMENT BETWEEN YOU AND GRAMMATECH, ALL CONTENT, SERVICES, PRODUCTS AND SOFTWARE PROVIDED ON THIS WEB SITE ARE PROVIDED "AS IS" AND "WITH ALL FAULTS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED. GRAMMATECH AND ITS SUPPLIERS AND LICENSORS DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, THOSE OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. YOU ARE SOLELY RESPONSIBLE FOR THE APPROPRIATENESS OF THE SITE, ITS CONTENT, AND THE PRODUCTS AND SERVICES OFFERED BY GRAMMATECH ON THE SITE FOR YOUR INTENDED APPLICATION AND USE. SUBJECT TO THE TERMS OF ANY AGREEMENT BETWEEN YOU AND GRAMMATECH, GRAMMATECH, ITS SUPPLIERS AND LICENSORS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, PUNITIVE DAMAGES, OR ANY ECONOMIC LOSS, EVEN IF GRAMMATECH, ITS SUPPLIERS OR LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH CLAIMS.
-
GrammaTech uses SMT solvers as part of its suite of
+sophisticated static analysis tools. This page lists a
+number of resources about SMT solvers and the SMT-LIB
+language. These are not GrammaTech products; they are linked here
+solely for convenience and as a service.
+There is no charge for their use for educational
+or research purposes (but they may be copyrighted and there may be
+restrictions on commercial use).
+
+GrammaTech, Inc. ("GrammaTech") may provide hyperlinks to third party Web sites or access to third party content, including, but not limited to software through its website, www.grammatech.com ("Site"). GrammaTech does not control, endorse, or guarantee content found in such sites or software. You agree that GrammaTech is not responsible for any content, associated links, resources, software, or services associated with a third party site or material. You further agree that GrammaTech shall not be liable for any loss or claim of any sort associated with your use of third party content. Links and access to these sites are provided for your convenience only.
+
+EXCEPT AS EXPRESSLY STATED IN AN AGREEMENT BETWEEN YOU AND GRAMMATECH, ALL CONTENT, SERVICES, PRODUCTS AND SOFTWARE PROVIDED ON THIS WEB SITE ARE PROVIDED "AS IS" AND "WITH ALL FAULTS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED. GRAMMATECH AND ITS SUPPLIERS AND LICENSORS DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, THOSE OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. YOU ARE SOLELY RESPONSIBLE FOR THE APPROPRIATENESS OF THE SITE, ITS CONTENT, AND THE PRODUCTS AND SERVICES OFFERED BY GRAMMATECH ON THE SITE FOR YOUR INTENDED APPLICATION AND USE. SUBJECT TO THE TERMS OF ANY AGREEMENT BETWEEN YOU AND GRAMMATECH, GRAMMATECH, ITS SUPPLIERS AND LICENSORS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, PUNITIVE DAMAGES, OR ANY ECONOMIC LOSS, EVEN IF GRAMMATECH, ITS SUPPLIERS OR LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH CLAIMS.
+
-
-Support for some of the development of these resources was provided by
-GrammaTech, Inc., a user of SMT tools and a
-creator and vendor of program analysis research and tools.
-
-
-If you use the software in
-publicly presented or published work, please acknowledge the contribution of jSMTLIB.
-
-The Tutorial and UserGuide available here are copyright by David Cok.
-
-
DISCLAIMER
-
-
-ALL CONTENT, SERVICES, PRODUCTS AND SOFTWARE PROVIDED ON THIS WEB SITE ARE PROVIDED "AS IS" AND "WITH ALL FAULTS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED. YOU ARE SOLELY RESPONSIBLE FOR THE APPROPRIATENESS OF THE SITE, ITS CONTENT, AND THE PRODUCTS AND SERVICES PROVIDED ON THE SITE FOR YOUR INTENDED APPLICATION AND USE.
-
+
+Support for some of the development of these resources was provided by
+GrammaTech, Inc., a user of SMT tools and a
+creator and vendor of program analysis research and tools.
+
+
+If you use the software in
+publicly presented or published work, please acknowledge the contribution of jSMTLIB.
+
+The Tutorial and UserGuide available here are copyright by David Cok.
+
+
DISCLAIMER
+
+
+ALL CONTENT, SERVICES, PRODUCTS AND SOFTWARE PROVIDED ON THIS WEB SITE ARE PROVIDED "AS IS" AND "WITH ALL FAULTS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED. YOU ARE SOLELY RESPONSIBLE FOR THE APPROPRIATENESS OF THE SITE, ITS CONTENT, AND THE PRODUCTS AND SERVICES PROVIDED ON THE SITE FOR YOUR INTENDED APPLICATION AND USE.
+
This is the Eclipse plug-in update site for the jSMTLIB Eclipse plug-in.
-
-Within Eclipse (4.2 or later) use the Install New Software wizard to add a new
-site: use the URL of this page, and a title of your choice, such as "jSMTLIB".
-
-
-To run this plugin you must be running Eclipse from an OpenJDK build of Java 1.7. See the instructions here.
-
-
-This is currently a preliminary, alpha release; it is not yet portable
-across platforms --- it crashes on some.
-
This is the Eclipse plug-in update site for the jSMTLIB Eclipse plug-in.
+
+Within Eclipse (4.2 or later) use the Install New Software wizard to add a new
+site: use the URL of this page, and a title of your choice, such as "jSMTLIB".
+
+
+To run this plugin you must be running Eclipse from an OpenJDK build of Java 1.7. See the instructions here.
+
+
+This is currently a preliminary, alpha release; it is not yet portable
+across platforms --- it crashes on some.
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SMTUpdateSite/web/setup b/SMTUpdateSite/web/setup
index bed6d15..885c846 100644
--- a/SMTUpdateSite/web/setup
+++ b/SMTUpdateSite/web/setup
@@ -1,33 +1,33 @@
-
-## This script should be SOURCED, not executed
-## The pwd must be the OpenJML-UpdateSite directory
-
-## This script copies files from elsewhere into the 'web' subdirectory and creates the README file
-## It is a common setup file used by the various scripts that copy to sourceforge
-
-## Copy the current version of the UserGuide
-## Copy the current version of the .psf file
-## Remove old versions of the release
-## Copy the most current plug-in feature file
-## Create a current version of the README file
-## Sets the value of the 'version' variable
-
-# ?? Make the user guid
-# ?? make the tutorial
-
-cd SMTUpdateSite
-cd C:/cygwin/home/dcok/eprojects/OpenJML-UpdateSite
-cp ../OpenJML/documentation/OpenJMLUserGuide/OpenJMLUserGuide.pdf web/files
-cp ../projectSet.psf web/files/OpenJML-projectSet.psf
-web/convert-psf ../projectSet.psf ../svn_commands
-cp ../svn_commands web/files
-export version=`ls -t features/* | head -1 | sed -e sxfeatures/org.jmlspecs.openjml.OpenJMLFeature_xx -e sx.jarxx`
-file=`ls -t ../OpenJML/*.tar.gz | head -1`
-##filedate=`echo $file | tr -d [a-zA-Z./] | tr -d '-'`
-echo The current version is $version, file $file
-echo The current version is $version, file $file | cat web/README-root - > web/files/README
-
-cp $file web/files
-cp `echo "$file" | sed -e "s/tar.gz/zip/"` web/files
-
-
+
+## This script should be SOURCED, not executed
+## The pwd must be the OpenJML-UpdateSite directory
+
+## This script copies files from elsewhere into the 'web' subdirectory and creates the README file
+## It is a common setup file used by the various scripts that copy to sourceforge
+
+## Copy the current version of the UserGuide
+## Copy the current version of the .psf file
+## Remove old versions of the release
+## Copy the most current plug-in feature file
+## Create a current version of the README file
+## Sets the value of the 'version' variable
+
+# ?? Make the user guid
+# ?? make the tutorial
+
+cd SMTUpdateSite
+cd C:/cygwin/home/dcok/eprojects/OpenJML-UpdateSite
+cp ../OpenJML/documentation/OpenJMLUserGuide/OpenJMLUserGuide.pdf web/files
+cp ../projectSet.psf web/files/OpenJML-projectSet.psf
+web/convert-psf ../projectSet.psf ../svn_commands
+cp ../svn_commands web/files
+export version=`ls -t features/* | head -1 | sed -e sxfeatures/org.jmlspecs.openjml.OpenJMLFeature_xx -e sx.jarxx`
+file=`ls -t ../OpenJML/*.tar.gz | head -1`
+##filedate=`echo $file | tr -d [a-zA-Z./] | tr -d '-'`
+echo The current version is $version, file $file
+echo The current version is $version, file $file | cat web/README-root - > web/files/README
+
+cp $file web/files
+cp `echo "$file" | sed -e "s/tar.gz/zip/"` web/files
+
+
diff --git a/SMTUpdateSite/web/style.css b/SMTUpdateSite/web/style.css
index 64e90ee..e1d68fb 100644
--- a/SMTUpdateSite/web/style.css
+++ b/SMTUpdateSite/web/style.css
@@ -1,566 +1,566 @@
-/*-------------------------------------------------------------*/
-/* Block Formatting */
-
-body {
- font-family: Helvetica, Arial, sans-serif;
- font-size: 1em;
- color: #000;
- background-color: #FFF;
- background-position: center;
- background-repeat: repeat-y;
- background-image: url("../images/jml-bg.png");
- margin: 0px;
-}
-
-/*-------------------------------------------------------------*/
-/* Headings */
-
-h1 {
- color: black;
- background-color: transparent;
- font-size: 2.2em;
- font-weight: bold;
- text-align: center;
- padding: 1.25ex 1ex 1.25ex 1ex; /* top right bottom left */
- margin: 0ex 0px 0px 0px; /* top right bottom left */
-}
-
-h2 {
- color: #000099;
- font-size: 1.5em;
- font-weight: bold;
- border-bottom: #611 2px solid;
- padding-left: 8px;
- margin: 1.7ex 0px 0px 0px; /* top right bottom left */
-}
-
-h3 {
- font-size: 1.2em;
- font-weight: bold;
- text-align: left;
- margin: 1.5ex 0px 0px 0px; /* top right bottom left */
-}
-
-h4 {
- font-size: 1.0em;
- font-style: italic;
- font-weight: bold;
- text-align: left;
- margin: 1ex 0px 0px 0px; /* top right bottom left */
-}
-
-h5 {
- font-size: 1em;
- color: #611;
- background-color: transparent;
- font-style: italic;
- text-align: left;
- margin: 1.5ex 8px 0px 8px; /* top right bottom left */
-}
-
-/*-------------------------------------------------------------*/
-/* Paragraphs */
-
-p {
- margin-top: 1.5ex;
- margin-bottom: 0ex;
- margin-left: 8px;
- margin-right: 8px;
-}
-
-.note {
- font-size: .8em;
- color: #888;
- background-color: transparent;
-}
-
-/* a remark is like a note, but bigger */
-.remark {
- color: #888;
- background-color: transparent;
- font-weight: normal;
-}
-
-.modTime {
- font-size: .8em;
- color: #888;
- clear: both;
- background-color: transparent;
- padding-bottom: 0.5ex;
-}
-
-p.newsdate {
- color: #888;
- background-color: transparent;
- border-bottom: 1px solid #888;
-}
-
-p.version {
- font-size: .8em;
- padding: 2px;
- border: thin solid #222;
-}
-
-p.signature {
- margin-left: 65%;
-}
-
-p.question {
- font-size: 1.2em;
-}
-
-p.answer {
-}
-
-p.indented {
- margin-top: 0em;
- margin-left: 2em;
- margin-right: 2em;
-}
-
-.right {
- text-align: right;
-}
-
-p.hanging1 {
- text-indent: -2em;
- margin-left: 2em;
- margin-top: 1ex;
- margin-bottom: 1ex;
-}
-
-p.hanging2 {
- text-indent: -2em;
- margin-left: 4em;
- margin-top: 1ex;
- margin-bottom: 1ex;
-}
-
-p.hanging3 {
- text-indent: -2em;
- margin-left: 6em;
- margin-top: 1ex;
- margin-bottom: 1ex;
-}
-
-p.hanging4 {
- text-indent: -2em;
- margin-left: 8em;
- margin-top: 1ex;
- margin-bottom: 1ex;
-}
-
-p.breaked {
- margin-top: 0ex;
-}
-
-code {
- font-family: "Courier New", "Courier", monospaced, serif;
-}
-
-.center {
- text-align: center;
-}
-
-.left {
- text-align: left;
-}
-
-pre {
- font-size: 1.0em;
- font-family: "Andale Mono", "Courier New", "Courier", monospaced, serif;
- margin-top: 1.5ex;
- margin-bottom: 0ex;
- margin-left: 16px;
- margin-right: 16px;
- color: #161;
- background-color: inherit;
-}
-
-/*---------------------------------------------------------------------
- Tables
- */
-
-table {
- margin-left: auto;
- margin-right: auto;
- margin-top: 1ex;
-}
-
-caption {
- font-weight: bold;
-}
-
-tr.head {
- border-top: #00A 1px solid;
- border-right: #00A 1px solid;
-}
-
-th, td.rowhead {
- font-weight: bold;
- color: #000;
- background-color: #EEF;
- text-align: left;
- vertical-align: bottom;
- padding-left: 5px;
- padding-right: 5px;
- border-left: #00A 5px solid;
- margin: 0ex;
-}
-
-td {
- vertical-align: top;
- padding-left: 10px;
-}
-
-td.logo {
- background-color: #dddddd;
- text-align: center;
- vertical-align: middle;
-}
-
-/*---------------------------------------------------------------------
- Forms
- */
-form {
- font-size: 1em;
- padding-bottom: 0px;
- margin: 0ex;
-}
-
-/*---------------------------------------------------------------------
- Text Formatting
- */
-
-em {
- font-style: italic;
-}
-
-kbd {
- font-family: "Andale Mono", "Courier New", "Courier", monospaced, serif;
- color: #161;
-}
-
-kbd.input {
- color: #161;
- background-color: #000;
- font-weight: bold;
-}
-
-kbd.output {
- color: #060;
- background-color: #000;
-}
-
-kbd.sample {
- color: #161;
- background-color: #000;
-}
-
-strong {
- font-weight: bold;
- color: #611;
- background-color: transparent;
-}
-
-sup {
- font-size: 0.7em;
-}
-
-/*---------------------------------------------------------------------
- Lists
- */
-
-ol {
- margin-top: 1ex;
- margin-bottom: 1ex;
-}
-
-ul {
- margin-top: 1ex;
- margin-bottom: 1ex;
-}
-
-li.ref {
- margin-top: 0.5ex;
- margin-bottom: 0.5ex;
-}
-
-dl.ref {
- margin-top: 1ex;
- margin-bottom: 1ex;
-}
-
-/*-------------------------------------------------------------*/
-/* Image foo */
-
-img {
- background-color: transparent;
-}
-
-img.center {
- position: inherit;
-}
-
-img.wrapRight {
- float: right;
- padding: 0.5ex;
-}
-
-a img { border: none }
-
-/* ------------------------------------------------------------- */
-/* Layout foo */
-
-#banner {
- color: black;
- border: 0;
- background-color: #dddddd;
- border-color: black;
- text-align: center;
-}
-
-#rest {
- margin: 0px;
-}
-
-#content {
- color: #000;
- background-color: transparent;
- padding-top: 5px;
- padding-left: 5px;
- margin-top: 0ex;
- margin-right: 0.5ex;
- margin-bottom: 0ex;
- margin-left: 206px; /* should equal width of #menu */
- border-bottom: #611 1px solid;
-}
-
-#menu {
- float: left;
- width: 206px; /* should equal margin-left of #content */
- background-color: transparent;
- padding-top: 5px;
- padding-bottom: 5em;
- margin: 0ex 0ex 0px 0px; /* top right bottom left */
-}
-
-#menu p {
- text-indent: 0em;
- margin-top: 0.25ex;
- margin-bottom: 0.25ex;
-}
-
-#menu p.gapBefore {
- margin-top: 3em;
-}
-
-#menu p.title {
- font-weight: bold;
- color: #000099;
- background-color: transparent;
- padding-top: 1ex;
- padding-left: 0.5ex; /* match link padding in #menu A */
- border-bottom: #611 1px solid;
- margin-right: 1ex;
-}
-
-#menu a {
- padding-left: 1ex;
- padding-right: 1ex;
- display: block;
-}
-
-#footer {
- color: #000;
- background-color: transparent;
- padding: 0.1ex;
-}
-
-.jumpbar {
- font-size: 0.8em;
- color: #222;
- background-color: #EEF;
-/* border-bottom: #00A 1px solid; */
- margin: 1ex 0ex 0ex 0ex;
-}
-
-/* -------------------------------------------------------------
- * These three column IDs go together. Don't muck with one without
- * checking the others.
- */
-
-#leftcolumn {
- float: left;
- width: 15em; /* see centercolumn margin-left */
-}
-
-#centercolumn {
- margin-left: 16em; /* leftcolumn width + gap */
- margin-right: 16em; /* rightcolumn width + gap */
-}
-
-#rightcolumn { /* right column content must preceed center in document */
- float: right;
- width: 15em; /* see centercolumn margin-right */
-}
-
-.column h2 {
- font-size: 1em;
-}
-
-.column p {
- margin-top: 0.25ex;
- margin-bottom: 0.25ex;
-}
-
-.column a {
- padding-left: 0.5em;
- padding-right: 0.5em;
- display: block;
-}
-
-.column a.indented {
- padding-left: 1.5em;
- display: block;
-}
-
-/* override block display of links when I want a form element on the
-same line */
-a.withform {
- display: inline;
-}
-
-/* ------------------------------------------------------------- */
-/* OVERRIDES: These must be near the end of the page so they
- override any statements of equal specificity appearing above */
-
-a:link {
- text-decoration: none;
- color: #0000ff;
- background-color: inherit;
-}
-a:visited {
- text-decoration: none;
- color: #0000ff;
- background-color: inherit;
-}
-a:active {
- border: 1px;
-}
-a:hover {
- color: #161;
- background-color: #FFB;
-}
-
-a.dead:link {
- color: #BBB;
- background-color: inherit;
-}
-a.dead:visited {
- color: #BBB;
- background-color: inherit;
-}
-a.dead:active {
- color: #BBB;
- background-color: inherit;
-}
-a.dead:hover {
- color: #BBB;
- background-color: #FFF;
-}
-
-a.target:link {
- color: inherit;
- background-color: inherit;
-}
-a.target:visited {
- color: inherit;
- background-color: inherit;
-}
-a.target:active {
- color: inherit;
- background-color: inherit;
-}
-a.target:hover {
- color: inherit;
- background-color: inherit;
-}
-
-.jumpbar a {
- display: block;
- padding-left: 5px;
-}
-
-a.convenience:link {
- font-variant: inherit;
- font-weight: inherit;
- color: inherit;
- background-color: inherit;
-}
-a.convenience:visited {
- font-variant: inherit;
- font-weight: inherit;
- color: inherit;
- background-color: inherit;
-}
-a.convenience:hover {
- color: #A00;
- background-color: #FF8;
-}
-
-/* ------------------------------------------------------------- */
-/* Media Customizations, these are at the end of the page to get
- "last crack" at the settings. */
-
-@media print {
- body {
- font-family: "Times New Roman", Times, serif;
- color: #000;
- background-color: #FFF;
- }
-
- #menu {
- position: fixed;
- display: none;
- }
-
- #footer {
- display: none;
- }
-
- #content {
- text-align: justify;
- margin-left: auto;
- margin-right: auto;
- border: none;
- }
-
- .jumpbar {
- display: none;
- }
-
- a:link {
- font-variant: normal;
- font-weight: normal;
- text-decoration: none;
- color: black;
- background-color: white;
- }
- a:visited {
- font-variant: normal;
- font-weight: normal;
- text-decoration: none;
- color: black;
- background-color: white;
- }
- a:active {
- font-variant: normal;
- font-weight: normal;
- text-decoration: none;
- color: black;
- background-color: white;
- }
-}
-
-/* $Id: style.css,v 1.12 2009/08/07 17:19:14 leavens Exp $ */
+/*-------------------------------------------------------------*/
+/* Block Formatting */
+
+body {
+ font-family: Helvetica, Arial, sans-serif;
+ font-size: 1em;
+ color: #000;
+ background-color: #FFF;
+ background-position: center;
+ background-repeat: repeat-y;
+ background-image: url("../images/jml-bg.png");
+ margin: 0px;
+}
+
+/*-------------------------------------------------------------*/
+/* Headings */
+
+h1 {
+ color: black;
+ background-color: transparent;
+ font-size: 2.2em;
+ font-weight: bold;
+ text-align: center;
+ padding: 1.25ex 1ex 1.25ex 1ex; /* top right bottom left */
+ margin: 0ex 0px 0px 0px; /* top right bottom left */
+}
+
+h2 {
+ color: #000099;
+ font-size: 1.5em;
+ font-weight: bold;
+ border-bottom: #611 2px solid;
+ padding-left: 8px;
+ margin: 1.7ex 0px 0px 0px; /* top right bottom left */
+}
+
+h3 {
+ font-size: 1.2em;
+ font-weight: bold;
+ text-align: left;
+ margin: 1.5ex 0px 0px 0px; /* top right bottom left */
+}
+
+h4 {
+ font-size: 1.0em;
+ font-style: italic;
+ font-weight: bold;
+ text-align: left;
+ margin: 1ex 0px 0px 0px; /* top right bottom left */
+}
+
+h5 {
+ font-size: 1em;
+ color: #611;
+ background-color: transparent;
+ font-style: italic;
+ text-align: left;
+ margin: 1.5ex 8px 0px 8px; /* top right bottom left */
+}
+
+/*-------------------------------------------------------------*/
+/* Paragraphs */
+
+p {
+ margin-top: 1.5ex;
+ margin-bottom: 0ex;
+ margin-left: 8px;
+ margin-right: 8px;
+}
+
+.note {
+ font-size: .8em;
+ color: #888;
+ background-color: transparent;
+}
+
+/* a remark is like a note, but bigger */
+.remark {
+ color: #888;
+ background-color: transparent;
+ font-weight: normal;
+}
+
+.modTime {
+ font-size: .8em;
+ color: #888;
+ clear: both;
+ background-color: transparent;
+ padding-bottom: 0.5ex;
+}
+
+p.newsdate {
+ color: #888;
+ background-color: transparent;
+ border-bottom: 1px solid #888;
+}
+
+p.version {
+ font-size: .8em;
+ padding: 2px;
+ border: thin solid #222;
+}
+
+p.signature {
+ margin-left: 65%;
+}
+
+p.question {
+ font-size: 1.2em;
+}
+
+p.answer {
+}
+
+p.indented {
+ margin-top: 0em;
+ margin-left: 2em;
+ margin-right: 2em;
+}
+
+.right {
+ text-align: right;
+}
+
+p.hanging1 {
+ text-indent: -2em;
+ margin-left: 2em;
+ margin-top: 1ex;
+ margin-bottom: 1ex;
+}
+
+p.hanging2 {
+ text-indent: -2em;
+ margin-left: 4em;
+ margin-top: 1ex;
+ margin-bottom: 1ex;
+}
+
+p.hanging3 {
+ text-indent: -2em;
+ margin-left: 6em;
+ margin-top: 1ex;
+ margin-bottom: 1ex;
+}
+
+p.hanging4 {
+ text-indent: -2em;
+ margin-left: 8em;
+ margin-top: 1ex;
+ margin-bottom: 1ex;
+}
+
+p.breaked {
+ margin-top: 0ex;
+}
+
+code {
+ font-family: "Courier New", "Courier", monospaced, serif;
+}
+
+.center {
+ text-align: center;
+}
+
+.left {
+ text-align: left;
+}
+
+pre {
+ font-size: 1.0em;
+ font-family: "Andale Mono", "Courier New", "Courier", monospaced, serif;
+ margin-top: 1.5ex;
+ margin-bottom: 0ex;
+ margin-left: 16px;
+ margin-right: 16px;
+ color: #161;
+ background-color: inherit;
+}
+
+/*---------------------------------------------------------------------
+ Tables
+ */
+
+table {
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: 1ex;
+}
+
+caption {
+ font-weight: bold;
+}
+
+tr.head {
+ border-top: #00A 1px solid;
+ border-right: #00A 1px solid;
+}
+
+th, td.rowhead {
+ font-weight: bold;
+ color: #000;
+ background-color: #EEF;
+ text-align: left;
+ vertical-align: bottom;
+ padding-left: 5px;
+ padding-right: 5px;
+ border-left: #00A 5px solid;
+ margin: 0ex;
+}
+
+td {
+ vertical-align: top;
+ padding-left: 10px;
+}
+
+td.logo {
+ background-color: #dddddd;
+ text-align: center;
+ vertical-align: middle;
+}
+
+/*---------------------------------------------------------------------
+ Forms
+ */
+form {
+ font-size: 1em;
+ padding-bottom: 0px;
+ margin: 0ex;
+}
+
+/*---------------------------------------------------------------------
+ Text Formatting
+ */
+
+em {
+ font-style: italic;
+}
+
+kbd {
+ font-family: "Andale Mono", "Courier New", "Courier", monospaced, serif;
+ color: #161;
+}
+
+kbd.input {
+ color: #161;
+ background-color: #000;
+ font-weight: bold;
+}
+
+kbd.output {
+ color: #060;
+ background-color: #000;
+}
+
+kbd.sample {
+ color: #161;
+ background-color: #000;
+}
+
+strong {
+ font-weight: bold;
+ color: #611;
+ background-color: transparent;
+}
+
+sup {
+ font-size: 0.7em;
+}
+
+/*---------------------------------------------------------------------
+ Lists
+ */
+
+ol {
+ margin-top: 1ex;
+ margin-bottom: 1ex;
+}
+
+ul {
+ margin-top: 1ex;
+ margin-bottom: 1ex;
+}
+
+li.ref {
+ margin-top: 0.5ex;
+ margin-bottom: 0.5ex;
+}
+
+dl.ref {
+ margin-top: 1ex;
+ margin-bottom: 1ex;
+}
+
+/*-------------------------------------------------------------*/
+/* Image foo */
+
+img {
+ background-color: transparent;
+}
+
+img.center {
+ position: inherit;
+}
+
+img.wrapRight {
+ float: right;
+ padding: 0.5ex;
+}
+
+a img { border: none }
+
+/* ------------------------------------------------------------- */
+/* Layout foo */
+
+#banner {
+ color: black;
+ border: 0;
+ background-color: #dddddd;
+ border-color: black;
+ text-align: center;
+}
+
+#rest {
+ margin: 0px;
+}
+
+#content {
+ color: #000;
+ background-color: transparent;
+ padding-top: 5px;
+ padding-left: 5px;
+ margin-top: 0ex;
+ margin-right: 0.5ex;
+ margin-bottom: 0ex;
+ margin-left: 206px; /* should equal width of #menu */
+ border-bottom: #611 1px solid;
+}
+
+#menu {
+ float: left;
+ width: 206px; /* should equal margin-left of #content */
+ background-color: transparent;
+ padding-top: 5px;
+ padding-bottom: 5em;
+ margin: 0ex 0ex 0px 0px; /* top right bottom left */
+}
+
+#menu p {
+ text-indent: 0em;
+ margin-top: 0.25ex;
+ margin-bottom: 0.25ex;
+}
+
+#menu p.gapBefore {
+ margin-top: 3em;
+}
+
+#menu p.title {
+ font-weight: bold;
+ color: #000099;
+ background-color: transparent;
+ padding-top: 1ex;
+ padding-left: 0.5ex; /* match link padding in #menu A */
+ border-bottom: #611 1px solid;
+ margin-right: 1ex;
+}
+
+#menu a {
+ padding-left: 1ex;
+ padding-right: 1ex;
+ display: block;
+}
+
+#footer {
+ color: #000;
+ background-color: transparent;
+ padding: 0.1ex;
+}
+
+.jumpbar {
+ font-size: 0.8em;
+ color: #222;
+ background-color: #EEF;
+/* border-bottom: #00A 1px solid; */
+ margin: 1ex 0ex 0ex 0ex;
+}
+
+/* -------------------------------------------------------------
+ * These three column IDs go together. Don't muck with one without
+ * checking the others.
+ */
+
+#leftcolumn {
+ float: left;
+ width: 15em; /* see centercolumn margin-left */
+}
+
+#centercolumn {
+ margin-left: 16em; /* leftcolumn width + gap */
+ margin-right: 16em; /* rightcolumn width + gap */
+}
+
+#rightcolumn { /* right column content must preceed center in document */
+ float: right;
+ width: 15em; /* see centercolumn margin-right */
+}
+
+.column h2 {
+ font-size: 1em;
+}
+
+.column p {
+ margin-top: 0.25ex;
+ margin-bottom: 0.25ex;
+}
+
+.column a {
+ padding-left: 0.5em;
+ padding-right: 0.5em;
+ display: block;
+}
+
+.column a.indented {
+ padding-left: 1.5em;
+ display: block;
+}
+
+/* override block display of links when I want a form element on the
+same line */
+a.withform {
+ display: inline;
+}
+
+/* ------------------------------------------------------------- */
+/* OVERRIDES: These must be near the end of the page so they
+ override any statements of equal specificity appearing above */
+
+a:link {
+ text-decoration: none;
+ color: #0000ff;
+ background-color: inherit;
+}
+a:visited {
+ text-decoration: none;
+ color: #0000ff;
+ background-color: inherit;
+}
+a:active {
+ border: 1px;
+}
+a:hover {
+ color: #161;
+ background-color: #FFB;
+}
+
+a.dead:link {
+ color: #BBB;
+ background-color: inherit;
+}
+a.dead:visited {
+ color: #BBB;
+ background-color: inherit;
+}
+a.dead:active {
+ color: #BBB;
+ background-color: inherit;
+}
+a.dead:hover {
+ color: #BBB;
+ background-color: #FFF;
+}
+
+a.target:link {
+ color: inherit;
+ background-color: inherit;
+}
+a.target:visited {
+ color: inherit;
+ background-color: inherit;
+}
+a.target:active {
+ color: inherit;
+ background-color: inherit;
+}
+a.target:hover {
+ color: inherit;
+ background-color: inherit;
+}
+
+.jumpbar a {
+ display: block;
+ padding-left: 5px;
+}
+
+a.convenience:link {
+ font-variant: inherit;
+ font-weight: inherit;
+ color: inherit;
+ background-color: inherit;
+}
+a.convenience:visited {
+ font-variant: inherit;
+ font-weight: inherit;
+ color: inherit;
+ background-color: inherit;
+}
+a.convenience:hover {
+ color: #A00;
+ background-color: #FF8;
+}
+
+/* ------------------------------------------------------------- */
+/* Media Customizations, these are at the end of the page to get
+ "last crack" at the settings. */
+
+@media print {
+ body {
+ font-family: "Times New Roman", Times, serif;
+ color: #000;
+ background-color: #FFF;
+ }
+
+ #menu {
+ position: fixed;
+ display: none;
+ }
+
+ #footer {
+ display: none;
+ }
+
+ #content {
+ text-align: justify;
+ margin-left: auto;
+ margin-right: auto;
+ border: none;
+ }
+
+ .jumpbar {
+ display: none;
+ }
+
+ a:link {
+ font-variant: normal;
+ font-weight: normal;
+ text-decoration: none;
+ color: black;
+ background-color: white;
+ }
+ a:visited {
+ font-variant: normal;
+ font-weight: normal;
+ text-decoration: none;
+ color: black;
+ background-color: white;
+ }
+ a:active {
+ font-variant: normal;
+ font-weight: normal;
+ text-decoration: none;
+ color: black;
+ background-color: white;
+ }
+}
+
+/* $Id: style.css,v 1.12 2009/08/07 17:19:14 leavens Exp $ */
diff --git a/gradlew.bat b/gradlew.bat
index 15e1ee3..9991c50 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,100 +1,100 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem http://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem http://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega