mirror of
https://github.com/Z3Prover/z3
synced 2025-06-05 21:53:23 +00:00
other components
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
e9eab22e5c
commit
68269c43a6
250 changed files with 70871 additions and 0 deletions
466
Makefile.in
Normal file
466
Makefile.in
Normal file
|
@ -0,0 +1,466 @@
|
||||||
|
|
||||||
|
SHELL=/bin/sh
|
||||||
|
SED=sed
|
||||||
|
AWK=awk
|
||||||
|
DOS2UNIX=@D2U@
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
|
||||||
|
##### Configuration #####
|
||||||
|
CPPFLAGS_CORE=@CPPFLAGS@ -I lib -fopenmp -msse -msse2 -mfpmath=sse
|
||||||
|
CXXFLAGS_CORE=@CXXFLAGS@
|
||||||
|
ifeq ($(MODE),)
|
||||||
|
Z3_BUILD_MODE=external
|
||||||
|
else
|
||||||
|
Z3_BUILD_MODE=$(MODE)
|
||||||
|
endif
|
||||||
|
LIBS=@LIBS@
|
||||||
|
## -lrt is for timer_create and timer_settime
|
||||||
|
LDFLAGS=@LDFLAGS@ -lpthread -fopenmp
|
||||||
|
LDFLAGS_EXTRA=
|
||||||
|
#########################
|
||||||
|
|
||||||
|
Z3=z3
|
||||||
|
TEST_CAPI=test_capi
|
||||||
|
EPR=epr
|
||||||
|
GROBNER=grobner
|
||||||
|
TEST=test
|
||||||
|
|
||||||
|
BIN_DIR=bin/$(Z3_BUILD_MODE)
|
||||||
|
OBJ_DIR=obj/$(Z3_BUILD_MODE)
|
||||||
|
SED_OBJ_DIR=obj\/$(Z3_BUILD_MODE)
|
||||||
|
OBJ_TEST_DIR=obj-test/$(Z3_BUILD_MODE)
|
||||||
|
SED_OBJ_TEST_DIR=obj-test\/$(Z3_BUILD_MODE)
|
||||||
|
|
||||||
|
MAJ=$(shell grep 'Z3_MAJOR_VERSION' lib/version.h | cut -d ' ' -f 4)
|
||||||
|
MIN=$(shell grep 'Z3_MINOR_VERSION' lib/version.h | cut -d ' ' -f 4)
|
||||||
|
Z3_VERSION=$(MAJ).$(MIN)
|
||||||
|
|
||||||
|
PLATFORM=@PLATFORM@
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(Z3_BUILD_MODE),release)
|
||||||
|
CPPFLAGS=$(CPPFLAGS_CORE) -DNDEBUG
|
||||||
|
CXXFLAGS=-O3 -fomit-frame-pointer $(CXXFLAGS_CORE)
|
||||||
|
else
|
||||||
|
ifeq ($(Z3_BUILD_MODE),smtcomp07)
|
||||||
|
CPPFLAGS=$(CPPFLAGS_CORE) -DNDEBUG -DSMTCOMP
|
||||||
|
CXXFLAGS=-O3 -fomit-frame-pointer $(CXXFLAGS_CORE)
|
||||||
|
# doesn't work on cygwin
|
||||||
|
LDFLAGS_EXTRA=@STATIC_FLAGS@
|
||||||
|
else
|
||||||
|
ifeq ($(Z3_BUILD_MODE),external)
|
||||||
|
CPPFLAGS=$(CPPFLAGS_CORE) -DNDEBUG -D_EXTERNAL_RELEASE
|
||||||
|
CXXFLAGS=-O3 -fomit-frame-pointer $(CXXFLAGS_CORE)
|
||||||
|
# doesn't work on cygwin
|
||||||
|
LDFLAGS_EXTRA=@STATIC_FLAGS@
|
||||||
|
else
|
||||||
|
ifeq ($(Z3_BUILD_MODE),debug)
|
||||||
|
CPPFLAGS=$(CPPFLAGS_CORE) -DZ3DEBUG -D_TRACE
|
||||||
|
CXXFLAGS=-g -Wall $(CXXFLAGS_CORE)
|
||||||
|
else
|
||||||
|
ifeq ($(Z3_BUILD_MODE),debugopt)
|
||||||
|
CPPFLAGS=$(CPPFLAGS_CORE) -DNDEBUG -DZ3DEBUG -D_TRACE
|
||||||
|
CXXFLAGS=-g -O1 $(CXXFLAGS_CORE)
|
||||||
|
else
|
||||||
|
ifeq ($(Z3_BUILD_MODE),trace)
|
||||||
|
CPPFLAGS=$(CPPFLAGS_CORE) -DNDEBUG -D_TRACE
|
||||||
|
CXXFLAGS=-g -O1 $(CXXFLAGS_CORE)
|
||||||
|
else
|
||||||
|
ifeq ($(Z3_BUILD_MODE),profile)
|
||||||
|
CPPFLAGS=$(CPPFLAGS_CORE) -DNDEBUG
|
||||||
|
CXXFLAGS=-g -pg -O2 $(CXXFLAGS_CORE)
|
||||||
|
LDFLAGS_EXTRA=-pg
|
||||||
|
else
|
||||||
|
ifeq ($(Z3_BUILD_MODE),gcov)
|
||||||
|
CPPFLAGS=$(CPPFLAGS_CORE) -DNDEBUG
|
||||||
|
CXXFLAGS=-g -fprofile-arcs -ftest-coverage -O2 $(CXXFLAGS_CORE)
|
||||||
|
LDFLAGS_EXTRA=-fprofile-arcs -ftest-coverage
|
||||||
|
else
|
||||||
|
ifeq ($(Z3_BUILD_MODE),external_parallel)
|
||||||
|
CPPFLAGS=$(CPPFLAGS_CORE) -DNDEBUG -D_EXTERNAL_RELEASE -D_Z3_BUILD_PARALLEL_SMT
|
||||||
|
CXXFLAGS=-O3 -fomit-frame-pointer $(CXXFLAGS_CORE)
|
||||||
|
# doesn't work on cygwin
|
||||||
|
LDFLAGS_EXTRA=@STATIC_FLAGS@
|
||||||
|
else
|
||||||
|
ifeq ($(Z3_BUILD_MODE),debug_parallel)
|
||||||
|
CPPFLAGS=$(CPPFLAGS_CORE) -DZ3DEBUG -D_TRACE -D_Z3_BUILD_PARALLEL_SMT
|
||||||
|
CXXFLAGS=-g -Wall $(CXXFLAGS_CORE)
|
||||||
|
else
|
||||||
|
$(error INVALID BUILD MODE = $(Z3_BUILD_MODE))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
LIBFLAGS=@SLIBFLAGS@
|
||||||
|
|
||||||
|
################################
|
||||||
|
#
|
||||||
|
# Extract the source files from
|
||||||
|
# the MSVC++ project files.
|
||||||
|
#
|
||||||
|
# lib.vcproj ===> lib.srcs
|
||||||
|
# shell.vcproj ===> shell.srcs
|
||||||
|
#
|
||||||
|
################################
|
||||||
|
|
||||||
|
main: $(BIN_DIR)/$(Z3)
|
||||||
|
|
||||||
|
lib.srcs: lib/lib.vcxproj
|
||||||
|
@echo Making 'lib.srcs'...
|
||||||
|
@cp $< lib0.srcs
|
||||||
|
@chmod +rw lib0.srcs
|
||||||
|
@$(DOS2UNIX) lib0.srcs
|
||||||
|
@$(AWK) '/cpp\"/{ print $$0 }' lib0.srcs > lib1.srcs
|
||||||
|
@$(SED) 's|\"||g;s|<ClCompile||g;s|/>||g;s|Include=|lib/|g' lib1.srcs > lib2.srcs
|
||||||
|
@$(AWK) 'BEGIN { printf ("LIB_SRCS= "); } { printf($$1 " ") } END { print ""; }' lib2.srcs > $@
|
||||||
|
@rm -f lib0.srcs
|
||||||
|
@rm -f lib1.srcs
|
||||||
|
@rm -f lib2.srcs
|
||||||
|
|
||||||
|
shell.srcs: shell/shell.vcxproj
|
||||||
|
@echo Making 'shell.srcs'...
|
||||||
|
@cp $< shell0.srcs
|
||||||
|
@chmod +rw shell0.srcs
|
||||||
|
@$(DOS2UNIX) shell0.srcs
|
||||||
|
@$(AWK) '/cpp\"/{ print $$0 }' shell0.srcs > shell1.srcs
|
||||||
|
@$(SED) 's|\"||g;s|<ClCompile||g;s|/>||g;s|Include=|shell/|g' shell1.srcs > shell2.srcs
|
||||||
|
@$(AWK) 'BEGIN { printf ("SHELL_SRCS= "); } { printf($$1 " ") } END { print ""; }' shell2.srcs > $@
|
||||||
|
@rm -f shell0.srcs
|
||||||
|
@rm -f shell1.srcs
|
||||||
|
@rm -f shell2.srcs
|
||||||
|
|
||||||
|
epr.srcs: epr/epr.vcxproj
|
||||||
|
@echo Making 'epr.srcs'...
|
||||||
|
@cp $< epr0.srcs
|
||||||
|
@chmod +rw epr0.srcs
|
||||||
|
@$(DOS2UNIX) epr0.srcs
|
||||||
|
@$(AWK) '/cpp\"/{ print $$0 }' epr0.srcs > epr1.srcs
|
||||||
|
@$(SED) 's|\"||g;s|<ClCompile||g;s|/>||g;s|Include=|epr/|g' epr1.srcs > epr2.srcs
|
||||||
|
@$(AWK) 'BEGIN { printf ("EPR_SRCS= "); } { printf($$1 " ") } END { print ""; }' epr2.srcs > $@
|
||||||
|
@rm -f epr0.srcs
|
||||||
|
@rm -f epr1.srcs
|
||||||
|
@rm -f epr2.srcs
|
||||||
|
|
||||||
|
test.srcs: test/test.vcxproj
|
||||||
|
@echo Making 'test.srcs'...
|
||||||
|
@cp $< test0.srcs
|
||||||
|
@chmod +rw test0.srcs
|
||||||
|
@$(DOS2UNIX) test0.srcs
|
||||||
|
@$(AWK) '/cpp\"/{ print $$0 }' test0.srcs > test1.srcs
|
||||||
|
@$(SED) 's|\"||g;s|<ClCompile||g;s|/>||g;s|Include=|test/|g' test1.srcs > test2.srcs
|
||||||
|
@$(AWK) 'BEGIN { printf ("TEST_SRCS= "); } { printf($$1 " ") } END { print ""; }' test2.srcs > $@
|
||||||
|
@rm -f test0.srcs
|
||||||
|
@rm -f test1.srcs
|
||||||
|
@rm -f test2.srcs
|
||||||
|
|
||||||
|
|
||||||
|
include lib.srcs
|
||||||
|
include shell.srcs
|
||||||
|
include epr.srcs
|
||||||
|
include test.srcs
|
||||||
|
|
||||||
|
LIB_SRCS+=@EXTRA_LIB_SRCS@
|
||||||
|
LIB_OBJS=$(LIB_SRCS:lib/%.cpp=$(OBJ_DIR)/%.o)
|
||||||
|
SHELL_OBJS=$(SHELL_SRCS:shell/%.cpp=$(OBJ_DIR)/%.o)
|
||||||
|
|
||||||
|
OBJS=$(LIB_OBJS) $(SHELL_OBJS)
|
||||||
|
TEST_CAPI_OBJS=$(OBJ_DIR)/test_capi.o $(LIB_OBJS)
|
||||||
|
EPR_OBJS=$(EPR_SRCS:epr/%.cpp=$(OBJ_DIR)/%.o) $(LIB_OBJS)
|
||||||
|
GROBNER_OBJS=$(OBJ_DIR)/grobner_main.o $(LIB_OBJS)
|
||||||
|
TEST_OBJS=$(TEST_SRCS:test/%.cpp=$(OBJ_TEST_DIR)/%.o)
|
||||||
|
|
||||||
|
$(BIN_DIR)/$(Z3): $(OBJ_DIR) $(BIN_DIR) $(OBJS)
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
$(CXX) -o $(BIN_DIR)/$(Z3) $(OBJS) $(LDFLAGS) $(LDFLAGS_EXTRA) $(LIBS)
|
||||||
|
|
||||||
|
$(BIN_DIR)/$(TEST): $(OBJ_DIR) $(BIN_DIR) $(LIB_OBJS) $(TEST_OBJS)
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
$(CXX) -o $(BIN_DIR)/$(TEST) $(LIB_OBJS) $(TEST_OBJS) $(LDFLAGS) $(LDFLAGS_EXTRA) $(LIBS)
|
||||||
|
|
||||||
|
$(BIN_DIR)/$(TEST_CAPI): $(OBJ_DIR) $(BIN_DIR) $(TEST_CAPI_OBJS)
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
$(CXX) -o $(BIN_DIR)/$(TEST_CAPI) $(TEST_CAPI_OBJS) $(LDFLAGS) $(LDFLAGS_EXTRA) $(LIBS)
|
||||||
|
|
||||||
|
$(BIN_DIR)/$(EPR): $(OBJ_DIR) $(BIN_DIR) $(EPR_OBJS)
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
$(CXX) -o $(BIN_DIR)/$(EPR) $(EPR_OBJS) $(LDFLAGS) $(LDFLAGS_EXTRA) $(LIBS)
|
||||||
|
|
||||||
|
$(BIN_DIR)/lib$(Z3).@SO_EXT@: $(OBJ_DIR) $(BIN_DIR) $(LIB_OBJS)
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
$(CXX) -o $(BIN_DIR)/lib$(Z3).@SO_EXT@ $(LIB_OBJS) $(LIBFLAGS) $(LIBS) @COMP_VERSIONS@
|
||||||
|
|
||||||
|
$(BIN_DIR)/lib$(Z3).a: $(OBJ_DIR) $(BIN_DIR) $(LIB_OBJS)
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
ar -cvr $(BIN_DIR)/lib$(Z3).a $(LIB_OBJS)
|
||||||
|
|
||||||
|
$(BIN_DIR)/$(GROBNER): $(OBJ_DIR) $(BIN_DIR) $(GROBNER_OBJS)
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
$(CXX) -o $(BIN_DIR)/$(GROBNER) $(GROBNER_OBJS) $(LDFLAGS) $(LDFLAGS_EXTRA) $(LIBS)
|
||||||
|
|
||||||
|
$(BIN_DIR):
|
||||||
|
mkdir -p $(BIN_DIR)
|
||||||
|
|
||||||
|
$(OBJ_DIR):
|
||||||
|
mkdir -p $(OBJ_DIR)
|
||||||
|
|
||||||
|
$(OBJ_TEST_DIR):
|
||||||
|
mkdir -p $(OBJ_TEST_DIR)
|
||||||
|
|
||||||
|
smtcomp07: $(BIN_DIR)/$(Z3)
|
||||||
|
rm -r -f z3
|
||||||
|
mkdir z3
|
||||||
|
cp $(BIN_DIR)/$(Z3) z3/run
|
||||||
|
strip z3/run
|
||||||
|
cp doc/MAGIC_NUMBER z3/
|
||||||
|
cp doc/README-SMTCOMP07 z3/README
|
||||||
|
cp doc/NOTICES-SMTCOMP07 z3/NOTICES
|
||||||
|
cp doc/z3.pdf z3/
|
||||||
|
tar -czf z3.tar.gz z3
|
||||||
|
|
||||||
|
test_capi: $(BIN_DIR)/$(TEST_CAPI)
|
||||||
|
|
||||||
|
epr: $(BIN_DIR)/$(EPR)
|
||||||
|
|
||||||
|
@SO_EXT@: $(BIN_DIR)/lib$(Z3).@SO_EXT@
|
||||||
|
|
||||||
|
a: $(BIN_DIR)/lib$(Z3).a
|
||||||
|
|
||||||
|
grobner: $(BIN_DIR)/$(GROBNER)
|
||||||
|
|
||||||
|
test: $(BIN_DIR)/$(TEST)
|
||||||
|
|
||||||
|
################################
|
||||||
|
#
|
||||||
|
# Grobner
|
||||||
|
#
|
||||||
|
################################
|
||||||
|
lib/grobner_main.cpp: test/igrobner.cpp
|
||||||
|
cp test/igrobner.cpp lib/grobner_main.cpp
|
||||||
|
chmod +rw lib/grobner_main.cpp
|
||||||
|
|
||||||
|
$(OBJ_DIR)/grobner_main.o: lib/grobner_main.cpp
|
||||||
|
@mkdir -p $(OBJ_DIR)
|
||||||
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -DGB_APP -c -o $@ $<
|
||||||
|
|
||||||
|
################################
|
||||||
|
#
|
||||||
|
# .cpp ===> .o
|
||||||
|
#
|
||||||
|
################################
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.o : lib/%.cpp
|
||||||
|
@mkdir -p $(OBJ_DIR)
|
||||||
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
$(OBJ_TEST_DIR)/%.o : test/%.cpp
|
||||||
|
@mkdir -p $(OBJ_TEST_DIR)
|
||||||
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.o : shell/%.cpp
|
||||||
|
@mkdir -p $(OBJ_DIR)
|
||||||
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.o : test_capi/%.c
|
||||||
|
@mkdir -p $(OBJ_DIR)
|
||||||
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -I ../lib -c -o $@ $<
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.o : epr/%.cpp
|
||||||
|
@mkdir -p $(OBJ_DIR)
|
||||||
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
################################
|
||||||
|
#
|
||||||
|
# Dependency files
|
||||||
|
#
|
||||||
|
# .cpp ===> .d
|
||||||
|
#
|
||||||
|
################################
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.d: lib/%.cpp
|
||||||
|
@echo Making dependency file \'$@\' ...
|
||||||
|
@mkdir -p $(OBJ_DIR)
|
||||||
|
@$(SHELL) -ec '$(CXX) -MM $(CPPFLAGS) $< | $(SED) '\''s/\($*\)\.o[ :]*/$(SED_OBJ_DIR)\/\1.o $(SED_OBJ_DIR)\/\1.d : /g'\'' > $@; [ -s $@ ] || rm -f $@'
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.d: shell/%.cpp
|
||||||
|
@echo Making dependency file \'$@\' ...
|
||||||
|
@mkdir -p $(OBJ_DIR)
|
||||||
|
@$(SHELL) -ec '$(CXX) -MM $(CPPFLAGS) $< | $(SED) '\''s/\($*\)\.o[ :]*/$(SED_OBJ_DIR)\/\1.o $(SED_OBJ_DIR)\/\1.d : /g'\'' > $@; [ -s $@ ] || rm -f $@'
|
||||||
|
|
||||||
|
$(OBJ_TEST_DIR)/%.d: test/%.cpp
|
||||||
|
@echo Making dependency file \'$@\' ...
|
||||||
|
@mkdir -p $(OBJ_TEST_DIR)
|
||||||
|
@$(SHELL) -ec '$(CXX) -MM $(CPPFLAGS) $< | $(SED) '\''s/\($*\)\.o[ :]*/$(SED_OBJ_TEST_DIR)\/\1.o $(SED_OBJ_TEST_DIR)\/\1.d : /g'\'' > $@; [ -s $@ ] || rm -f $@'
|
||||||
|
|
||||||
|
|
||||||
|
include $(LIB_SRCS:lib/%.cpp=$(OBJ_DIR)/%.d)
|
||||||
|
include $(SHELL_SRCS:shell/%.cpp=$(OBJ_DIR)/%.d)
|
||||||
|
include $(TEST_SRCS:test/%.cpp=$(OBJ_TEST_DIR)/%.d)
|
||||||
|
|
||||||
|
################################
|
||||||
|
#
|
||||||
|
# Cleanup
|
||||||
|
#
|
||||||
|
################################
|
||||||
|
.PHONY: clean
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BIN_DIR)/$(Z3)
|
||||||
|
rm -f $(OBJ_DIR)/*
|
||||||
|
rm -f lib.srcs
|
||||||
|
rm -f shell.srcs
|
||||||
|
find . -name '*.bb' -exec rm -f '{}' ';'
|
||||||
|
find . -name '*.bbg' -exec rm -f '{}' ';'
|
||||||
|
find . -name '*.da' -exec rm -f '{}' ';'
|
||||||
|
find . -name '*.gcov' -exec rm -f '{}' ';'
|
||||||
|
find . -name 'cachegrind*' -exec rm -f '{}' ';'
|
||||||
|
find . -name 'a.out' -exec rm -f '{}' ';'
|
||||||
|
find . -name 'a.exe' -exec rm -f '{}' ';'
|
||||||
|
find . -name 'core' -exec rm -f '{}' ';'
|
||||||
|
|
||||||
|
################################
|
||||||
|
#
|
||||||
|
# Release
|
||||||
|
#
|
||||||
|
# NOTE: In 64-bit systems it is not possible to build a dynamic library using static gmp.
|
||||||
|
# So, EXTRA_LIBS="" in 64-bit systems.
|
||||||
|
# EXTRA_LIBS="$(BIN_DIR)/lib$(Z3)-gmp.so" in 32-bit systems.
|
||||||
|
################################
|
||||||
|
release: $(BIN_DIR)/$(Z3) $(BIN_DIR)/lib$(Z3).@SO_EXT@ @EXTRA_LIBS@ $(BIN_DIR)/lib$(Z3).a
|
||||||
|
@rm -f -r z3
|
||||||
|
@mkdir -p z3
|
||||||
|
@mkdir -p z3/bin
|
||||||
|
@mkdir -p z3/lib
|
||||||
|
@mkdir -p z3/include
|
||||||
|
@mkdir -p z3/examples
|
||||||
|
@mkdir -p z3/ocaml
|
||||||
|
@mkdir -p z3/python
|
||||||
|
@mkdir -p z3/examples/c
|
||||||
|
@mkdir -p z3/examples/c++
|
||||||
|
@mkdir -p z3/examples/python
|
||||||
|
@mkdir -p z3/examples/maxsat
|
||||||
|
@mkdir -p z3/examples/theory
|
||||||
|
@mkdir -p z3/examples/ocaml
|
||||||
|
@cp lib/z3.h z3/include
|
||||||
|
@cp lib/z3_v1.h z3/include
|
||||||
|
@cp lib/z3_api.h z3/include
|
||||||
|
@cp lib/z3_macros.h z3/include
|
||||||
|
@cp ml/z3_stubs.c z3/ocaml
|
||||||
|
@cp ml/z3_theory_stubs.c z3/ocaml
|
||||||
|
@cp ml/z3.mli z3/ocaml
|
||||||
|
@cp ml/z3.ml z3/ocaml
|
||||||
|
@cp ml_release/build-lib.sh z3/ocaml
|
||||||
|
@$(DOS2UNIX) z3/ocaml/build-lib.sh
|
||||||
|
@chmod +rwx z3/ocaml/build-lib.sh
|
||||||
|
@cp ml_release/README_$(PLATFORM) z3/ocaml/README
|
||||||
|
@$(DOS2UNIX) z3/ocaml/README
|
||||||
|
@cp ml_release/build-test.sh z3/examples/ocaml
|
||||||
|
@$(DOS2UNIX) z3/examples/ocaml/build-test.sh
|
||||||
|
@chmod +rwx z3/examples/ocaml/build-test.sh
|
||||||
|
@cp ml_release/README_test_$(PLATFORM) z3/examples/ocaml/README
|
||||||
|
@$(DOS2UNIX) z3/examples/ocaml/README
|
||||||
|
@$(DOS2UNIX) z3/include/*
|
||||||
|
@cp $(BIN_DIR)/$(Z3) z3/bin
|
||||||
|
@cp $(BIN_DIR)/lib$(Z3).@SO_EXT@ z3/lib
|
||||||
|
@cp $(BIN_DIR)/lib$(Z3).a z3/lib
|
||||||
|
@cp test_capi/test_capi.c z3/examples/c
|
||||||
|
@$(DOS2UNIX) z3/examples/c/test_capi.c
|
||||||
|
@cp test_capi/README-$(PLATFORM).txt z3/examples/c/README
|
||||||
|
@$(DOS2UNIX) z3/examples/c/README
|
||||||
|
@cp test_capi/build-external-$(PLATFORM).sh z3/examples/c/build.sh
|
||||||
|
@cp test_capi/build-static-$(PLATFORM).sh z3/examples/c/build-static.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/c/build.sh
|
||||||
|
@chmod +rwx z3/examples/c/build.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/c/build-static.sh
|
||||||
|
@chmod +rwx z3/examples/c/build-static.sh
|
||||||
|
@cp test_capi/exec-external-$(PLATFORM).sh z3/examples/c/exec.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/c/exec.sh
|
||||||
|
@chmod +rwx z3/examples/c/exec.sh
|
||||||
|
@cp maxsat/maxsat.c z3/examples/maxsat
|
||||||
|
@$(DOS2UNIX) z3/examples/maxsat/maxsat.c
|
||||||
|
@cp maxsat/README-$(PLATFORM).txt z3/examples/maxsat/README
|
||||||
|
@$(DOS2UNIX) z3/examples/maxsat/README
|
||||||
|
@cp maxsat/build-external-$(PLATFORM).sh z3/examples/maxsat/build.sh
|
||||||
|
@cp maxsat/build-static-$(PLATFORM).sh z3/examples/maxsat/build-static.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/maxsat/build.sh
|
||||||
|
@chmod +rwx z3/examples/maxsat/build.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/maxsat/build-static.sh
|
||||||
|
@chmod +rwx z3/examples/maxsat/build-static.sh
|
||||||
|
@cp maxsat/exec-external-$(PLATFORM).sh z3/examples/maxsat/exec.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/maxsat/exec.sh
|
||||||
|
@chmod +rwx z3/examples/maxsat/exec.sh
|
||||||
|
@cp test_user_theory/test_user_theory.c z3/examples/theory
|
||||||
|
@$(DOS2UNIX) z3/examples/theory/test_user_theory.c
|
||||||
|
@cp test_user_theory/README-$(PLATFORM).txt z3/examples/theory/README
|
||||||
|
@$(DOS2UNIX) z3/examples/theory/README
|
||||||
|
@cp test_user_theory/build-external-$(PLATFORM).sh z3/examples/theory/build.sh
|
||||||
|
@cp test_user_theory/build-static-$(PLATFORM).sh z3/examples/theory/build-static.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/theory/build.sh
|
||||||
|
@chmod +rwx z3/examples/theory/build.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/theory/build-static.sh
|
||||||
|
@chmod +rwx z3/examples/theory/build-static.sh
|
||||||
|
@cp test_user_theory/exec-external-$(PLATFORM).sh z3/examples/theory/exec.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/theory/exec.sh
|
||||||
|
@chmod +rwx z3/examples/theory/exec.sh
|
||||||
|
@cp ml_release/exec-$(PLATFORM).sh z3/examples/ocaml/exec.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/ocaml/exec.sh
|
||||||
|
@chmod +rwx z3/examples/ocaml/exec.sh
|
||||||
|
@cp ml/test_mlapi.ml z3/examples/ocaml
|
||||||
|
@$(DOS2UNIX) z3/examples/ocaml/test_mlapi.ml
|
||||||
|
@cp c++/z3++.h z3/include
|
||||||
|
@cp c++/example.cpp z3/examples/c++
|
||||||
|
@cp c++/build-external-$(PLATFORM).sh z3/examples/c++/build.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/c++/build.sh
|
||||||
|
@chmod +rwx z3/examples/c++/build.sh
|
||||||
|
@cp c++/exec-external-$(PLATFORM).sh z3/examples/c++/exec.sh
|
||||||
|
@$(DOS2UNIX) z3/examples/c++/exec.sh
|
||||||
|
@chmod +rwx z3/examples/c++/exec.sh
|
||||||
|
@cp python/z3.py z3/python
|
||||||
|
@cp python/z3core.py z3/python
|
||||||
|
@cp python/z3types.py z3/python
|
||||||
|
@cp python/z3consts.py z3/python
|
||||||
|
@cp python/z3tactics.py z3/python
|
||||||
|
@cp python/z3printer.py z3/python
|
||||||
|
@cp python/README-$(PLATFORM).txt z3/examples/python/README
|
||||||
|
@cp python/exec-$(PLATFORM).sh z3/examples/python/exec.sh
|
||||||
|
@cp python/example.py z3/examples/python
|
||||||
|
@$(DOS2UNIX) z3/python/*.py
|
||||||
|
@$(DOS2UNIX) z3/examples/python/*.py
|
||||||
|
@$(DOS2UNIX) z3/examples/python/*.sh
|
||||||
|
@chmod +rwx z3/examples/python/*.sh
|
||||||
|
@$(DOS2UNIX) iZ3/pack-iz3-$(PLATFORM).sh
|
||||||
|
@chmod +rwx iZ3/pack-iz3-$(PLATFORM).sh
|
||||||
|
@iZ3/pack-iz3-$(PLATFORM).sh
|
||||||
|
@tar -cvzf z3.tar.gz z3
|
||||||
|
|
||||||
|
################################
|
||||||
|
#
|
||||||
|
# Support
|
||||||
|
#
|
||||||
|
################################
|
||||||
|
|
||||||
|
Makefile: Makefile.in config.status
|
||||||
|
./config.status
|
||||||
|
make
|
||||||
|
|
||||||
|
config.status: configure
|
||||||
|
./config.status --recheck
|
||||||
|
|
||||||
|
################################
|
||||||
|
#
|
||||||
|
# checkgmake
|
||||||
|
#
|
||||||
|
################################
|
||||||
|
.PHONY: checkgmake
|
||||||
|
|
||||||
|
checkgmake:
|
||||||
|
@ ./gmaketest --make=$(MAKE) || \
|
||||||
|
(echo "Z3 needs GNU-Make to be built"; exit 1)
|
||||||
|
|
260
Microsoft.Z3/AST.cs
Normal file
260
Microsoft.Z3/AST.cs
Normal file
|
@ -0,0 +1,260 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
AST.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: ASTs
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-16
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The abstract syntax tree (AST) class.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class AST : Z3Object, IComparable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Comparison operator.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="a">An AST</param>
|
||||||
|
/// <param name="b">An AST</param>
|
||||||
|
/// <returns>True if <paramref name="a"/> and <paramref name="b"/> are from the same context
|
||||||
|
/// and represent the same sort; false otherwise.</returns>
|
||||||
|
public static bool operator ==(AST a, AST b)
|
||||||
|
{
|
||||||
|
return Object.ReferenceEquals(a, b) ||
|
||||||
|
(!Object.ReferenceEquals(a, null) &&
|
||||||
|
!Object.ReferenceEquals(b, null) &&
|
||||||
|
a.Context.nCtx == b.Context.nCtx &&
|
||||||
|
Native.Z3_is_eq_ast(a.Context.nCtx, a.NativeObject, b.NativeObject) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Comparison operator.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="a">An AST</param>
|
||||||
|
/// <param name="b">An AST</param>
|
||||||
|
/// <returns>True if <paramref name="a"/> and <paramref name="b"/> are not from the same context
|
||||||
|
/// or represent different sorts; false otherwise.</returns>
|
||||||
|
public static bool operator !=(AST a, AST b)
|
||||||
|
{
|
||||||
|
return !(a == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Object comparison.
|
||||||
|
/// </summary>
|
||||||
|
public override bool Equals(object o)
|
||||||
|
{
|
||||||
|
AST casted = o as AST;
|
||||||
|
if (casted == null) return false;
|
||||||
|
return this == casted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Object Comparison.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">Another AST</param>
|
||||||
|
/// <returns>Negative if the object should be sorted before <paramref name="other"/>, positive if after else zero.</returns>
|
||||||
|
public virtual int CompareTo(object other)
|
||||||
|
{
|
||||||
|
if (other == null) return 1;
|
||||||
|
AST oAST = other as AST;
|
||||||
|
if (oAST == null)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Id < oAST.Id)
|
||||||
|
return -1;
|
||||||
|
else if (Id > oAST.Id)
|
||||||
|
return +1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The AST's hash code.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A hash code</returns>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return (int)Native.Z3_get_ast_hash(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A unique identifier for the AST (unique among all ASTs).
|
||||||
|
/// </summary>
|
||||||
|
public uint Id
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_ast_id(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Translates (copies) the AST to the Context <paramref name="ctx"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ctx">A context</param>
|
||||||
|
/// <returns>A copy of the AST which is associated with <paramref name="ctx"/></returns>
|
||||||
|
public AST Translate(Context ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Ensures(Contract.Result<AST>() != null);
|
||||||
|
|
||||||
|
if (ReferenceEquals(Context, ctx))
|
||||||
|
return this;
|
||||||
|
else
|
||||||
|
return new AST(ctx, Native.Z3_translate(Context.nCtx, NativeObject, ctx.nCtx));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The kind of the AST.
|
||||||
|
/// </summary>
|
||||||
|
public Z3_ast_kind ASTKind
|
||||||
|
{
|
||||||
|
get { return (Z3_ast_kind)Native.Z3_get_ast_kind(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the AST is an Expr
|
||||||
|
/// </summary>
|
||||||
|
public bool IsExpr
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
switch (ASTKind)
|
||||||
|
{
|
||||||
|
case Z3_ast_kind.Z3_APP_AST:
|
||||||
|
case Z3_ast_kind.Z3_NUMERAL_AST:
|
||||||
|
case Z3_ast_kind.Z3_QUANTIFIER_AST:
|
||||||
|
case Z3_ast_kind.Z3_VAR_AST: return true;
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the AST is a BoundVariable
|
||||||
|
/// </summary>
|
||||||
|
public bool IsVar
|
||||||
|
{
|
||||||
|
get { return this.ASTKind == Z3_ast_kind.Z3_VAR_AST; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the AST is a Quantifier
|
||||||
|
/// </summary>
|
||||||
|
public bool IsQuantifier
|
||||||
|
{
|
||||||
|
get { return this.ASTKind == Z3_ast_kind.Z3_QUANTIFIER_AST; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the AST is a Sort
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSort
|
||||||
|
{
|
||||||
|
get { return this.ASTKind == Z3_ast_kind.Z3_SORT_AST; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the AST is a FunctionDeclaration
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFuncDecl
|
||||||
|
{
|
||||||
|
get { return this.ASTKind == Z3_ast_kind.Z3_FUNC_DECL_AST; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the AST.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_ast_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the AST in s-expression notation.
|
||||||
|
/// </summary>
|
||||||
|
public string SExpr()
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<string>() != null);
|
||||||
|
|
||||||
|
return Native.Z3_ast_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal AST(Context ctx) : base(ctx) { Contract.Requires(ctx != null); }
|
||||||
|
internal AST(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
// Console.WriteLine("AST IncRef()");
|
||||||
|
if (Context == null)
|
||||||
|
throw new Z3Exception("inc() called on null context");
|
||||||
|
if (o == IntPtr.Zero)
|
||||||
|
throw new Z3Exception("inc() called on null AST");
|
||||||
|
Context.AST_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
// Console.WriteLine("AST DecRef()");
|
||||||
|
if (Context == null)
|
||||||
|
throw new Z3Exception("dec() called on null context");
|
||||||
|
if (o == IntPtr.Zero)
|
||||||
|
throw new Z3Exception("dec() called on null AST");
|
||||||
|
Context.AST_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static AST Create(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Ensures(Contract.Result<AST>() != null);
|
||||||
|
|
||||||
|
switch ((Z3_ast_kind)Native.Z3_get_ast_kind(ctx.nCtx, obj))
|
||||||
|
{
|
||||||
|
case Z3_ast_kind.Z3_FUNC_DECL_AST: return new FuncDecl(ctx, obj);
|
||||||
|
case Z3_ast_kind.Z3_QUANTIFIER_AST: return new Quantifier(ctx, obj);
|
||||||
|
case Z3_ast_kind.Z3_SORT_AST: return Sort.Create(ctx, obj);
|
||||||
|
case Z3_ast_kind.Z3_APP_AST:
|
||||||
|
case Z3_ast_kind.Z3_NUMERAL_AST:
|
||||||
|
case Z3_ast_kind.Z3_VAR_AST: return Expr.Create(ctx, obj);
|
||||||
|
default:
|
||||||
|
throw new Z3Exception("Unknown AST kind");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
155
Microsoft.Z3/ASTMap.cs
Normal file
155
Microsoft.Z3/ASTMap.cs
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
ASTMap.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: AST Maps
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-21
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Map from AST to AST
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
internal class ASTMap : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Checks whether the map contains the key <paramref name="k"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="k">An AST</param>
|
||||||
|
/// <returns>True if <paramref name="k"/> is a key in the map, false otherwise.</returns>
|
||||||
|
public bool Contains(AST k)
|
||||||
|
{
|
||||||
|
Contract.Requires(k != null);
|
||||||
|
|
||||||
|
return Native.Z3_ast_map_contains(Context.nCtx, NativeObject, k.NativeObject) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the value associated with the key <paramref name="k"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This function signs an error when <paramref name="k"/> is not a key in the map.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="k">An AST</param>
|
||||||
|
public AST Find(AST k)
|
||||||
|
{
|
||||||
|
Contract.Requires(k != null);
|
||||||
|
Contract.Ensures(Contract.Result<AST>() != null);
|
||||||
|
|
||||||
|
return new AST(Context, Native.Z3_ast_map_find(Context.nCtx, NativeObject, k.NativeObject));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stores or replaces a new key/value pair in the map.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="k">The key AST</param>
|
||||||
|
/// <param name="v">The value AST</param>
|
||||||
|
public void Insert(AST k, AST v)
|
||||||
|
{
|
||||||
|
Contract.Requires(k != null);
|
||||||
|
Contract.Requires(v != null);
|
||||||
|
|
||||||
|
Native.Z3_ast_map_insert(Context.nCtx, NativeObject, k.NativeObject, v.NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Erases the key <paramref name="k"/> from the map.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="k">An AST</param>
|
||||||
|
public void Erase(AST k)
|
||||||
|
{
|
||||||
|
Contract.Requires(k != null);
|
||||||
|
|
||||||
|
Native.Z3_ast_map_erase(Context.nCtx, NativeObject, k.NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes all keys from the map.
|
||||||
|
/// </summary>
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
Native.Z3_ast_map_reset(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The size of the map
|
||||||
|
/// </summary>
|
||||||
|
public uint Size
|
||||||
|
{
|
||||||
|
get { return Native.Z3_ast_map_size(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The keys stored in the map.
|
||||||
|
/// </summary>
|
||||||
|
public ASTVector Keys
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new ASTVector(Context, Native.Z3_ast_map_keys(Context.nCtx, NativeObject));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a string representation of the map.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_ast_map_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal ASTMap(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
internal ASTMap(Context ctx)
|
||||||
|
: base(ctx, Native.Z3_mk_ast_map(ctx.nCtx))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_ast_map_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_ast_map_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.ASTMap_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.ASTMap_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
132
Microsoft.Z3/ASTVector.cs
Normal file
132
Microsoft.Z3/ASTVector.cs
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
ASTVector.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: AST Vectors
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-21
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Vectors of ASTs.
|
||||||
|
/// </summary>
|
||||||
|
internal class ASTVector : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The size of the vector
|
||||||
|
/// </summary>
|
||||||
|
public uint Size
|
||||||
|
{
|
||||||
|
get { return Native.Z3_ast_vector_size(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the i-th object in the vector.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>May throw an IndexOutOfBoundsException when <paramref name="i"/> is out of range.</remarks>
|
||||||
|
/// <param name="i">Index</param>
|
||||||
|
/// <returns>An AST</returns>
|
||||||
|
public AST this[uint i]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<AST>() != null);
|
||||||
|
|
||||||
|
return new AST(Context, Native.Z3_ast_vector_get(Context.nCtx, NativeObject, i));
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Contract.Requires(value!= null);
|
||||||
|
|
||||||
|
Native.Z3_ast_vector_set(Context.nCtx, NativeObject, i, value.NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resize the vector to <paramref name="newSize"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newSize">The new size of the vector.</param>
|
||||||
|
public void Resize(uint newSize)
|
||||||
|
{
|
||||||
|
Native.Z3_ast_vector_resize(Context.nCtx, NativeObject, newSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add the AST <paramref name="a"/> to the back of the vector. The size
|
||||||
|
/// is increased by 1.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="a">An AST</param>
|
||||||
|
public void Push(AST a)
|
||||||
|
{
|
||||||
|
Contract.Requires(a != null);
|
||||||
|
|
||||||
|
Native.Z3_ast_vector_push(Context.nCtx, NativeObject, a.NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Translates all ASTs in the vector to <paramref name="ctx"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ctx">A context</param>
|
||||||
|
/// <returns>A new ASTVector</returns>
|
||||||
|
public ASTVector Translate(Context ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Ensures(Contract.Result<ASTVector>() != null);
|
||||||
|
|
||||||
|
return new ASTVector(Context, Native.Z3_ast_vector_translate(Context.nCtx, NativeObject, ctx.nCtx));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a string representation of the vector.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_ast_vector_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal ASTVector(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
internal ASTVector(Context ctx) : base(ctx, Native.Z3_mk_ast_vector(ctx.nCtx)) { Contract.Requires(ctx != null); }
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_ast_vector_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_ast_vector_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.ASTVector_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.ASTVector_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
111
Microsoft.Z3/ApplyResult.cs
Normal file
111
Microsoft.Z3/ApplyResult.cs
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
ApplyResult.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Result object for tactic applications
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-21
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ApplyResult objects represent the result of an application of a
|
||||||
|
/// tactic to a goal. It contains the subgoals that were produced.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class ApplyResult : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The number of Subgoals.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumSubgoals
|
||||||
|
{
|
||||||
|
get { return Native.Z3_apply_result_get_num_subgoals(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the subgoals from the ApplyResult.
|
||||||
|
/// </summary>
|
||||||
|
public Goal[] Subgoals
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Goal[]>() != null);
|
||||||
|
Contract.Ensures(Contract.Result<Goal[]>().Length == this.NumSubgoals);
|
||||||
|
|
||||||
|
uint n = NumSubgoals;
|
||||||
|
Goal[] res = new Goal[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = new Goal(Context, Native.Z3_apply_result_get_subgoal(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Convert a model for the subgoal <paramref name="i"/> into a model for the original
|
||||||
|
/// goal <c>g</c>, that the ApplyResult was obtained from.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A model for <c>g</c></returns>
|
||||||
|
public Model ConvertModel(uint i, Model m)
|
||||||
|
{
|
||||||
|
Contract.Requires(m != null);
|
||||||
|
Contract.Ensures(Contract.Result<Model>() != null);
|
||||||
|
|
||||||
|
return new Model(Context, Native.Z3_apply_result_convert_model(Context.nCtx, NativeObject, i, m.NativeObject));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the ApplyResult.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_apply_result_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal ApplyResult(Context ctx, IntPtr obj) : base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_apply_result_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_apply_result_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.ApplyResult_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.ApplyResult_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
170
Microsoft.Z3/Constructor.cs
Normal file
170
Microsoft.Z3/Constructor.cs
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Constructor.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Constructors
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-22
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Constructors are used for datatype sorts.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Constructor : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The number of fields of the constructor.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumFields
|
||||||
|
{
|
||||||
|
get { init(); return n; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The function declaration of the constructor.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl ConstructorDecl
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl>() != null);
|
||||||
|
init(); return m_constructorDecl; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The function declaration of the tester.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl TesterDecl
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl>() != null);
|
||||||
|
init(); return m_testerDecl; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The function declarations of the accessors
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl[] AccessorDecls
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl[]>() != null);
|
||||||
|
init(); return m_accessorDecls; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Destructor.
|
||||||
|
/// </summary>
|
||||||
|
~Constructor()
|
||||||
|
{
|
||||||
|
Native.Z3_del_constructor(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Object invariant
|
||||||
|
|
||||||
|
[ContractInvariantMethod]
|
||||||
|
private void ObjectInvariant()
|
||||||
|
{
|
||||||
|
Contract.Invariant(m_testerDecl == null || m_constructorDecl != null);
|
||||||
|
Contract.Invariant(m_testerDecl == null || m_accessorDecls != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
readonly private uint n = 0;
|
||||||
|
private FuncDecl m_testerDecl = null;
|
||||||
|
private FuncDecl m_constructorDecl = null;
|
||||||
|
private FuncDecl[] m_accessorDecls = null;
|
||||||
|
|
||||||
|
internal Constructor(Context ctx, Symbol name, Symbol recognizer, Symbol[] fieldNames,
|
||||||
|
Sort[] sorts, uint[] sortRefs)
|
||||||
|
: base(ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
Contract.Requires(recognizer != null);
|
||||||
|
|
||||||
|
n = AST.ArrayLength(fieldNames);
|
||||||
|
|
||||||
|
if (n != AST.ArrayLength(sorts))
|
||||||
|
throw new Z3Exception("Number of field names does not match number of sorts");
|
||||||
|
if (sortRefs != null && sortRefs.Length != n)
|
||||||
|
throw new Z3Exception("Number of field names does not match number of sort refs");
|
||||||
|
|
||||||
|
if (sortRefs == null) sortRefs = new uint[n];
|
||||||
|
|
||||||
|
NativeObject = Native.Z3_mk_constructor(ctx.nCtx, name.NativeObject, recognizer.NativeObject,
|
||||||
|
n,
|
||||||
|
Symbol.ArrayToNative(fieldNames),
|
||||||
|
Sort.ArrayToNative(sorts),
|
||||||
|
sortRefs);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init()
|
||||||
|
{
|
||||||
|
Contract.Ensures(m_constructorDecl != null);
|
||||||
|
Contract.Ensures(m_testerDecl != null);
|
||||||
|
Contract.Ensures(m_accessorDecls != null);
|
||||||
|
|
||||||
|
if (m_testerDecl != null) return;
|
||||||
|
IntPtr constructor = IntPtr.Zero;
|
||||||
|
IntPtr tester = IntPtr.Zero;
|
||||||
|
IntPtr[] accessors = new IntPtr[n];
|
||||||
|
Native.Z3_query_constructor(Context.nCtx, NativeObject, n, ref constructor, ref tester, accessors);
|
||||||
|
m_constructorDecl = new FuncDecl(Context, constructor);
|
||||||
|
m_testerDecl = new FuncDecl(Context, tester);
|
||||||
|
m_accessorDecls = new FuncDecl[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
m_accessorDecls[i] = new FuncDecl(Context, accessors[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lists of constructors
|
||||||
|
/// </summary>
|
||||||
|
public class ConstructorList : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Destructor.
|
||||||
|
/// </summary>
|
||||||
|
~ConstructorList()
|
||||||
|
{
|
||||||
|
Native.Z3_del_constructor_list(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal ConstructorList(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal ConstructorList(Context ctx, Constructor[] constructors)
|
||||||
|
: base(ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(constructors != null);
|
||||||
|
|
||||||
|
NativeObject = Native.Z3_mk_constructor_list(Context.nCtx, (uint)constructors.Length, Constructor.ArrayToNative(constructors));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
3694
Microsoft.Z3/Context.cs
Normal file
3694
Microsoft.Z3/Context.cs
Normal file
File diff suppressed because it is too large
Load diff
92
Microsoft.Z3/DecRefQUeue.cs
Normal file
92
Microsoft.Z3/DecRefQUeue.cs
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
DecRefQueue.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: DecRef Queues
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-16
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
[ContractClass(typeof(DecRefQueueContracts))]
|
||||||
|
internal abstract class DecRefQueue
|
||||||
|
{
|
||||||
|
#region Object invariant
|
||||||
|
|
||||||
|
[ContractInvariantMethod]
|
||||||
|
private void ObjectInvariant()
|
||||||
|
{
|
||||||
|
Contract.Invariant(this.m_queue != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
readonly internal protected Object m_lock = new Object();
|
||||||
|
readonly internal protected List<IntPtr> m_queue = new List<IntPtr>();
|
||||||
|
internal const uint m_move_limit = 1024;
|
||||||
|
|
||||||
|
public abstract void IncRef(Context ctx, IntPtr obj);
|
||||||
|
public abstract void DecRef(Context ctx, IntPtr obj);
|
||||||
|
|
||||||
|
public void IncAndClear(Context ctx, IntPtr o)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
|
||||||
|
IncRef(ctx, o);
|
||||||
|
if (m_queue.Count >= m_move_limit) Clear(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Add(IntPtr o)
|
||||||
|
{
|
||||||
|
if (o == IntPtr.Zero) return;
|
||||||
|
|
||||||
|
lock (m_lock)
|
||||||
|
{
|
||||||
|
m_queue.Add(o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear(Context ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
|
||||||
|
lock (m_lock)
|
||||||
|
{
|
||||||
|
foreach (IntPtr o in m_queue)
|
||||||
|
DecRef(ctx, o);
|
||||||
|
m_queue.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ContractClassFor(typeof(DecRefQueue))]
|
||||||
|
abstract class DecRefQueueContracts : DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
257
Microsoft.Z3/Enumerations.cs
Normal file
257
Microsoft.Z3/Enumerations.cs
Normal file
|
@ -0,0 +1,257 @@
|
||||||
|
// Automatically generated file, generator: mk_z3consts.py
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
#pragma warning disable 1591
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>Z3_lbool</summary>
|
||||||
|
public enum Z3_lbool {
|
||||||
|
Z3_L_TRUE = 1,
|
||||||
|
Z3_L_UNDEF = 0,
|
||||||
|
Z3_L_FALSE = -1,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Z3_symbol_kind</summary>
|
||||||
|
public enum Z3_symbol_kind {
|
||||||
|
Z3_INT_SYMBOL = 0,
|
||||||
|
Z3_STRING_SYMBOL = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Z3_parameter_kind</summary>
|
||||||
|
public enum Z3_parameter_kind {
|
||||||
|
Z3_PARAMETER_FUNC_DECL = 6,
|
||||||
|
Z3_PARAMETER_DOUBLE = 1,
|
||||||
|
Z3_PARAMETER_SYMBOL = 3,
|
||||||
|
Z3_PARAMETER_INT = 0,
|
||||||
|
Z3_PARAMETER_AST = 5,
|
||||||
|
Z3_PARAMETER_SORT = 4,
|
||||||
|
Z3_PARAMETER_RATIONAL = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Z3_sort_kind</summary>
|
||||||
|
public enum Z3_sort_kind {
|
||||||
|
Z3_BV_SORT = 4,
|
||||||
|
Z3_FINITE_DOMAIN_SORT = 8,
|
||||||
|
Z3_ARRAY_SORT = 5,
|
||||||
|
Z3_UNKNOWN_SORT = 1000,
|
||||||
|
Z3_RELATION_SORT = 7,
|
||||||
|
Z3_REAL_SORT = 3,
|
||||||
|
Z3_INT_SORT = 2,
|
||||||
|
Z3_UNINTERPRETED_SORT = 0,
|
||||||
|
Z3_BOOL_SORT = 1,
|
||||||
|
Z3_DATATYPE_SORT = 6,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Z3_ast_kind</summary>
|
||||||
|
public enum Z3_ast_kind {
|
||||||
|
Z3_VAR_AST = 2,
|
||||||
|
Z3_SORT_AST = 4,
|
||||||
|
Z3_QUANTIFIER_AST = 3,
|
||||||
|
Z3_UNKNOWN_AST = 1000,
|
||||||
|
Z3_FUNC_DECL_AST = 5,
|
||||||
|
Z3_NUMERAL_AST = 0,
|
||||||
|
Z3_APP_AST = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Z3_decl_kind</summary>
|
||||||
|
public enum Z3_decl_kind {
|
||||||
|
Z3_OP_LABEL = 1792,
|
||||||
|
Z3_OP_PR_REWRITE = 1294,
|
||||||
|
Z3_OP_UNINTERPRETED = 2051,
|
||||||
|
Z3_OP_SUB = 519,
|
||||||
|
Z3_OP_ZERO_EXT = 1058,
|
||||||
|
Z3_OP_ADD = 518,
|
||||||
|
Z3_OP_IS_INT = 528,
|
||||||
|
Z3_OP_BREDOR = 1061,
|
||||||
|
Z3_OP_BNOT = 1051,
|
||||||
|
Z3_OP_BNOR = 1054,
|
||||||
|
Z3_OP_PR_CNF_STAR = 1315,
|
||||||
|
Z3_OP_RA_JOIN = 1539,
|
||||||
|
Z3_OP_LE = 514,
|
||||||
|
Z3_OP_SET_UNION = 773,
|
||||||
|
Z3_OP_PR_UNDEF = 1280,
|
||||||
|
Z3_OP_BREDAND = 1062,
|
||||||
|
Z3_OP_LT = 516,
|
||||||
|
Z3_OP_RA_UNION = 1540,
|
||||||
|
Z3_OP_BADD = 1028,
|
||||||
|
Z3_OP_BUREM0 = 1039,
|
||||||
|
Z3_OP_OEQ = 267,
|
||||||
|
Z3_OP_PR_MODUS_PONENS = 1284,
|
||||||
|
Z3_OP_RA_CLONE = 1548,
|
||||||
|
Z3_OP_REPEAT = 1060,
|
||||||
|
Z3_OP_RA_NEGATION_FILTER = 1544,
|
||||||
|
Z3_OP_BSMOD0 = 1040,
|
||||||
|
Z3_OP_BLSHR = 1065,
|
||||||
|
Z3_OP_BASHR = 1066,
|
||||||
|
Z3_OP_PR_UNIT_RESOLUTION = 1304,
|
||||||
|
Z3_OP_ROTATE_RIGHT = 1068,
|
||||||
|
Z3_OP_ARRAY_DEFAULT = 772,
|
||||||
|
Z3_OP_PR_PULL_QUANT = 1296,
|
||||||
|
Z3_OP_PR_APPLY_DEF = 1310,
|
||||||
|
Z3_OP_PR_REWRITE_STAR = 1295,
|
||||||
|
Z3_OP_IDIV = 523,
|
||||||
|
Z3_OP_PR_GOAL = 1283,
|
||||||
|
Z3_OP_PR_IFF_TRUE = 1305,
|
||||||
|
Z3_OP_LABEL_LIT = 1793,
|
||||||
|
Z3_OP_BOR = 1050,
|
||||||
|
Z3_OP_PR_SYMMETRY = 1286,
|
||||||
|
Z3_OP_TRUE = 256,
|
||||||
|
Z3_OP_SET_COMPLEMENT = 776,
|
||||||
|
Z3_OP_CONCAT = 1056,
|
||||||
|
Z3_OP_PR_NOT_OR_ELIM = 1293,
|
||||||
|
Z3_OP_IFF = 263,
|
||||||
|
Z3_OP_BSHL = 1064,
|
||||||
|
Z3_OP_PR_TRANSITIVITY = 1287,
|
||||||
|
Z3_OP_SGT = 1048,
|
||||||
|
Z3_OP_RA_WIDEN = 1541,
|
||||||
|
Z3_OP_PR_DEF_INTRO = 1309,
|
||||||
|
Z3_OP_NOT = 265,
|
||||||
|
Z3_OP_PR_QUANT_INTRO = 1290,
|
||||||
|
Z3_OP_UGT = 1047,
|
||||||
|
Z3_OP_DT_RECOGNISER = 2049,
|
||||||
|
Z3_OP_SET_INTERSECT = 774,
|
||||||
|
Z3_OP_BSREM = 1033,
|
||||||
|
Z3_OP_RA_STORE = 1536,
|
||||||
|
Z3_OP_SLT = 1046,
|
||||||
|
Z3_OP_ROTATE_LEFT = 1067,
|
||||||
|
Z3_OP_PR_NNF_NEG = 1313,
|
||||||
|
Z3_OP_PR_REFLEXIVITY = 1285,
|
||||||
|
Z3_OP_ULEQ = 1041,
|
||||||
|
Z3_OP_BIT1 = 1025,
|
||||||
|
Z3_OP_BIT0 = 1026,
|
||||||
|
Z3_OP_EQ = 258,
|
||||||
|
Z3_OP_BMUL = 1030,
|
||||||
|
Z3_OP_ARRAY_MAP = 771,
|
||||||
|
Z3_OP_STORE = 768,
|
||||||
|
Z3_OP_PR_HYPOTHESIS = 1302,
|
||||||
|
Z3_OP_RA_RENAME = 1545,
|
||||||
|
Z3_OP_AND = 261,
|
||||||
|
Z3_OP_TO_REAL = 526,
|
||||||
|
Z3_OP_PR_NNF_POS = 1312,
|
||||||
|
Z3_OP_PR_AND_ELIM = 1292,
|
||||||
|
Z3_OP_MOD = 525,
|
||||||
|
Z3_OP_BUDIV0 = 1037,
|
||||||
|
Z3_OP_PR_TRUE = 1281,
|
||||||
|
Z3_OP_BNAND = 1053,
|
||||||
|
Z3_OP_PR_ELIM_UNUSED_VARS = 1299,
|
||||||
|
Z3_OP_RA_FILTER = 1543,
|
||||||
|
Z3_OP_FD_LT = 1549,
|
||||||
|
Z3_OP_RA_EMPTY = 1537,
|
||||||
|
Z3_OP_DIV = 522,
|
||||||
|
Z3_OP_ANUM = 512,
|
||||||
|
Z3_OP_MUL = 521,
|
||||||
|
Z3_OP_UGEQ = 1043,
|
||||||
|
Z3_OP_BSREM0 = 1038,
|
||||||
|
Z3_OP_PR_TH_LEMMA = 1318,
|
||||||
|
Z3_OP_BXOR = 1052,
|
||||||
|
Z3_OP_DISTINCT = 259,
|
||||||
|
Z3_OP_PR_IFF_FALSE = 1306,
|
||||||
|
Z3_OP_BV2INT = 1072,
|
||||||
|
Z3_OP_EXT_ROTATE_LEFT = 1069,
|
||||||
|
Z3_OP_PR_PULL_QUANT_STAR = 1297,
|
||||||
|
Z3_OP_BSUB = 1029,
|
||||||
|
Z3_OP_PR_ASSERTED = 1282,
|
||||||
|
Z3_OP_BXNOR = 1055,
|
||||||
|
Z3_OP_EXTRACT = 1059,
|
||||||
|
Z3_OP_PR_DER = 1300,
|
||||||
|
Z3_OP_DT_CONSTRUCTOR = 2048,
|
||||||
|
Z3_OP_GT = 517,
|
||||||
|
Z3_OP_BUREM = 1034,
|
||||||
|
Z3_OP_IMPLIES = 266,
|
||||||
|
Z3_OP_SLEQ = 1042,
|
||||||
|
Z3_OP_GE = 515,
|
||||||
|
Z3_OP_BAND = 1049,
|
||||||
|
Z3_OP_ITE = 260,
|
||||||
|
Z3_OP_AS_ARRAY = 778,
|
||||||
|
Z3_OP_RA_SELECT = 1547,
|
||||||
|
Z3_OP_CONST_ARRAY = 770,
|
||||||
|
Z3_OP_BSDIV = 1031,
|
||||||
|
Z3_OP_OR = 262,
|
||||||
|
Z3_OP_AGNUM = 513,
|
||||||
|
Z3_OP_PR_PUSH_QUANT = 1298,
|
||||||
|
Z3_OP_BSMOD = 1035,
|
||||||
|
Z3_OP_PR_IFF_OEQ = 1311,
|
||||||
|
Z3_OP_PR_LEMMA = 1303,
|
||||||
|
Z3_OP_SET_SUBSET = 777,
|
||||||
|
Z3_OP_SELECT = 769,
|
||||||
|
Z3_OP_RA_PROJECT = 1542,
|
||||||
|
Z3_OP_BNEG = 1027,
|
||||||
|
Z3_OP_UMINUS = 520,
|
||||||
|
Z3_OP_REM = 524,
|
||||||
|
Z3_OP_TO_INT = 527,
|
||||||
|
Z3_OP_PR_QUANT_INST = 1301,
|
||||||
|
Z3_OP_SGEQ = 1044,
|
||||||
|
Z3_OP_POWER = 529,
|
||||||
|
Z3_OP_XOR3 = 1074,
|
||||||
|
Z3_OP_RA_IS_EMPTY = 1538,
|
||||||
|
Z3_OP_CARRY = 1073,
|
||||||
|
Z3_OP_DT_ACCESSOR = 2050,
|
||||||
|
Z3_OP_PR_TRANSITIVITY_STAR = 1288,
|
||||||
|
Z3_OP_PR_NNF_STAR = 1314,
|
||||||
|
Z3_OP_PR_COMMUTATIVITY = 1307,
|
||||||
|
Z3_OP_ULT = 1045,
|
||||||
|
Z3_OP_BSDIV0 = 1036,
|
||||||
|
Z3_OP_SET_DIFFERENCE = 775,
|
||||||
|
Z3_OP_INT2BV = 1071,
|
||||||
|
Z3_OP_XOR = 264,
|
||||||
|
Z3_OP_PR_MODUS_PONENS_OEQ = 1317,
|
||||||
|
Z3_OP_BNUM = 1024,
|
||||||
|
Z3_OP_BUDIV = 1032,
|
||||||
|
Z3_OP_PR_MONOTONICITY = 1289,
|
||||||
|
Z3_OP_PR_DEF_AXIOM = 1308,
|
||||||
|
Z3_OP_FALSE = 257,
|
||||||
|
Z3_OP_EXT_ROTATE_RIGHT = 1070,
|
||||||
|
Z3_OP_PR_DISTRIBUTIVITY = 1291,
|
||||||
|
Z3_OP_SIGN_EXT = 1057,
|
||||||
|
Z3_OP_PR_SKOLEMIZE = 1316,
|
||||||
|
Z3_OP_BCOMP = 1063,
|
||||||
|
Z3_OP_RA_COMPLEMENT = 1546,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Z3_param_kind</summary>
|
||||||
|
public enum Z3_param_kind {
|
||||||
|
Z3_PK_BOOL = 1,
|
||||||
|
Z3_PK_SYMBOL = 3,
|
||||||
|
Z3_PK_OTHER = 5,
|
||||||
|
Z3_PK_INVALID = 6,
|
||||||
|
Z3_PK_UINT = 0,
|
||||||
|
Z3_PK_STRING = 4,
|
||||||
|
Z3_PK_DOUBLE = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Z3_ast_print_mode</summary>
|
||||||
|
public enum Z3_ast_print_mode {
|
||||||
|
Z3_PRINT_SMTLIB2_COMPLIANT = 3,
|
||||||
|
Z3_PRINT_SMTLIB_COMPLIANT = 2,
|
||||||
|
Z3_PRINT_SMTLIB_FULL = 0,
|
||||||
|
Z3_PRINT_LOW_LEVEL = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Z3_error_code</summary>
|
||||||
|
public enum Z3_error_code {
|
||||||
|
Z3_INVALID_PATTERN = 6,
|
||||||
|
Z3_MEMOUT_FAIL = 7,
|
||||||
|
Z3_NO_PARSER = 5,
|
||||||
|
Z3_OK = 0,
|
||||||
|
Z3_INVALID_ARG = 3,
|
||||||
|
Z3_EXCEPTION = 12,
|
||||||
|
Z3_IOB = 2,
|
||||||
|
Z3_INTERNAL_FATAL = 9,
|
||||||
|
Z3_INVALID_USAGE = 10,
|
||||||
|
Z3_FILE_ACCESS_ERROR = 8,
|
||||||
|
Z3_SORT_ERROR = 1,
|
||||||
|
Z3_PARSER_ERROR = 4,
|
||||||
|
Z3_DEC_REF_ERROR = 11,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Z3_goal_prec</summary>
|
||||||
|
public enum Z3_goal_prec {
|
||||||
|
Z3_GOAL_UNDER = 1,
|
||||||
|
Z3_GOAL_PRECISE = 0,
|
||||||
|
Z3_GOAL_UNDER_OVER = 3,
|
||||||
|
Z3_GOAL_OVER = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
1677
Microsoft.Z3/Expr.cs
Normal file
1677
Microsoft.Z3/Expr.cs
Normal file
File diff suppressed because it is too large
Load diff
305
Microsoft.Z3/Fixedpoint.cs
Normal file
305
Microsoft.Z3/Fixedpoint.cs
Normal file
|
@ -0,0 +1,305 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Fixedpoints.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Fixedpoints
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-21
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Object for managing fixedpoints
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Fixedpoint : Z3Object
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string that describes all available fixedpoint solver parameters.
|
||||||
|
/// </summary>
|
||||||
|
public string Help
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<string>() != null);
|
||||||
|
return Native.Z3_fixedpoint_get_help(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the fixedpoint solver parameters.
|
||||||
|
/// </summary>
|
||||||
|
public Params Parameters
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Contract.Requires(value != null);
|
||||||
|
Context.CheckContextMatch(value);
|
||||||
|
Native.Z3_fixedpoint_set_params(Context.nCtx, NativeObject, value.NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves parameter descriptions for Fixedpoint solver.
|
||||||
|
/// </summary>
|
||||||
|
public ParamDescrs ParameterDescriptions
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new ParamDescrs(Context, Native.Z3_fixedpoint_get_param_descrs(Context.nCtx, NativeObject));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Assert a constraint (or multiple) into the fixedpoint solver.
|
||||||
|
/// </summary>
|
||||||
|
public void Assert(params BoolExpr[] constraints)
|
||||||
|
{
|
||||||
|
Contract.Requires(constraints != null);
|
||||||
|
Contract.Requires(Contract.ForAll(constraints, c => c != null));
|
||||||
|
|
||||||
|
Context.CheckContextMatch(constraints);
|
||||||
|
foreach (BoolExpr a in constraints)
|
||||||
|
{
|
||||||
|
Native.Z3_fixedpoint_assert(Context.nCtx, NativeObject, a.NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register predicate as recursive relation.
|
||||||
|
/// </summary>
|
||||||
|
public void RegisterRelation(FuncDecl f)
|
||||||
|
{
|
||||||
|
Contract.Requires(f != null);
|
||||||
|
|
||||||
|
Context.CheckContextMatch(f);
|
||||||
|
Native.Z3_fixedpoint_register_relation(Context.nCtx, NativeObject, f.NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add rule into the fixedpoint solver.
|
||||||
|
/// </summary>
|
||||||
|
public void AddRule(BoolExpr rule, Symbol name = null)
|
||||||
|
{
|
||||||
|
Contract.Requires(rule != null);
|
||||||
|
|
||||||
|
Context.CheckContextMatch(rule);
|
||||||
|
Native.Z3_fixedpoint_add_rule(Context.nCtx, NativeObject, rule.NativeObject, AST.GetNativeObject(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add table fact to the fixedpoint solver.
|
||||||
|
/// </summary>
|
||||||
|
public void AddFact(FuncDecl pred, params uint[] args)
|
||||||
|
{
|
||||||
|
Contract.Requires(pred != null);
|
||||||
|
Contract.Requires(args != null);
|
||||||
|
|
||||||
|
Context.CheckContextMatch(pred);
|
||||||
|
Native.Z3_fixedpoint_add_fact(Context.nCtx, NativeObject, pred.NativeObject, (uint)args.Length, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Query the fixedpoint solver.
|
||||||
|
/// A query is a conjunction of constraints. The constraints may include the recursively defined relations.
|
||||||
|
/// The query is satisfiable if there is an instance of the query variables and a derivation for it.
|
||||||
|
/// The query is unsatisfiable if there are no derivations satisfying the query variables.
|
||||||
|
/// </summary>
|
||||||
|
public Status Query(BoolExpr query)
|
||||||
|
{
|
||||||
|
Contract.Requires(query != null);
|
||||||
|
|
||||||
|
Context.CheckContextMatch(query);
|
||||||
|
Z3_lbool r = (Z3_lbool)Native.Z3_fixedpoint_query(Context.nCtx, NativeObject, query.NativeObject);
|
||||||
|
switch (r)
|
||||||
|
{
|
||||||
|
case Z3_lbool.Z3_L_TRUE: return Status.SATISFIABLE;
|
||||||
|
case Z3_lbool.Z3_L_FALSE: return Status.UNSATISFIABLE;
|
||||||
|
default: return Status.UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Query the fixedpoint solver.
|
||||||
|
/// A query is an array of relations.
|
||||||
|
/// The query is satisfiable if there is an instance of some relation that is non-empty.
|
||||||
|
/// The query is unsatisfiable if there are no derivations satisfying any of the relations.
|
||||||
|
/// </summary>
|
||||||
|
public Status Query(FuncDecl[] relations)
|
||||||
|
{
|
||||||
|
Contract.Requires(relations != null);
|
||||||
|
Contract.Requires(Contract.ForAll(0, relations.Length, i => relations[i] != null));
|
||||||
|
|
||||||
|
Context.CheckContextMatch(relations);
|
||||||
|
Z3_lbool r = (Z3_lbool)Native.Z3_fixedpoint_query_relations(Context.nCtx, NativeObject,
|
||||||
|
AST.ArrayLength(relations), AST.ArrayToNative(relations));
|
||||||
|
switch (r)
|
||||||
|
{
|
||||||
|
case Z3_lbool.Z3_L_TRUE: return Status.SATISFIABLE;
|
||||||
|
case Z3_lbool.Z3_L_FALSE: return Status.UNSATISFIABLE;
|
||||||
|
default: return Status.UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a backtracking point.
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref="Pop"/>
|
||||||
|
public void Push()
|
||||||
|
{
|
||||||
|
Native.Z3_fixedpoint_push(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Backtrack one backtracking point.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Note that an exception is thrown if Pop is called without a corresponding <c>Push</c></remarks>
|
||||||
|
/// <seealso cref="Push"/>
|
||||||
|
public void Pop()
|
||||||
|
{
|
||||||
|
Native.Z3_fixedpoint_pop(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update named rule into in the fixedpoint solver.
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateRule(BoolExpr rule, Symbol name)
|
||||||
|
{
|
||||||
|
Contract.Requires(rule != null);
|
||||||
|
|
||||||
|
Context.CheckContextMatch(rule);
|
||||||
|
Native.Z3_fixedpoint_update_rule(Context.nCtx, NativeObject, rule.NativeObject, AST.GetNativeObject(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve satisfying instance or instances of solver,
|
||||||
|
/// or definitions for the recursive predicates that show unsatisfiability.
|
||||||
|
/// </summary>
|
||||||
|
public Expr GetAnswer()
|
||||||
|
{
|
||||||
|
IntPtr ans = Native.Z3_fixedpoint_get_answer(Context.nCtx, NativeObject);
|
||||||
|
return (ans == IntPtr.Zero) ? null : Expr.Create(Context, ans);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve explanation why fixedpoint engine returned status Unknown.
|
||||||
|
/// </summary>
|
||||||
|
public string GetReasonUnknown()
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<string>() != null);
|
||||||
|
|
||||||
|
return Native.Z3_fixedpoint_get_reason_unknown(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the number of levels explored for a given predicate.
|
||||||
|
/// </summary>
|
||||||
|
public uint GetNumLevels(FuncDecl predicate)
|
||||||
|
{
|
||||||
|
return Native.Z3_fixedpoint_get_num_levels(Context.nCtx, NativeObject, predicate.NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the cover of a predicate.
|
||||||
|
/// </summary>
|
||||||
|
public Expr GetCoverDelta(int level, FuncDecl predicate)
|
||||||
|
{
|
||||||
|
IntPtr res = Native.Z3_fixedpoint_get_cover_delta(Context.nCtx, NativeObject, level, predicate.NativeObject);
|
||||||
|
return (res == IntPtr.Zero) ? null : Expr.Create(Context, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add <tt>property</tt> about the <tt>predicate</tt>.
|
||||||
|
/// The property is added at <tt>level</tt>.
|
||||||
|
/// </summary>
|
||||||
|
public void AddCover(int level, FuncDecl predicate, Expr property)
|
||||||
|
{
|
||||||
|
Native.Z3_fixedpoint_add_cover(Context.nCtx, NativeObject, level, predicate.NativeObject, property.NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve internal string representation of fixedpoint object.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_fixedpoint_to_string(Context.nCtx, NativeObject, 0, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Instrument the Datalog engine on which table representation to use for recursive predicate.
|
||||||
|
/// </summary>
|
||||||
|
public void SetPredicateRepresentation(FuncDecl f, Symbol[] kinds)
|
||||||
|
{
|
||||||
|
Contract.Requires(f != null);
|
||||||
|
|
||||||
|
Native.Z3_fixedpoint_set_predicate_representation(Context.nCtx, NativeObject,
|
||||||
|
f.NativeObject, AST.ArrayLength(kinds), Symbol.ArrayToNative(kinds));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Convert benchmark given as set of axioms, rules and queries to a string.
|
||||||
|
/// </summary>
|
||||||
|
public string ToString(BoolExpr[] queries)
|
||||||
|
{
|
||||||
|
|
||||||
|
return Native.Z3_fixedpoint_to_string(Context.nCtx, NativeObject,
|
||||||
|
AST.ArrayLength(queries), AST.ArrayToNative(queries));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal Fixedpoint(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
internal Fixedpoint(Context ctx)
|
||||||
|
: base(ctx, Native.Z3_mk_fixedpoint(ctx.nCtx))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_fixedpoint_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_fixedpoint_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Fixedpoint_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Fixedpoint_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
344
Microsoft.Z3/FuncDecl.cs
Normal file
344
Microsoft.Z3/FuncDecl.cs
Normal file
|
@ -0,0 +1,344 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
FuncDecl.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Function Declarations
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-16
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Function declarations.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class FuncDecl : AST
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Comparison operator.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if <paramref name="a"/> and <paramref name="b"/> share the same context and are equal, false otherwise.</returns>
|
||||||
|
public static bool operator ==(FuncDecl a, FuncDecl b)
|
||||||
|
{
|
||||||
|
return Object.ReferenceEquals(a, b) ||
|
||||||
|
(!Object.ReferenceEquals(a, null) &&
|
||||||
|
!Object.ReferenceEquals(b, null) &&
|
||||||
|
a.Context.nCtx == b.Context.nCtx &&
|
||||||
|
Native.Z3_is_eq_func_decl(a.Context.nCtx, a.NativeObject, b.NativeObject) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Comparison operator.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if <paramref name="a"/> and <paramref name="b"/> do not share the same context or are not equal, false otherwise.</returns>
|
||||||
|
public static bool operator !=(FuncDecl a, FuncDecl b)
|
||||||
|
{
|
||||||
|
return !(a == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Object comparison.
|
||||||
|
/// </summary>
|
||||||
|
public override bool Equals(object o)
|
||||||
|
{
|
||||||
|
FuncDecl casted = o as FuncDecl;
|
||||||
|
if (casted == null) return false;
|
||||||
|
return this == casted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A hash code.
|
||||||
|
/// </summary>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return base.GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representations of the function declaration.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_func_decl_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a unique identifier for the function declaration.
|
||||||
|
/// </summary>
|
||||||
|
new public uint Id
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_func_decl_id(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The arity of the function declaration
|
||||||
|
/// </summary>
|
||||||
|
public uint Arity
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_arity(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The size of the domain of the function declaration
|
||||||
|
/// <seealso cref="Arity"/>
|
||||||
|
/// </summary>
|
||||||
|
public uint DomainSize
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_domain_size(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The domain of the function declaration
|
||||||
|
/// </summary>
|
||||||
|
public Sort[] Domain
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Sort[]>() != null);
|
||||||
|
|
||||||
|
var n = DomainSize;
|
||||||
|
|
||||||
|
Sort[] res = new Sort[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = Sort.Create(Context, Native.Z3_get_domain(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The range of the function declaration
|
||||||
|
/// </summary>
|
||||||
|
public Sort Range
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<Sort>() != null);
|
||||||
|
return Sort.Create(Context, Native.Z3_get_range(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The kind of the function declaration.
|
||||||
|
/// </summary>
|
||||||
|
public Z3_decl_kind DeclKind
|
||||||
|
{
|
||||||
|
get { return (Z3_decl_kind)Native.Z3_get_decl_kind(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the function declaration
|
||||||
|
/// </summary>
|
||||||
|
public Symbol Name
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<Symbol>() != null);
|
||||||
|
return Symbol.Create(Context, Native.Z3_get_decl_name(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of parameters of the function declaration
|
||||||
|
/// </summary>
|
||||||
|
public uint NumParameters
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_decl_num_parameters(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The parameters of the function declaration
|
||||||
|
/// </summary>
|
||||||
|
public Parameter[] Parameters
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Parameter[]>() != null);
|
||||||
|
|
||||||
|
uint num = NumParameters;
|
||||||
|
Parameter[] res = new Parameter[num];
|
||||||
|
for (uint i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
Z3_parameter_kind k = (Z3_parameter_kind)Native.Z3_get_decl_parameter_kind(Context.nCtx, NativeObject, i);
|
||||||
|
switch (k)
|
||||||
|
{
|
||||||
|
case Z3_parameter_kind.Z3_PARAMETER_INT:
|
||||||
|
res[i] = new Parameter(k, Native.Z3_get_decl_int_parameter(Context.nCtx, NativeObject, i));
|
||||||
|
break;
|
||||||
|
case Z3_parameter_kind.Z3_PARAMETER_DOUBLE:
|
||||||
|
res[i] = new Parameter(k, Native.Z3_get_decl_double_parameter(Context.nCtx, NativeObject, i));
|
||||||
|
break;
|
||||||
|
case Z3_parameter_kind.Z3_PARAMETER_SYMBOL:
|
||||||
|
res[i] = new Parameter(k, Symbol.Create(Context, Native.Z3_get_decl_symbol_parameter(Context.nCtx, NativeObject, i)));
|
||||||
|
break;
|
||||||
|
case Z3_parameter_kind.Z3_PARAMETER_SORT:
|
||||||
|
res[i] = new Parameter(k, Sort.Create(Context, Native.Z3_get_decl_sort_parameter(Context.nCtx, NativeObject, i)));
|
||||||
|
break;
|
||||||
|
case Z3_parameter_kind.Z3_PARAMETER_AST:
|
||||||
|
res[i] = new Parameter(k, new AST(Context, Native.Z3_get_decl_ast_parameter(Context.nCtx, NativeObject, i)));
|
||||||
|
break;
|
||||||
|
case Z3_parameter_kind.Z3_PARAMETER_FUNC_DECL:
|
||||||
|
res[i] = new Parameter(k, new FuncDecl(Context, Native.Z3_get_decl_func_decl_parameter(Context.nCtx, NativeObject, i)));
|
||||||
|
break;
|
||||||
|
case Z3_parameter_kind.Z3_PARAMETER_RATIONAL:
|
||||||
|
res[i] = new Parameter(k, Native.Z3_get_decl_rational_parameter(Context.nCtx, NativeObject, i));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Z3Exception("Unknown function declaration parameter kind encountered");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Function declarations can have Parameters associated with them.
|
||||||
|
/// </summary>
|
||||||
|
public class Parameter
|
||||||
|
{
|
||||||
|
readonly private Z3_parameter_kind kind;
|
||||||
|
readonly private int i;
|
||||||
|
readonly private double d;
|
||||||
|
readonly private Symbol sym;
|
||||||
|
readonly private Sort srt;
|
||||||
|
readonly private AST ast;
|
||||||
|
readonly private FuncDecl fd;
|
||||||
|
readonly private string r;
|
||||||
|
|
||||||
|
/// <summary>The int value of the parameter.</summary>
|
||||||
|
public int Int { get { if (ParameterKind != Z3_parameter_kind.Z3_PARAMETER_INT) throw new Z3Exception("parameter is not an int"); return i; } }
|
||||||
|
/// <summary>The double value of the parameter.</summary>
|
||||||
|
public double Double { get { if (ParameterKind != Z3_parameter_kind.Z3_PARAMETER_DOUBLE) throw new Z3Exception("parameter is not a double "); return d; } }
|
||||||
|
/// <summary>The Symbol value of the parameter.</summary>
|
||||||
|
public Symbol Symbol { get { if (ParameterKind != Z3_parameter_kind.Z3_PARAMETER_SYMBOL) throw new Z3Exception("parameter is not a Symbol"); return sym; } }
|
||||||
|
/// <summary>The Sort value of the parameter.</summary>
|
||||||
|
public Sort Sort { get { if (ParameterKind != Z3_parameter_kind.Z3_PARAMETER_SORT) throw new Z3Exception("parameter is not a Sort"); return srt; } }
|
||||||
|
/// <summary>The AST value of the parameter.</summary>
|
||||||
|
public AST AST { get { if (ParameterKind != Z3_parameter_kind.Z3_PARAMETER_AST) throw new Z3Exception("parameter is not an AST"); return ast; } }
|
||||||
|
/// <summary>The FunctionDeclaration value of the parameter.</summary>
|
||||||
|
public FuncDecl FuncDecl { get { if (ParameterKind != Z3_parameter_kind.Z3_PARAMETER_FUNC_DECL) throw new Z3Exception("parameter is not a function declaration"); return fd; } }
|
||||||
|
/// <summary>The rational string value of the parameter.</summary>
|
||||||
|
public string Rational { get { if (ParameterKind != Z3_parameter_kind.Z3_PARAMETER_RATIONAL) throw new Z3Exception("parameter is not a rational string"); return r; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The kind of the parameter.
|
||||||
|
/// </summary>
|
||||||
|
public Z3_parameter_kind ParameterKind { get { return kind; } }
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal Parameter(Z3_parameter_kind k, int i)
|
||||||
|
{
|
||||||
|
this.kind = k;
|
||||||
|
this.i = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Parameter(Z3_parameter_kind k, double d)
|
||||||
|
{
|
||||||
|
this.kind = k;
|
||||||
|
this.d = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Parameter(Z3_parameter_kind k, Symbol s)
|
||||||
|
{
|
||||||
|
this.kind = k;
|
||||||
|
this.sym = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Parameter(Z3_parameter_kind k, Sort s)
|
||||||
|
{
|
||||||
|
this.kind = k;
|
||||||
|
this.srt = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Parameter(Z3_parameter_kind k, AST a)
|
||||||
|
{
|
||||||
|
this.kind = k;
|
||||||
|
this.ast = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Parameter(Z3_parameter_kind k, FuncDecl fd)
|
||||||
|
{
|
||||||
|
this.kind = k;
|
||||||
|
this.fd = fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Parameter(Z3_parameter_kind k, string r)
|
||||||
|
{
|
||||||
|
this.kind = k;
|
||||||
|
this.r = r;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal FuncDecl(Context ctx, IntPtr obj) : base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal FuncDecl(Context ctx, Symbol name, Sort[] domain, Sort range)
|
||||||
|
: base(ctx, Native.Z3_mk_func_decl(ctx.nCtx, name.NativeObject,
|
||||||
|
AST.ArrayLength(domain), AST.ArrayToNative(domain),
|
||||||
|
range.NativeObject))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
Contract.Requires(range != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal FuncDecl(Context ctx, string prefix, Sort[] domain, Sort range)
|
||||||
|
: base(ctx, Native.Z3_mk_fresh_func_decl(ctx.nCtx, prefix,
|
||||||
|
AST.ArrayLength(domain), AST.ArrayToNative(domain),
|
||||||
|
range.NativeObject))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(range != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
internal override void CheckNativeObject(IntPtr obj)
|
||||||
|
{
|
||||||
|
if (Native.Z3_get_ast_kind(Context.nCtx, obj) != (uint)Z3_ast_kind.Z3_FUNC_DECL_AST)
|
||||||
|
throw new Z3Exception("Underlying object is not a function declaration");
|
||||||
|
base.CheckNativeObject(obj);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create expression that applies function to arguments.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Expr this[params Expr[] args] {
|
||||||
|
get {
|
||||||
|
Contract.Requires(args == null || Contract.ForAll(args, a => a != null));
|
||||||
|
|
||||||
|
return Apply(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create expression that applies function to arguments.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Expr Apply(params Expr[] args)
|
||||||
|
{
|
||||||
|
Contract.Requires(args == null || Contract.ForAll(args, a => a != null));
|
||||||
|
|
||||||
|
Context.CheckContextMatch(args);
|
||||||
|
return Expr.Create(Context, this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
221
Microsoft.Z3/FuncInterp.cs
Normal file
221
Microsoft.Z3/FuncInterp.cs
Normal file
|
@ -0,0 +1,221 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
FuncInterp.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Function Interpretations
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-21
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A function interpretation is represented as a finite map and an 'else' value.
|
||||||
|
/// Each entry in the finite map represents the value of a function given a set of arguments.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class FuncInterp : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An Entry object represents an element in the finite map used to encode
|
||||||
|
/// a function interpretation.
|
||||||
|
/// </summary>
|
||||||
|
public class Entry : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Return the (symbolic) value of this entry.
|
||||||
|
/// </summary>
|
||||||
|
public Expr Value
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<Expr>() != null);
|
||||||
|
return Expr.Create(Context, Native.Z3_func_entry_get_value(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of arguments of the entry.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumArgs
|
||||||
|
{
|
||||||
|
get { return Native.Z3_func_entry_get_num_args(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The arguments of the function entry.
|
||||||
|
/// </summary>
|
||||||
|
public Expr[] Args
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Expr[]>() != null);
|
||||||
|
Contract.Ensures(Contract.Result<Expr[]>().Length == this.NumArgs);
|
||||||
|
|
||||||
|
uint n = NumArgs;
|
||||||
|
Expr[] res = new Expr[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = Expr.Create(Context, Native.Z3_func_entry_get_arg(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the function entry.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
uint n = NumArgs;
|
||||||
|
string res = "[";
|
||||||
|
Expr[] args = Args;
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res += args[i] + ", ";
|
||||||
|
return res + Value + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal Entry(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_func_entry_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_func_entry_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.FuncEntry_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.FuncEntry_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of entries in the function interpretation.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumEntries
|
||||||
|
{
|
||||||
|
get { return Native.Z3_func_interp_get_num_entries(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The entries in the function interpretation
|
||||||
|
/// </summary>
|
||||||
|
public Entry[] Entries
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Entry[]>() != null);
|
||||||
|
Contract.Ensures(Contract.ForAll(0, Contract.Result<Entry[]>().Length,
|
||||||
|
j => Contract.Result<Entry[]>()[j] != null));
|
||||||
|
|
||||||
|
uint n = NumEntries;
|
||||||
|
Entry[] res = new Entry[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = new Entry(Context, Native.Z3_func_interp_get_entry(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The (symbolic) `else' value of the function interpretation.
|
||||||
|
/// </summary>
|
||||||
|
public Expr Else
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<Expr>() != null);
|
||||||
|
|
||||||
|
return Expr.Create(Context, Native.Z3_func_interp_get_else(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The arity of the function interpretation
|
||||||
|
/// </summary>
|
||||||
|
public uint Arity
|
||||||
|
{
|
||||||
|
get { return Native.Z3_func_interp_get_arity(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the function interpretation.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
string res = "";
|
||||||
|
res += "[";
|
||||||
|
foreach (Entry e in Entries)
|
||||||
|
{
|
||||||
|
uint n = e.NumArgs;
|
||||||
|
if (n > 1) res += "[";
|
||||||
|
Expr[] args = e.Args;
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
if (i != 0) res += ", ";
|
||||||
|
res += args[i];
|
||||||
|
}
|
||||||
|
if (n > 1) res += "]";
|
||||||
|
res += " -> " + e.Value + ", ";
|
||||||
|
}
|
||||||
|
res += "else -> " + Else;
|
||||||
|
res += "]";
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal FuncInterp(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_func_interp_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_func_interp_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.FuncInterp_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.FuncInterp_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
239
Microsoft.Z3/Goal.cs
Normal file
239
Microsoft.Z3/Goal.cs
Normal file
|
@ -0,0 +1,239 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Goal.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Goal
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-21
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A goal (aka problem). A goal is essentially a set
|
||||||
|
/// of formulas, that can be solved and/or transformed using
|
||||||
|
/// tactics and solvers.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Goal : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The precision of the goal.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Goals can be transformed using over and under approximations.
|
||||||
|
/// An under approximation is applied when the objective is to find a model for a given goal.
|
||||||
|
/// An over approximation is applied when the objective is to find a proof for a given goal.
|
||||||
|
/// </remarks>
|
||||||
|
public Z3_goal_prec Precision
|
||||||
|
{
|
||||||
|
get { return (Z3_goal_prec)Native.Z3_goal_precision(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the goal is precise.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsPrecise
|
||||||
|
{
|
||||||
|
get { return Precision == Z3_goal_prec.Z3_GOAL_PRECISE; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the goal is an under-approximation.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsUnderApproximation
|
||||||
|
{
|
||||||
|
get { return Precision == Z3_goal_prec.Z3_GOAL_UNDER; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the goal is an over-approximation.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsOverApproximation
|
||||||
|
{
|
||||||
|
get { return Precision == Z3_goal_prec.Z3_GOAL_OVER; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the goal is garbage (i.e., the product of over- and under-approximations).
|
||||||
|
/// </summary>
|
||||||
|
public bool IsGarbage
|
||||||
|
{
|
||||||
|
get { return Precision == Z3_goal_prec.Z3_GOAL_UNDER_OVER; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the <paramref name="constraints"/> to the given goal.
|
||||||
|
/// </summary>
|
||||||
|
public void Assert(params BoolExpr[] constraints)
|
||||||
|
{
|
||||||
|
Contract.Requires(constraints != null);
|
||||||
|
Contract.Requires(Contract.ForAll(constraints, c => c != null));
|
||||||
|
|
||||||
|
Context.CheckContextMatch(constraints);
|
||||||
|
foreach (BoolExpr c in constraints)
|
||||||
|
{
|
||||||
|
Contract.Assert(c != null); // It was an assume, now made an assert just to be sure we do not regress
|
||||||
|
Native.Z3_goal_assert(Context.nCtx, NativeObject, c.NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the goal contains `false'.
|
||||||
|
/// </summary>
|
||||||
|
public bool Inconsistent
|
||||||
|
{
|
||||||
|
get { return Native.Z3_goal_inconsistent(Context.nCtx, NativeObject) != 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The depth of the goal.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This tracks how many transformations were applied to it.
|
||||||
|
/// </remarks>
|
||||||
|
public uint Depth
|
||||||
|
{
|
||||||
|
get { return Native.Z3_goal_depth(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Erases all formulas from the given goal.
|
||||||
|
/// </summary>
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
Native.Z3_goal_reset(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of formulas in the goal.
|
||||||
|
/// </summary>
|
||||||
|
public uint Size
|
||||||
|
{
|
||||||
|
get { return Native.Z3_goal_size(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The formulas in the goal.
|
||||||
|
/// </summary>
|
||||||
|
public BoolExpr[] Formulas
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<BoolExpr[]>() != null);
|
||||||
|
|
||||||
|
uint n = Size;
|
||||||
|
BoolExpr[] res = new BoolExpr[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = new BoolExpr(Context, Native.Z3_goal_formula(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of formulas, subformulas and terms in the goal.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumExprs
|
||||||
|
{
|
||||||
|
get { return Native.Z3_goal_num_exprs(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the goal is empty, and it is precise or the product of an under approximation.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDecidedSat
|
||||||
|
{
|
||||||
|
get { return Native.Z3_goal_is_decided_sat(Context.nCtx, NativeObject) != 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the goal contains `false', and it is precise or the product of an over approximation.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDecidedUnsat
|
||||||
|
{
|
||||||
|
get { return Native.Z3_goal_is_decided_unsat(Context.nCtx, NativeObject) != 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Translates (copies) the Goal to the target Context <paramref name="ctx"/>.
|
||||||
|
/// </summary>
|
||||||
|
public Goal Translate(Context ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
|
||||||
|
return new Goal(ctx, Native.Z3_goal_translate(Context.nCtx, NativeObject, ctx.nCtx));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Simplifies the goal.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Essentially invokes the `simplify' tactic on the goal.</remarks>
|
||||||
|
public Goal Simplify(Params p = null)
|
||||||
|
{
|
||||||
|
Tactic t = Context.MkTactic("simplify");
|
||||||
|
ApplyResult res = t.Apply(this, p);
|
||||||
|
|
||||||
|
if (res.NumSubgoals == 0)
|
||||||
|
return Context.MkGoal();
|
||||||
|
else
|
||||||
|
return res.Subgoals[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Goal to string conversion.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A string representation of the Goal.</returns>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_goal_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal Goal(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
|
||||||
|
internal Goal(Context ctx, bool models, bool unsatCores, bool proofs)
|
||||||
|
: base(ctx, Native.Z3_mk_goal(ctx.nCtx, (models) ? 1 : 0, (unsatCores) ? 1 : 0, (proofs) ? 1 : 0))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_goal_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_goal_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Goal_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Goal_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
79
Microsoft.Z3/Log.cs
Normal file
79
Microsoft.Z3/Log.cs
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Log.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Log
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logging for Z3.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Note that this is a global, static log and if multiple Context
|
||||||
|
/// objects are created, it logs the interaction with all of them.
|
||||||
|
/// </remarks>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public static class Log
|
||||||
|
{
|
||||||
|
private static bool m_is_open = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Open an interaction log file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename">the name of the file to open</param>
|
||||||
|
/// <returns>True if opening the log file succeeds, false otherwise.</returns>
|
||||||
|
public static bool Open(string filename)
|
||||||
|
{
|
||||||
|
m_is_open = true;
|
||||||
|
return Native.Z3_open_log(filename) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Closes the interaction log.
|
||||||
|
/// </summary>
|
||||||
|
public static void Close()
|
||||||
|
{
|
||||||
|
m_is_open = false;
|
||||||
|
Native.Z3_close_log();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Appends the user-provided string <paramref name="s"/> to the interaction log.
|
||||||
|
/// </summary>
|
||||||
|
public static void Append(string s)
|
||||||
|
{
|
||||||
|
Contract.Requires(isOpen());
|
||||||
|
|
||||||
|
if (!m_is_open)
|
||||||
|
throw new Z3Exception("Log cannot be closed.");
|
||||||
|
Native.Z3_append_log(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks whether the interaction log is opened.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if the interaction log is open, false otherwise.</returns>
|
||||||
|
[Pure]
|
||||||
|
public static bool isOpen()
|
||||||
|
{
|
||||||
|
return m_is_open;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
380
Microsoft.Z3/Microsoft.Z3.csproj
Normal file
380
Microsoft.Z3/Microsoft.Z3.csproj
Normal file
|
@ -0,0 +1,380 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{EC3DB697-B734-42F7-9468-5B62821EEB5A}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Microsoft.Z3</RootNamespace>
|
||||||
|
<AssemblyName>Microsoft.Z3</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||||
|
<CodeContractsAssemblyMode>0</CodeContractsAssemblyMode>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>
|
||||||
|
</DocumentationFile>
|
||||||
|
<CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking>
|
||||||
|
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
|
||||||
|
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
|
||||||
|
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
|
||||||
|
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
|
||||||
|
<CodeContractsRunCodeAnalysis>True</CodeContractsRunCodeAnalysis>
|
||||||
|
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
|
||||||
|
<CodeContractsBoundsObligations>True</CodeContractsBoundsObligations>
|
||||||
|
<CodeContractsArithmeticObligations>True</CodeContractsArithmeticObligations>
|
||||||
|
<CodeContractsEnumObligations>False</CodeContractsEnumObligations>
|
||||||
|
<CodeContractsPointerObligations>False</CodeContractsPointerObligations>
|
||||||
|
<CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
|
||||||
|
<CodeContractsInferRequires>True</CodeContractsInferRequires>
|
||||||
|
<CodeContractsInferEnsures>False</CodeContractsInferEnsures>
|
||||||
|
<CodeContractsInferObjectInvariants>False</CodeContractsInferObjectInvariants>
|
||||||
|
<CodeContractsSuggestAssumptions>False</CodeContractsSuggestAssumptions>
|
||||||
|
<CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
|
||||||
|
<CodeContractsSuggestEnsures>False</CodeContractsSuggestEnsures>
|
||||||
|
<CodeContractsSuggestObjectInvariants>False</CodeContractsSuggestObjectInvariants>
|
||||||
|
<CodeContractsDisjunctiveRequires>True</CodeContractsDisjunctiveRequires>
|
||||||
|
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
|
||||||
|
<CodeContractsShowSquigglies>True</CodeContractsShowSquigglies>
|
||||||
|
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
|
||||||
|
<CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
|
||||||
|
<CodeContractsCustomRewriterAssembly />
|
||||||
|
<CodeContractsCustomRewriterClass />
|
||||||
|
<CodeContractsLibPaths />
|
||||||
|
<CodeContractsExtraRewriteOptions />
|
||||||
|
<CodeContractsExtraAnalysisOptions />
|
||||||
|
<CodeContractsBaseLineFile />
|
||||||
|
<CodeContractsCacheAnalysisResults>True</CodeContractsCacheAnalysisResults>
|
||||||
|
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
|
||||||
|
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
|
||||||
|
<CodeContractsAnalysisWarningLevel>2</CodeContractsAnalysisWarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..\external\</OutputPath>
|
||||||
|
<DefineConstants>
|
||||||
|
</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\external\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'external|AnyCPU' ">
|
||||||
|
<OutputPath>..\external\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\external\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>bin\Release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<OutputPath>..\x64\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>..\Debug\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
<CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
|
||||||
|
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
|
||||||
|
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
|
||||||
|
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
|
||||||
|
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
|
||||||
|
<CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
|
||||||
|
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
|
||||||
|
<CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
|
||||||
|
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
|
||||||
|
<CodeContractsEnumObligations>False</CodeContractsEnumObligations>
|
||||||
|
<CodeContractsPointerObligations>False</CodeContractsPointerObligations>
|
||||||
|
<CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
|
||||||
|
<CodeContractsInferRequires>False</CodeContractsInferRequires>
|
||||||
|
<CodeContractsInferEnsures>False</CodeContractsInferEnsures>
|
||||||
|
<CodeContractsInferObjectInvariants>False</CodeContractsInferObjectInvariants>
|
||||||
|
<CodeContractsSuggestAssumptions>False</CodeContractsSuggestAssumptions>
|
||||||
|
<CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
|
||||||
|
<CodeContractsSuggestEnsures>False</CodeContractsSuggestEnsures>
|
||||||
|
<CodeContractsSuggestObjectInvariants>False</CodeContractsSuggestObjectInvariants>
|
||||||
|
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
|
||||||
|
<CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
|
||||||
|
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
|
||||||
|
<CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
|
||||||
|
<CodeContractsCustomRewriterAssembly />
|
||||||
|
<CodeContractsCustomRewriterClass />
|
||||||
|
<CodeContractsLibPaths />
|
||||||
|
<CodeContractsExtraRewriteOptions />
|
||||||
|
<CodeContractsExtraAnalysisOptions />
|
||||||
|
<CodeContractsBaseLineFile />
|
||||||
|
<CodeContractsCacheAnalysisResults>False</CodeContractsCacheAnalysisResults>
|
||||||
|
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
|
||||||
|
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
|
||||||
|
<CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
|
<OutputPath>..\x64\external_64\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\x64\external_64\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>..\release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
|
||||||
|
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
|
||||||
|
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
|
||||||
|
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
|
||||||
|
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
|
||||||
|
<CodeContractsRunCodeAnalysis>True</CodeContractsRunCodeAnalysis>
|
||||||
|
<CodeContractsNonNullObligations>True</CodeContractsNonNullObligations>
|
||||||
|
<CodeContractsBoundsObligations>True</CodeContractsBoundsObligations>
|
||||||
|
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
|
||||||
|
<CodeContractsEnumObligations>False</CodeContractsEnumObligations>
|
||||||
|
<CodeContractsPointerObligations>False</CodeContractsPointerObligations>
|
||||||
|
<CodeContractsRedundantAssumptions>True</CodeContractsRedundantAssumptions>
|
||||||
|
<CodeContractsInferRequires>True</CodeContractsInferRequires>
|
||||||
|
<CodeContractsInferEnsures>False</CodeContractsInferEnsures>
|
||||||
|
<CodeContractsInferObjectInvariants>False</CodeContractsInferObjectInvariants>
|
||||||
|
<CodeContractsSuggestAssumptions>False</CodeContractsSuggestAssumptions>
|
||||||
|
<CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
|
||||||
|
<CodeContractsSuggestEnsures>False</CodeContractsSuggestEnsures>
|
||||||
|
<CodeContractsSuggestObjectInvariants>False</CodeContractsSuggestObjectInvariants>
|
||||||
|
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
|
||||||
|
<CodeContractsShowSquigglies>True</CodeContractsShowSquigglies>
|
||||||
|
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
|
||||||
|
<CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
|
||||||
|
<CodeContractsCustomRewriterAssembly />
|
||||||
|
<CodeContractsCustomRewriterClass />
|
||||||
|
<CodeContractsLibPaths />
|
||||||
|
<CodeContractsExtraRewriteOptions />
|
||||||
|
<CodeContractsExtraAnalysisOptions>-repro</CodeContractsExtraAnalysisOptions>
|
||||||
|
<CodeContractsBaseLineFile />
|
||||||
|
<CodeContractsCacheAnalysisResults>True</CodeContractsCacheAnalysisResults>
|
||||||
|
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
|
||||||
|
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
|
||||||
|
<CodeContractsAnalysisWarningLevel>2</CodeContractsAnalysisWarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'external|x64'">
|
||||||
|
<OutputPath>..\x64\external\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\external\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>bin\Release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'external_64|AnyCPU'">
|
||||||
|
<OutputPath>..\x64\external_64\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\x64\external_64\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>bin\Release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'external_64|x64'">
|
||||||
|
<OutputPath>..\x64\external_64\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\x64\external_64\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>bin\Release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||||
|
<CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
|
||||||
|
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
|
||||||
|
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
|
||||||
|
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
|
||||||
|
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
|
||||||
|
<CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
|
||||||
|
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
|
||||||
|
<CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
|
||||||
|
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
|
||||||
|
<CodeContractsEnumObligations>False</CodeContractsEnumObligations>
|
||||||
|
<CodeContractsPointerObligations>False</CodeContractsPointerObligations>
|
||||||
|
<CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
|
||||||
|
<CodeContractsInferRequires>False</CodeContractsInferRequires>
|
||||||
|
<CodeContractsInferEnsures>False</CodeContractsInferEnsures>
|
||||||
|
<CodeContractsInferObjectInvariants>False</CodeContractsInferObjectInvariants>
|
||||||
|
<CodeContractsSuggestAssumptions>False</CodeContractsSuggestAssumptions>
|
||||||
|
<CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
|
||||||
|
<CodeContractsSuggestEnsures>False</CodeContractsSuggestEnsures>
|
||||||
|
<CodeContractsSuggestObjectInvariants>False</CodeContractsSuggestObjectInvariants>
|
||||||
|
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
|
||||||
|
<CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
|
||||||
|
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
|
||||||
|
<CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
|
||||||
|
<CodeContractsCustomRewriterAssembly />
|
||||||
|
<CodeContractsCustomRewriterClass />
|
||||||
|
<CodeContractsLibPaths />
|
||||||
|
<CodeContractsExtraRewriteOptions />
|
||||||
|
<CodeContractsExtraAnalysisOptions />
|
||||||
|
<CodeContractsBaseLineFile />
|
||||||
|
<CodeContractsCacheAnalysisResults>False</CodeContractsCacheAnalysisResults>
|
||||||
|
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
|
||||||
|
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
|
||||||
|
<CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyOriginatorKeyFile>z3.snk</AssemblyOriginatorKeyFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_delaysign|AnyCPU'">
|
||||||
|
<OutputPath>..\Release_delaysign\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\Release_delaysign\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>..\release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
<DefineConstants>DELAYSIGN</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_delaysign|x64'">
|
||||||
|
<OutputPath>bin\x64\Release_delaysign\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\x64\external_64\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>..\release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Numerics" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="ApplyResult.cs" />
|
||||||
|
<Compile Include="AST.cs" />
|
||||||
|
<Compile Include="ASTMap.cs" />
|
||||||
|
<Compile Include="ASTVector.cs" />
|
||||||
|
<Compile Include="Constructor.cs" />
|
||||||
|
<Compile Include="DecRefQueue.cs" />
|
||||||
|
<Compile Include="Enumerations.cs" />
|
||||||
|
<Compile Include="Expr.cs" />
|
||||||
|
<Compile Include="Fixedpoint.cs" />
|
||||||
|
<Compile Include="FuncDecl.cs" />
|
||||||
|
<Compile Include="FuncInterp.cs" />
|
||||||
|
<Compile Include="Goal.cs" />
|
||||||
|
<Compile Include="Model.cs" />
|
||||||
|
<Compile Include="Numeral.cs" />
|
||||||
|
<Compile Include="Params.cs" />
|
||||||
|
<Compile Include="ParamDescrs.cs" />
|
||||||
|
<Compile Include="Pattern.cs" />
|
||||||
|
<Compile Include="Statistics.cs" />
|
||||||
|
<Compile Include="Status.cs" />
|
||||||
|
<Compile Include="Context.cs" />
|
||||||
|
<Compile Include="Probe.cs" />
|
||||||
|
<Compile Include="Solver.cs" />
|
||||||
|
<Compile Include="Tactic.cs" />
|
||||||
|
<Compile Include="Z3Exception.cs" />
|
||||||
|
<Compile Include="Log.cs" />
|
||||||
|
<Compile Include="Native.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Quantifier.cs" />
|
||||||
|
<Compile Include="Sort.cs" />
|
||||||
|
<Compile Include="Symbol.cs" />
|
||||||
|
<Compile Include="Version.cs" />
|
||||||
|
<Compile Include="Z3Object.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<WCFMetadata Include="Service References\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="z3.snk" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
403
Microsoft.Z3/Microsoft.Z3_35.csproj
Normal file
403
Microsoft.Z3/Microsoft.Z3_35.csproj
Normal file
|
@ -0,0 +1,403 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{EC3DB697-B734-42F7-9468-5B62821EEB5A}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Microsoft.Z3</RootNamespace>
|
||||||
|
<AssemblyName>Microsoft.Z3</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||||
|
<CodeContractsAssemblyMode>0</CodeContractsAssemblyMode>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin35\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>
|
||||||
|
</DocumentationFile>
|
||||||
|
<CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking>
|
||||||
|
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
|
||||||
|
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
|
||||||
|
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
|
||||||
|
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
|
||||||
|
<CodeContractsRunCodeAnalysis>True</CodeContractsRunCodeAnalysis>
|
||||||
|
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
|
||||||
|
<CodeContractsBoundsObligations>True</CodeContractsBoundsObligations>
|
||||||
|
<CodeContractsArithmeticObligations>True</CodeContractsArithmeticObligations>
|
||||||
|
<CodeContractsEnumObligations>False</CodeContractsEnumObligations>
|
||||||
|
<CodeContractsPointerObligations>False</CodeContractsPointerObligations>
|
||||||
|
<CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
|
||||||
|
<CodeContractsInferRequires>True</CodeContractsInferRequires>
|
||||||
|
<CodeContractsInferEnsures>False</CodeContractsInferEnsures>
|
||||||
|
<CodeContractsInferObjectInvariants>False</CodeContractsInferObjectInvariants>
|
||||||
|
<CodeContractsSuggestAssumptions>False</CodeContractsSuggestAssumptions>
|
||||||
|
<CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
|
||||||
|
<CodeContractsSuggestEnsures>False</CodeContractsSuggestEnsures>
|
||||||
|
<CodeContractsSuggestObjectInvariants>False</CodeContractsSuggestObjectInvariants>
|
||||||
|
<CodeContractsDisjunctiveRequires>True</CodeContractsDisjunctiveRequires>
|
||||||
|
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
|
||||||
|
<CodeContractsShowSquigglies>True</CodeContractsShowSquigglies>
|
||||||
|
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
|
||||||
|
<CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
|
||||||
|
<CodeContractsCustomRewriterAssembly />
|
||||||
|
<CodeContractsCustomRewriterClass />
|
||||||
|
<CodeContractsLibPaths />
|
||||||
|
<CodeContractsExtraRewriteOptions />
|
||||||
|
<CodeContractsExtraAnalysisOptions />
|
||||||
|
<CodeContractsBaseLineFile />
|
||||||
|
<CodeContractsCacheAnalysisResults>True</CodeContractsCacheAnalysisResults>
|
||||||
|
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
|
||||||
|
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
|
||||||
|
<CodeContractsAnalysisWarningLevel>2</CodeContractsAnalysisWarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin35\external\bin\</OutputPath>
|
||||||
|
<DefineConstants>FRAMEWORK_LT_4</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\external\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'external|AnyCPU' ">
|
||||||
|
<OutputPath>bin35\external\bin\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\external\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>bin\Release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||||
|
<DefineConstants>FRAMEWORK_LT_4</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'external|Win32' ">
|
||||||
|
<OutputPath>bin35\external\bin\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\external\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>bin\Release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||||
|
<DefineConstants>FRAMEWORK_LT_4</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<OutputPath>bin35\x64\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>..\Debug\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
<CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
|
||||||
|
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
|
||||||
|
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
|
||||||
|
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
|
||||||
|
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
|
||||||
|
<CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
|
||||||
|
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
|
||||||
|
<CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
|
||||||
|
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
|
||||||
|
<CodeContractsEnumObligations>False</CodeContractsEnumObligations>
|
||||||
|
<CodeContractsPointerObligations>False</CodeContractsPointerObligations>
|
||||||
|
<CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
|
||||||
|
<CodeContractsInferRequires>False</CodeContractsInferRequires>
|
||||||
|
<CodeContractsInferEnsures>False</CodeContractsInferEnsures>
|
||||||
|
<CodeContractsInferObjectInvariants>False</CodeContractsInferObjectInvariants>
|
||||||
|
<CodeContractsSuggestAssumptions>False</CodeContractsSuggestAssumptions>
|
||||||
|
<CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
|
||||||
|
<CodeContractsSuggestEnsures>False</CodeContractsSuggestEnsures>
|
||||||
|
<CodeContractsSuggestObjectInvariants>False</CodeContractsSuggestObjectInvariants>
|
||||||
|
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
|
||||||
|
<CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
|
||||||
|
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
|
||||||
|
<CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
|
||||||
|
<CodeContractsCustomRewriterAssembly />
|
||||||
|
<CodeContractsCustomRewriterClass />
|
||||||
|
<CodeContractsLibPaths />
|
||||||
|
<CodeContractsExtraRewriteOptions />
|
||||||
|
<CodeContractsExtraAnalysisOptions />
|
||||||
|
<CodeContractsBaseLineFile />
|
||||||
|
<CodeContractsCacheAnalysisResults>False</CodeContractsCacheAnalysisResults>
|
||||||
|
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
|
||||||
|
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
|
||||||
|
<CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
|
<OutputPath>bin35\external\x64\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\x64\external_64\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>..\release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
|
||||||
|
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
|
||||||
|
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
|
||||||
|
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
|
||||||
|
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
|
||||||
|
<CodeContractsRunCodeAnalysis>True</CodeContractsRunCodeAnalysis>
|
||||||
|
<CodeContractsNonNullObligations>True</CodeContractsNonNullObligations>
|
||||||
|
<CodeContractsBoundsObligations>True</CodeContractsBoundsObligations>
|
||||||
|
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
|
||||||
|
<CodeContractsEnumObligations>False</CodeContractsEnumObligations>
|
||||||
|
<CodeContractsPointerObligations>False</CodeContractsPointerObligations>
|
||||||
|
<CodeContractsRedundantAssumptions>True</CodeContractsRedundantAssumptions>
|
||||||
|
<CodeContractsInferRequires>True</CodeContractsInferRequires>
|
||||||
|
<CodeContractsInferEnsures>False</CodeContractsInferEnsures>
|
||||||
|
<CodeContractsInferObjectInvariants>False</CodeContractsInferObjectInvariants>
|
||||||
|
<CodeContractsSuggestAssumptions>False</CodeContractsSuggestAssumptions>
|
||||||
|
<CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
|
||||||
|
<CodeContractsSuggestEnsures>False</CodeContractsSuggestEnsures>
|
||||||
|
<CodeContractsSuggestObjectInvariants>False</CodeContractsSuggestObjectInvariants>
|
||||||
|
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
|
||||||
|
<CodeContractsShowSquigglies>True</CodeContractsShowSquigglies>
|
||||||
|
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
|
||||||
|
<CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
|
||||||
|
<CodeContractsCustomRewriterAssembly />
|
||||||
|
<CodeContractsCustomRewriterClass />
|
||||||
|
<CodeContractsLibPaths />
|
||||||
|
<CodeContractsExtraRewriteOptions />
|
||||||
|
<CodeContractsExtraAnalysisOptions>-repro</CodeContractsExtraAnalysisOptions>
|
||||||
|
<CodeContractsBaseLineFile />
|
||||||
|
<CodeContractsCacheAnalysisResults>True</CodeContractsCacheAnalysisResults>
|
||||||
|
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
|
||||||
|
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
|
||||||
|
<CodeContractsAnalysisWarningLevel>2</CodeContractsAnalysisWarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'external|x64'">
|
||||||
|
<OutputPath>bin35\external\x64</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\external\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>bin\Release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'external_64|AnyCPU'">
|
||||||
|
<OutputPath>bin35\external_64\x64</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\x64\external_64\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<DefineConstants>FRAMEWORK_LT_4</DefineConstants>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>bin\Release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'external_64|x64'">
|
||||||
|
<OutputPath>bin35\external_64\x64</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\x64\external_64\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>bin\Release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||||
|
<CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
|
||||||
|
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
|
||||||
|
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
|
||||||
|
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
|
||||||
|
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
|
||||||
|
<CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
|
||||||
|
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations>
|
||||||
|
<CodeContractsBoundsObligations>False</CodeContractsBoundsObligations>
|
||||||
|
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations>
|
||||||
|
<CodeContractsEnumObligations>False</CodeContractsEnumObligations>
|
||||||
|
<CodeContractsPointerObligations>False</CodeContractsPointerObligations>
|
||||||
|
<CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions>
|
||||||
|
<CodeContractsInferRequires>False</CodeContractsInferRequires>
|
||||||
|
<CodeContractsInferEnsures>False</CodeContractsInferEnsures>
|
||||||
|
<CodeContractsInferObjectInvariants>False</CodeContractsInferObjectInvariants>
|
||||||
|
<CodeContractsSuggestAssumptions>False</CodeContractsSuggestAssumptions>
|
||||||
|
<CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
|
||||||
|
<CodeContractsSuggestEnsures>False</CodeContractsSuggestEnsures>
|
||||||
|
<CodeContractsSuggestObjectInvariants>False</CodeContractsSuggestObjectInvariants>
|
||||||
|
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
|
||||||
|
<CodeContractsShowSquigglies>False</CodeContractsShowSquigglies>
|
||||||
|
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
|
||||||
|
<CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
|
||||||
|
<CodeContractsCustomRewriterAssembly />
|
||||||
|
<CodeContractsCustomRewriterClass />
|
||||||
|
<CodeContractsLibPaths />
|
||||||
|
<CodeContractsExtraRewriteOptions />
|
||||||
|
<CodeContractsExtraAnalysisOptions />
|
||||||
|
<CodeContractsBaseLineFile />
|
||||||
|
<CodeContractsCacheAnalysisResults>False</CodeContractsCacheAnalysisResults>
|
||||||
|
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
|
||||||
|
<CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly>
|
||||||
|
<CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
|
||||||
|
<DefineConstants>FRAMEWORK_LT_4</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<AssemblyOriginatorKeyFile>z3.snk</AssemblyOriginatorKeyFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_delaysign|AnyCPU'">
|
||||||
|
<OutputPath>bin35\Release_delaysign\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\Release_delaysign\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>..\release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
<DefineConstants>DELAYSIGN</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_delaysign|x64'">
|
||||||
|
<OutputPath>bin\x64\Release_delaysign\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\x64\external_64\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>..\release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=736440c9b414ea16, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\..\..\Program Files\Microsoft\Contracts\Contracts\v3.5\Microsoft.Contracts.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="ApplyResult.cs" />
|
||||||
|
<Compile Include="AST.cs" />
|
||||||
|
<Compile Include="ASTMap.cs" />
|
||||||
|
<Compile Include="ASTVector.cs" />
|
||||||
|
<Compile Include="Constructor.cs" />
|
||||||
|
<Compile Include="DecRefQueue.cs" />
|
||||||
|
<Compile Include="Enumerations.cs" />
|
||||||
|
<Compile Include="Expr.cs" />
|
||||||
|
<Compile Include="Fixedpoint.cs" />
|
||||||
|
<Compile Include="FuncDecl.cs" />
|
||||||
|
<Compile Include="FuncInterp.cs" />
|
||||||
|
<Compile Include="Goal.cs" />
|
||||||
|
<Compile Include="Model.cs" />
|
||||||
|
<Compile Include="Numeral.cs" />
|
||||||
|
<Compile Include="Params.cs" />
|
||||||
|
<Compile Include="Pattern.cs" />
|
||||||
|
<Compile Include="Statistics.cs" />
|
||||||
|
<Compile Include="Status.cs" />
|
||||||
|
<Compile Include="Context.cs" />
|
||||||
|
<Compile Include="Probe.cs" />
|
||||||
|
<Compile Include="Solver.cs" />
|
||||||
|
<Compile Include="Tactic.cs" />
|
||||||
|
<Compile Include="Z3Exception.cs" />
|
||||||
|
<Compile Include="Log.cs" />
|
||||||
|
<Compile Include="Native.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Quantifier.cs" />
|
||||||
|
<Compile Include="Sort.cs" />
|
||||||
|
<Compile Include="Symbol.cs" />
|
||||||
|
<Compile Include="Util.cs" />
|
||||||
|
<Compile Include="Version.cs" />
|
||||||
|
<Compile Include="Z3Object.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<WCFMetadata Include="Service References\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="z3.snk" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
318
Microsoft.Z3/Model.cs
Normal file
318
Microsoft.Z3/Model.cs
Normal file
|
@ -0,0 +1,318 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Model.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Models
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-21
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A Model contains interpretations (assignments) of constants and functions.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Model : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the interpretation (the assignment) of <paramref name="a"/> in the model.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="a">A Constant</param>
|
||||||
|
/// <returns>An expression if the constant has an interpretation in the model, null otherwise.</returns>
|
||||||
|
public Expr ConstInterp(Expr a)
|
||||||
|
{
|
||||||
|
Contract.Requires(a != null);
|
||||||
|
|
||||||
|
Context.CheckContextMatch(a);
|
||||||
|
return ConstInterp(a.FuncDecl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the interpretation (the assignment) of <paramref name="f"/> in the model.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="f">A function declaration of zero arity</param>
|
||||||
|
/// <returns>An expression if the function has an interpretation in the model, null otherwise.</returns>
|
||||||
|
public Expr ConstInterp(FuncDecl f)
|
||||||
|
{
|
||||||
|
Contract.Requires(f != null);
|
||||||
|
|
||||||
|
Context.CheckContextMatch(f);
|
||||||
|
if (f.Arity != 0 ||
|
||||||
|
Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_range(Context.nCtx, f.NativeObject)) == (uint)Z3_sort_kind.Z3_ARRAY_SORT)
|
||||||
|
throw new Z3Exception("Non-zero arity functions and arrays have FunctionInterpretations as a model. Use FuncInterp.");
|
||||||
|
|
||||||
|
IntPtr n = Native.Z3_model_get_const_interp(Context.nCtx, NativeObject, f.NativeObject);
|
||||||
|
if (n == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
return Expr.Create(Context, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the interpretation (the assignment) of a non-constant <paramref name="f"/> in the model.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="f">A function declaration of non-zero arity</param>
|
||||||
|
/// <returns>A FunctionInterpretation if the function has an interpretation in the model, null otherwise.</returns>
|
||||||
|
public FuncInterp FuncInterp(FuncDecl f)
|
||||||
|
{
|
||||||
|
Contract.Requires(f != null);
|
||||||
|
|
||||||
|
Context.CheckContextMatch(f);
|
||||||
|
|
||||||
|
Z3_sort_kind sk = (Z3_sort_kind)Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_range(Context.nCtx, f.NativeObject));
|
||||||
|
|
||||||
|
if (f.Arity == 0)
|
||||||
|
{
|
||||||
|
IntPtr n = Native.Z3_model_get_const_interp(Context.nCtx, NativeObject, f.NativeObject);
|
||||||
|
|
||||||
|
if (sk == Z3_sort_kind.Z3_ARRAY_SORT)
|
||||||
|
{
|
||||||
|
if (n == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Native.Z3_is_as_array(Context.nCtx, n) == 0)
|
||||||
|
throw new Z3Exception("Argument was not an array constant");
|
||||||
|
IntPtr fd = Native.Z3_get_as_array_func_decl(Context.nCtx, n);
|
||||||
|
return FuncInterp(new FuncDecl(Context, fd));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Z3Exception("Constant functions do not have a function interpretation; use ConstInterp");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IntPtr n = Native.Z3_model_get_func_interp(Context.nCtx, NativeObject, f.NativeObject);
|
||||||
|
if (n == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
return new FuncInterp(Context, n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of constants that have an interpretation in the model.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumConsts
|
||||||
|
{
|
||||||
|
get { return Native.Z3_model_get_num_consts(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The function declarations of the constants in the model.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl[] ConstDecls
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl[]>() != null);
|
||||||
|
|
||||||
|
uint n = NumConsts;
|
||||||
|
FuncDecl[] res = new FuncDecl[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = new FuncDecl(Context, Native.Z3_model_get_const_decl(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of function interpretations in the model.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumFuncs
|
||||||
|
{
|
||||||
|
get { return Native.Z3_model_get_num_funcs(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The function declarations of the function interpretations in the model.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl[] FuncDecls
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl[]>() != null);
|
||||||
|
|
||||||
|
uint n = NumFuncs;
|
||||||
|
FuncDecl[] res = new FuncDecl[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = new FuncDecl(Context, Native.Z3_model_get_func_decl(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All symbols that have an interpretation in the model.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl[] Decls
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl[]>() != null);
|
||||||
|
|
||||||
|
var nFuncs = NumFuncs;
|
||||||
|
var nConsts = NumConsts;
|
||||||
|
uint n = nFuncs + nConsts;
|
||||||
|
FuncDecl[] res = new FuncDecl[n];
|
||||||
|
for (uint i = 0; i < nConsts; i++)
|
||||||
|
res[i] = new FuncDecl(Context, Native.Z3_model_get_const_decl(Context.nCtx, NativeObject, i));
|
||||||
|
for (uint i = 0; i < nFuncs; i++)
|
||||||
|
res[nConsts + i] = new FuncDecl(Context, Native.Z3_model_get_func_decl(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A ModelEvaluationFailedException is thrown when an expression cannot be evaluated by the model.
|
||||||
|
/// </summary>
|
||||||
|
public class ModelEvaluationFailedException : Z3Exception
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An exception that is thrown when model evaluation fails.
|
||||||
|
/// </summary>
|
||||||
|
public ModelEvaluationFailedException() : base() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Evaluates the expression <paramref name="t"/> in the current model.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This function may fail if <paramref name="t"/> contains quantifiers,
|
||||||
|
/// is partial (MODEL_PARTIAL enabled), or if <paramref name="t"/> is not well-sorted.
|
||||||
|
/// In this case a <c>ModelEvaluationFailedException</c> is thrown.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="t">An expression</param>
|
||||||
|
/// <param name="completion">
|
||||||
|
/// When this flag is enabled, a model value will be assigned to any constant
|
||||||
|
/// or function that does not have an interpretation in the model.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>The evaluation of <paramref name="t"/> in the model.</returns>
|
||||||
|
public Expr Eval(Expr t, bool completion = false)
|
||||||
|
{
|
||||||
|
Contract.Requires(t != null);
|
||||||
|
Contract.Ensures(Contract.Result<Expr>() != null);
|
||||||
|
|
||||||
|
IntPtr v = IntPtr.Zero;
|
||||||
|
if (Native.Z3_model_eval(Context.nCtx, NativeObject, t.NativeObject, (completion) ? 1 : 0, ref v) == 0)
|
||||||
|
throw new ModelEvaluationFailedException();
|
||||||
|
else
|
||||||
|
return Expr.Create(Context, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Alias for <c>Eval</c>.
|
||||||
|
/// </summary>
|
||||||
|
public Expr Evaluate(Expr t, bool completion = false)
|
||||||
|
{
|
||||||
|
Contract.Requires(t != null);
|
||||||
|
Contract.Ensures(Contract.Result<Expr>() != null);
|
||||||
|
|
||||||
|
return Eval(t, completion);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of uninterpreted sorts that the model has an interpretation for.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumSorts { get { return Native.Z3_model_get_num_sorts(Context.nCtx, NativeObject); } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The uninterpreted sorts that the model has an interpretation for.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Z3 also provides an intepretation for uninterpreted sorts used in a formula.
|
||||||
|
/// The interpretation for a sort is a finite set of distinct values. We say this finite set is
|
||||||
|
/// the "universe" of the sort.
|
||||||
|
/// </remarks>
|
||||||
|
/// <seealso cref="NumSorts"/>
|
||||||
|
/// <seealso cref="SortUniverse"/>
|
||||||
|
public Sort[] Sorts
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Sort[]>() != null);
|
||||||
|
|
||||||
|
uint n = NumSorts;
|
||||||
|
Sort[] res = new Sort[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = Sort.Create(Context, Native.Z3_model_get_sort(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The finite set of distinct values that represent the interpretation for sort <paramref name="s"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref="Sorts"/>
|
||||||
|
/// <param name="s">An uninterpreted sort</param>
|
||||||
|
/// <returns>An array of expressions, where each is an element of the universe of <paramref name="s"/></returns>
|
||||||
|
public Expr[] SortUniverse(Sort s)
|
||||||
|
{
|
||||||
|
Contract.Requires(s != null);
|
||||||
|
Contract.Ensures(Contract.Result<Expr[]>() != null);
|
||||||
|
|
||||||
|
ASTVector nUniv = new ASTVector(Context, Native.Z3_model_get_sort_universe(Context.nCtx, NativeObject, s.NativeObject));
|
||||||
|
uint n = nUniv.Size;
|
||||||
|
Expr[] res = new Expr[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = Expr.Create(Context, nUniv[i].NativeObject);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Conversion of models to strings.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A string representation of the model.</returns>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_model_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal Model(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_model_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_model_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Model_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Model_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
5210
Microsoft.Z3/Native.cs
Normal file
5210
Microsoft.Z3/Native.cs
Normal file
File diff suppressed because it is too large
Load diff
344
Microsoft.Z3/Numeral.cs
Normal file
344
Microsoft.Z3/Numeral.cs
Normal file
|
@ -0,0 +1,344 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Numeral.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Numerals
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-20
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
#if !FRAMEWORK_LT_4
|
||||||
|
using System.Numerics;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Integer Numerals
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class IntNum : IntExpr
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal IntNum(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the 64-bit unsigned integer value.
|
||||||
|
/// </summary>
|
||||||
|
public UInt64 UInt64
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
UInt64 res = 0;
|
||||||
|
if (Native.Z3_get_numeral_uint64(Context.nCtx, NativeObject, ref res) == 0)
|
||||||
|
throw new Z3Exception("Numeral is not a 64 bit unsigned");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the int value.
|
||||||
|
/// </summary>
|
||||||
|
public int Int
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
if (Native.Z3_get_numeral_int(Context.nCtx, NativeObject, ref res) == 0)
|
||||||
|
throw new Z3Exception("Numeral is not an int");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the 64-bit int value.
|
||||||
|
/// </summary>
|
||||||
|
public Int64 Int64
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Int64 res = 0;
|
||||||
|
if (Native.Z3_get_numeral_int64(Context.nCtx, NativeObject, ref res) == 0)
|
||||||
|
throw new Z3Exception("Numeral is not an int64");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the int value.
|
||||||
|
/// </summary>
|
||||||
|
public uint UInt
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
uint res = 0;
|
||||||
|
if (Native.Z3_get_numeral_uint(Context.nCtx, NativeObject, ref res) == 0)
|
||||||
|
throw new Z3Exception("Numeral is not a uint");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !FRAMEWORK_LT_4
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the BigInteger value.
|
||||||
|
/// </summary>
|
||||||
|
public BigInteger BigInteger
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return BigInteger.Parse(this.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string representation of the numeral.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_get_numeral_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rational Numerals
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class RatNum : RealExpr
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The numerator of a rational numeral.
|
||||||
|
/// </summary>
|
||||||
|
public IntNum Numerator
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<IntNum>() != null);
|
||||||
|
|
||||||
|
return new IntNum(Context, Native.Z3_get_numerator(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The denominator of a rational numeral.
|
||||||
|
/// </summary>
|
||||||
|
public IntNum Denominator
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<IntNum>() != null);
|
||||||
|
|
||||||
|
return new IntNum(Context, Native.Z3_get_denominator(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !FRAMEWORK_LT_4
|
||||||
|
/// <summary>
|
||||||
|
/// Converts the numerator of the rational to a BigInteger
|
||||||
|
/// </summary>
|
||||||
|
public BigInteger BigIntNumerator
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
IntNum n = Numerator;
|
||||||
|
return BigInteger.Parse(n.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts the denominator of the rational to a BigInteger
|
||||||
|
/// </summary>
|
||||||
|
public BigInteger BigIntDenominator
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
IntNum n = Denominator;
|
||||||
|
return BigInteger.Parse(n.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string representation in decimal notation.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The result has at most <paramref name="precision"/> decimal places.</remarks>
|
||||||
|
public string ToDecimalString(uint precision)
|
||||||
|
{
|
||||||
|
return Native.Z3_get_numeral_decimal_string(Context.nCtx, NativeObject, precision);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string representation of the numeral.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_get_numeral_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal RatNum(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bit-vector numerals
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class BitVecNum : BitVecExpr
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the 64-bit unsigned integer value.
|
||||||
|
/// </summary>
|
||||||
|
public UInt64 UInt64
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
UInt64 res = 0;
|
||||||
|
if (Native.Z3_get_numeral_uint64(Context.nCtx, NativeObject, ref res) == 0)
|
||||||
|
throw new Z3Exception("Numeral is not a 64 bit unsigned");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the int value.
|
||||||
|
/// </summary>
|
||||||
|
public int Int
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
if (Native.Z3_get_numeral_int(Context.nCtx, NativeObject, ref res) == 0)
|
||||||
|
throw new Z3Exception("Numeral is not an int");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the 64-bit int value.
|
||||||
|
/// </summary>
|
||||||
|
public Int64 Int64
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Int64 res = 0;
|
||||||
|
if (Native.Z3_get_numeral_int64(Context.nCtx, NativeObject, ref res) == 0)
|
||||||
|
throw new Z3Exception("Numeral is not an int64");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the int value.
|
||||||
|
/// </summary>
|
||||||
|
public uint UInt
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
uint res = 0;
|
||||||
|
if (Native.Z3_get_numeral_uint(Context.nCtx, NativeObject, ref res) == 0)
|
||||||
|
throw new Z3Exception("Numeral is not a uint");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !FRAMEWORK_LT_4
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the BigInteger value.
|
||||||
|
/// </summary>
|
||||||
|
public BigInteger BigInteger
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return BigInteger.Parse(this.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string representation of the numeral.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_get_numeral_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal BitVecNum(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Algebraic numbers
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class AlgebraicNum : ArithExpr
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Return a upper bound for a given real algebraic number.
|
||||||
|
/// The interval isolating the number is smaller than 1/10^<paramref name="precision"/>.
|
||||||
|
/// <seealso cref="Expr.IsAlgebraicNumber"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="precision">the precision of the result</param>
|
||||||
|
/// <returns>A numeral Expr of sort Real</returns>
|
||||||
|
public RatNum ToUpper(uint precision)
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<RatNum>() != null);
|
||||||
|
|
||||||
|
return new RatNum(Context, Native.Z3_get_algebraic_number_upper(Context.nCtx, NativeObject, precision));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return a lower bound for the given real algebraic number.
|
||||||
|
/// The interval isolating the number is smaller than 1/10^<paramref name="precision"/>.
|
||||||
|
/// <seealso cref="Expr.IsAlgebraicNumber"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="precision"></param>
|
||||||
|
/// <returns>A numeral Expr of sort Real</returns>
|
||||||
|
public RatNum ToLower(uint precision)
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<RatNum>() != null);
|
||||||
|
|
||||||
|
return new RatNum(Context, Native.Z3_get_algebraic_number_lower(Context.nCtx, NativeObject, precision));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string representation in decimal notation.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The result has at most <paramref name="precision"/> decimal places.</remarks>
|
||||||
|
public string ToDecimal(uint precision)
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<string>() != null);
|
||||||
|
|
||||||
|
return Native.Z3_get_numeral_decimal_string(Context.nCtx, NativeObject, precision);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal AlgebraicNum(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
98
Microsoft.Z3/ParamDescrs.cs
Normal file
98
Microsoft.Z3/ParamDescrs.cs
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Parameter.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Parameter Descriptions
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-20
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A ParameterSet represents a configuration in the form of Symbol/value pairs.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class ParamDescrs : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// validate a set of parameters.
|
||||||
|
/// </summary>
|
||||||
|
public void Validate(Params p)
|
||||||
|
{
|
||||||
|
Contract.Requires(p != null);
|
||||||
|
Native.Z3_params_validate(Context.nCtx, p.NativeObject, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve kind of parameter.
|
||||||
|
/// </summary>
|
||||||
|
public Z3_param_kind GetKind(Symbol name)
|
||||||
|
{
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
return (Z3_param_kind)Native.Z3_param_descrs_get_kind(Context.nCtx, NativeObject, name.NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve all names of parameters.
|
||||||
|
/// </summary>
|
||||||
|
public Symbol[] Names
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
uint sz = Native.Z3_param_descrs_size(Context.nCtx, NativeObject);
|
||||||
|
Symbol[] names = new Symbol[sz];
|
||||||
|
for (uint i = 0; i < sz; ++i) {
|
||||||
|
names[i] = Symbol.Create(Context, Native.Z3_param_descrs_get_name(Context.nCtx, NativeObject, i));
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal ParamDescrs(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_param_descrs_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_param_descrs_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.ParamDescrs_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.ParamDescrs_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
147
Microsoft.Z3/Params.cs
Normal file
147
Microsoft.Z3/Params.cs
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Parameter.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Parameters
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-20
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A ParameterSet represents a configuration in the form of Symbol/value pairs.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Params : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a parameter setting.
|
||||||
|
/// </summary>
|
||||||
|
public void Add(Symbol name, bool value)
|
||||||
|
{
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
|
||||||
|
Native.Z3_params_set_bool(Context.nCtx, NativeObject, name.NativeObject, (value) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a parameter setting.
|
||||||
|
/// </summary>
|
||||||
|
public void Add(Symbol name, uint value)
|
||||||
|
{
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
|
||||||
|
Native.Z3_params_set_uint(Context.nCtx, NativeObject, name.NativeObject, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a parameter setting.
|
||||||
|
/// </summary>
|
||||||
|
public void Add(Symbol name, double value)
|
||||||
|
{
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
|
||||||
|
Native.Z3_params_set_double(Context.nCtx, NativeObject, name.NativeObject, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a parameter setting.
|
||||||
|
/// </summary>
|
||||||
|
public void Add(Symbol name, Symbol value)
|
||||||
|
{
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
Contract.Requires(value != null);
|
||||||
|
|
||||||
|
Native.Z3_params_set_symbol(Context.nCtx, NativeObject, name.NativeObject, value.NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a parameter setting.
|
||||||
|
/// </summary>
|
||||||
|
public void Add(string name, bool value)
|
||||||
|
{
|
||||||
|
Native.Z3_params_set_bool(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, (value) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a parameter setting.
|
||||||
|
/// </summary>
|
||||||
|
public void Add(string name, uint value)
|
||||||
|
{
|
||||||
|
Native.Z3_params_set_uint(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a parameter setting.
|
||||||
|
/// </summary>
|
||||||
|
public void Add(string name, double value)
|
||||||
|
{
|
||||||
|
Native.Z3_params_set_double(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a parameter setting.
|
||||||
|
/// </summary>
|
||||||
|
public void Add(string name, Symbol value)
|
||||||
|
{
|
||||||
|
Contract.Requires(value != null);
|
||||||
|
|
||||||
|
Native.Z3_params_set_symbol(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, value.NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the parameter set.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_params_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal Params(Context ctx)
|
||||||
|
: base(ctx, Native.Z3_mk_params(ctx.nCtx))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_params_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_params_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Params_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Params_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
75
Microsoft.Z3/Pattern.cs
Normal file
75
Microsoft.Z3/Pattern.cs
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Pattern.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Patterns
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-16
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Patterns comprise a list of terms. The list should be
|
||||||
|
/// non-empty. If the list comprises of more than one term, it is
|
||||||
|
/// also called a multi-pattern.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Pattern : AST
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The number of terms in the pattern.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumTerms
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_pattern_num_terms(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The terms in the pattern.
|
||||||
|
/// </summary>
|
||||||
|
public Expr[] Terms
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Expr[]>() != null);
|
||||||
|
|
||||||
|
uint n = NumTerms;
|
||||||
|
Expr[] res = new Expr[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = Expr.Create(Context, Native.Z3_get_pattern(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the pattern.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_pattern_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal Pattern(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
95
Microsoft.Z3/Probe.cs
Normal file
95
Microsoft.Z3/Probe.cs
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Probe.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Probes
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-21
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Probes are used to inspect a goal (aka problem) and collect information that may be used to decide
|
||||||
|
/// which solver and/or preprocessing step will be used.
|
||||||
|
/// The complete list of probes may be obtained using the procedures <c>Context.NumProbes</c>
|
||||||
|
/// and <c>Context.ProbeNames</c>.
|
||||||
|
/// It may also be obtained using the command <c>(help-tactics)</c> in the SMT 2.0 front-end.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Probe : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Execute the probe over the goal.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A probe always produce a double value.
|
||||||
|
/// "Boolean" probes return 0.0 for false, and a value different from 0.0 for true.</returns>
|
||||||
|
public double Apply(Goal g)
|
||||||
|
{
|
||||||
|
Contract.Requires(g != null);
|
||||||
|
|
||||||
|
Context.CheckContextMatch(g);
|
||||||
|
return Native.Z3_probe_apply(Context.nCtx, NativeObject, g.NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Apply the probe to a goal.
|
||||||
|
/// </summary>
|
||||||
|
public double this[Goal g] { get {
|
||||||
|
Contract.Requires(g != null);
|
||||||
|
|
||||||
|
return Apply(g); } }
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal Probe(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
internal Probe(Context ctx, string name)
|
||||||
|
: base(ctx, Native.Z3_mk_probe(ctx.nCtx, name))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_probe_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_probe_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Probe_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Probe_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
39
Microsoft.Z3/Properties/AssemblyInfo.cs
Normal file
39
Microsoft.Z3/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.Permissions;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Z3 .NET Interface")]
|
||||||
|
[assembly: AssemblyDescription(".NET Interface to the Z3 Theorem Prover")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft Corporation")]
|
||||||
|
[assembly: AssemblyProduct("Z3")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft Corporation 2006")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("4853ed71-2078-40f4-8117-bc46646bce0e")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("4.2.0.0")]
|
||||||
|
[assembly: AssemblyVersion("4.2.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("4.2.0.0")]
|
||||||
|
|
257
Microsoft.Z3/Quantifier.cs
Normal file
257
Microsoft.Z3/Quantifier.cs
Normal file
|
@ -0,0 +1,257 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Quantifier.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Quantifiers
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-19
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Quantifier expressions.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Quantifier : BoolExpr
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the quantifier is universal.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsUniversal
|
||||||
|
{
|
||||||
|
get { return Native.Z3_is_quantifier_forall(Context.nCtx, NativeObject) != 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the quantifier is existential.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsExistential
|
||||||
|
{
|
||||||
|
get { return !IsUniversal; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The weight of the quantifier.
|
||||||
|
/// </summary>
|
||||||
|
public uint Weight
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_quantifier_weight(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of patterns.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumPatterns
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_quantifier_num_patterns(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The patterns.
|
||||||
|
/// </summary>
|
||||||
|
public Pattern[] Patterns
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Pattern[]>() != null);
|
||||||
|
|
||||||
|
uint n = NumPatterns;
|
||||||
|
Pattern[] res = new Pattern[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = new Pattern(Context, Native.Z3_get_quantifier_pattern_ast(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of no-patterns.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumNoPatterns
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_quantifier_num_no_patterns(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The no-patterns.
|
||||||
|
/// </summary>
|
||||||
|
public Pattern[] NoPatterns
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Pattern[]>() != null);
|
||||||
|
|
||||||
|
uint n = NumNoPatterns;
|
||||||
|
Pattern[] res = new Pattern[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = new Pattern(Context, Native.Z3_get_quantifier_no_pattern_ast(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of bound variables.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumBound
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_quantifier_num_bound(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The symbols for the bound variables.
|
||||||
|
/// </summary>
|
||||||
|
public Symbol[] BoundVariableNames
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Symbol[]>() != null);
|
||||||
|
|
||||||
|
uint n = NumBound;
|
||||||
|
Symbol[] res = new Symbol[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = Symbol.Create(Context, Native.Z3_get_quantifier_bound_name(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The sorts of the bound variables.
|
||||||
|
/// </summary>
|
||||||
|
public Sort[] BoundVariableSorts
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Sort[]>() != null);
|
||||||
|
|
||||||
|
uint n = NumBound;
|
||||||
|
Sort[] res = new Sort[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = Sort.Create(Context, Native.Z3_get_quantifier_bound_sort(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The body of the quantifier.
|
||||||
|
/// </summary>
|
||||||
|
public BoolExpr Body
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||||
|
|
||||||
|
return new BoolExpr(Context, Native.Z3_get_quantifier_body(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
[ContractVerification(false)] // F: Clousot ForAll decompilation gets confused below. Setting verification off until I fixed the bug
|
||||||
|
internal Quantifier(Context ctx, bool isForall, Sort[] sorts, Symbol[] names, Expr body,
|
||||||
|
uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null,
|
||||||
|
Symbol quantifierID = null, Symbol skolemID = null
|
||||||
|
)
|
||||||
|
: base(ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(sorts != null);
|
||||||
|
Contract.Requires(names != null);
|
||||||
|
Contract.Requires(body != null);
|
||||||
|
Contract.Requires(sorts.Length == names.Length);
|
||||||
|
Contract.Requires(Contract.ForAll(sorts, s => s != null));
|
||||||
|
Contract.Requires(Contract.ForAll(names, n => n != null));
|
||||||
|
Contract.Requires(patterns == null || Contract.ForAll(patterns, p => p != null));
|
||||||
|
Contract.Requires(noPatterns == null || Contract.ForAll(noPatterns, np => np != null));
|
||||||
|
|
||||||
|
Context.CheckContextMatch(patterns);
|
||||||
|
Context.CheckContextMatch(noPatterns);
|
||||||
|
Context.CheckContextMatch(sorts);
|
||||||
|
Context.CheckContextMatch(names);
|
||||||
|
Context.CheckContextMatch(body);
|
||||||
|
|
||||||
|
if (sorts.Length != names.Length)
|
||||||
|
throw new Z3Exception("Number of sorts does not match number of names");
|
||||||
|
|
||||||
|
IntPtr[] _patterns = AST.ArrayToNative(patterns);
|
||||||
|
|
||||||
|
if (noPatterns == null && quantifierID == null && skolemID == null)
|
||||||
|
{
|
||||||
|
NativeObject = Native.Z3_mk_quantifier(ctx.nCtx, (isForall) ? 1 : 0, weight,
|
||||||
|
AST.ArrayLength(patterns), AST.ArrayToNative(patterns),
|
||||||
|
AST.ArrayLength(sorts), AST.ArrayToNative(sorts),
|
||||||
|
Symbol.ArrayToNative(names),
|
||||||
|
body.NativeObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NativeObject = Native.Z3_mk_quantifier_ex(ctx.nCtx, (isForall) ? 1 : 0, weight,
|
||||||
|
AST.GetNativeObject(quantifierID), AST.GetNativeObject(skolemID),
|
||||||
|
AST.ArrayLength(patterns), AST.ArrayToNative(patterns),
|
||||||
|
AST.ArrayLength(noPatterns), AST.ArrayToNative(noPatterns),
|
||||||
|
AST.ArrayLength(sorts), AST.ArrayToNative(sorts),
|
||||||
|
Symbol.ArrayToNative(names),
|
||||||
|
body.NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ContractVerification(false)] // F: Clousot ForAll decompilation gets confused below. Setting verification off until I fixed the bug
|
||||||
|
internal Quantifier(Context ctx, bool isForall, Expr[] bound, Expr body,
|
||||||
|
uint weight = 1, Pattern[] patterns = null, Expr[] noPatterns = null,
|
||||||
|
Symbol quantifierID = null, Symbol skolemID = null
|
||||||
|
)
|
||||||
|
: base(ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(body != null);
|
||||||
|
|
||||||
|
Contract.Requires(patterns == null || Contract.ForAll(patterns, p => p != null));
|
||||||
|
Contract.Requires(noPatterns == null || Contract.ForAll(noPatterns, np => np != null));
|
||||||
|
Contract.Requires(bound == null || Contract.ForAll(bound, n => n != null));
|
||||||
|
|
||||||
|
Context.CheckContextMatch(noPatterns);
|
||||||
|
Context.CheckContextMatch(patterns);
|
||||||
|
//Context.CheckContextMatch(bound);
|
||||||
|
Context.CheckContextMatch(body);
|
||||||
|
|
||||||
|
if (noPatterns == null && quantifierID == null && skolemID == null)
|
||||||
|
{
|
||||||
|
NativeObject = Native.Z3_mk_quantifier_const(ctx.nCtx, (isForall) ? 1 : 0, weight,
|
||||||
|
AST.ArrayLength(bound), AST.ArrayToNative(bound),
|
||||||
|
AST.ArrayLength(patterns), AST.ArrayToNative(patterns),
|
||||||
|
body.NativeObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NativeObject = Native.Z3_mk_quantifier_const_ex(ctx.nCtx, (isForall) ? 1 : 0, weight,
|
||||||
|
AST.GetNativeObject(quantifierID), AST.GetNativeObject(skolemID),
|
||||||
|
AST.ArrayLength(bound), AST.ArrayToNative(bound),
|
||||||
|
AST.ArrayLength(patterns), AST.ArrayToNative(patterns),
|
||||||
|
AST.ArrayLength(noPatterns), AST.ArrayToNative(noPatterns),
|
||||||
|
body.NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
internal Quantifier(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
internal override void CheckNativeObject(IntPtr obj)
|
||||||
|
{
|
||||||
|
if ((Z3_ast_kind)Native.Z3_get_ast_kind(Context.nCtx, obj) != Z3_ast_kind.Z3_QUANTIFIER_AST)
|
||||||
|
throw new Z3Exception("Underlying object is not a quantifier");
|
||||||
|
base.CheckNativeObject(obj);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
300
Microsoft.Z3/Solver.cs
Normal file
300
Microsoft.Z3/Solver.cs
Normal file
|
@ -0,0 +1,300 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Solver.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Solvers
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-22
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Solvers.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Solver : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A string that describes all available solver parameters.
|
||||||
|
/// </summary>
|
||||||
|
public string Help
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<string>() != null);
|
||||||
|
|
||||||
|
return Native.Z3_solver_get_help(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the solver parameters.
|
||||||
|
/// </summary>
|
||||||
|
public Params Parameters
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Contract.Requires(value != null);
|
||||||
|
|
||||||
|
Context.CheckContextMatch(value);
|
||||||
|
Native.Z3_solver_set_params(Context.nCtx, NativeObject, value.NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves parameter descriptions for solver.
|
||||||
|
/// </summary>
|
||||||
|
ParamDescrs ParameterDescriptions
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new ParamDescrs(Context, Native.Z3_solver_get_param_descrs(Context.nCtx, NativeObject));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current number of backtracking points (scopes).
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref="Pop"/>
|
||||||
|
/// <seealso cref="Push"/>
|
||||||
|
public uint NumScopes
|
||||||
|
{
|
||||||
|
get { return Native.Z3_solver_get_num_scopes(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a backtracking point.
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref="Pop"/>
|
||||||
|
public void Push()
|
||||||
|
{
|
||||||
|
Native.Z3_solver_push(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Backtracks <paramref name="n"/> backtracking points.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Note that an exception is thrown if <paramref name="n"/> is not smaller than <c>NumScopes</c></remarks>
|
||||||
|
/// <seealso cref="Push"/>
|
||||||
|
public void Pop(uint n = 1)
|
||||||
|
{
|
||||||
|
Native.Z3_solver_pop(Context.nCtx, NativeObject, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the Solver.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This removes all assertions from the solver.</remarks>
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
Native.Z3_solver_reset(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Assert a constraint (or multiple) into the solver.
|
||||||
|
/// </summary>
|
||||||
|
public void Assert(params BoolExpr[] constraints)
|
||||||
|
{
|
||||||
|
Contract.Requires(constraints != null);
|
||||||
|
Contract.Requires(Contract.ForAll(constraints, c => c != null));
|
||||||
|
|
||||||
|
Context.CheckContextMatch(constraints);
|
||||||
|
foreach (BoolExpr a in constraints)
|
||||||
|
{
|
||||||
|
Native.Z3_solver_assert(Context.nCtx, NativeObject, a.NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of assertions in the solver.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumAssertions
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
ASTVector ass = new ASTVector(Context, Native.Z3_solver_get_assertions(Context.nCtx, NativeObject));
|
||||||
|
return ass.Size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The set of asserted formulas.
|
||||||
|
/// </summary>
|
||||||
|
public BoolExpr[] Assertions
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<BoolExpr[]>() != null);
|
||||||
|
|
||||||
|
ASTVector ass = new ASTVector(Context, Native.Z3_solver_get_assertions(Context.nCtx, NativeObject));
|
||||||
|
uint n = ass.Size;
|
||||||
|
BoolExpr[] res = new BoolExpr[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = new BoolExpr(Context, ass[i].NativeObject);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks whether the assertions in the solver are consistent or not.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <seealso cref="Model"/>
|
||||||
|
/// <seealso cref="UnsatCore"/>
|
||||||
|
/// <seealso cref="Proof"/>
|
||||||
|
/// </remarks>
|
||||||
|
public Status Check(params Expr[] assumptions)
|
||||||
|
{
|
||||||
|
Z3_lbool r;
|
||||||
|
if (assumptions == null)
|
||||||
|
r = (Z3_lbool)Native.Z3_solver_check(Context.nCtx, NativeObject);
|
||||||
|
else
|
||||||
|
r = (Z3_lbool)Native.Z3_solver_check_assumptions(Context.nCtx, NativeObject, (uint)assumptions.Length, AST.ArrayToNative(assumptions));
|
||||||
|
switch (r)
|
||||||
|
{
|
||||||
|
case Z3_lbool.Z3_L_TRUE: return Status.SATISFIABLE;
|
||||||
|
case Z3_lbool.Z3_L_FALSE: return Status.UNSATISFIABLE;
|
||||||
|
default: return Status.UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The model of the last <c>Check</c>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// The result is <c>null</c> if <c>Check</c> was not invoked before,
|
||||||
|
/// if its results was not <c>SATISFIABLE</c>, or if model production is not enabled.
|
||||||
|
/// </remarks>
|
||||||
|
public Model Model
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
IntPtr x = Native.Z3_solver_get_model(Context.nCtx, NativeObject);
|
||||||
|
if (x == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
return new Model(Context, x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The proof of the last <c>Check</c>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// The result is <c>null</c> if <c>Check</c> was not invoked before,
|
||||||
|
/// if its results was not <c>UNSATISFIABLE</c>, or if proof production is disabled.
|
||||||
|
/// </remarks>
|
||||||
|
public Expr Proof
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
IntPtr x = Native.Z3_solver_get_proof(Context.nCtx, NativeObject);
|
||||||
|
if (x == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
return Expr.Create(Context, x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The unsat core of the last <c>Check</c>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// The unsat core is a subset of <c>Assertions</c>
|
||||||
|
/// The result is empty if <c>Check</c> was not invoked before,
|
||||||
|
/// if its results was not <c>UNSATISFIABLE</c>, or if core production is disabled.
|
||||||
|
/// </remarks>
|
||||||
|
public Expr[] UnsatCore
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Expr[]>() != null);
|
||||||
|
|
||||||
|
ASTVector core = new ASTVector(Context, Native.Z3_solver_get_unsat_core(Context.nCtx, NativeObject));
|
||||||
|
uint n = core.Size;
|
||||||
|
Expr[] res = new Expr[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = Expr.Create(Context, core[i].NativeObject);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A brief justification of why the last call to <c>Check</c> returned <c>UNKNOWN</c>.
|
||||||
|
/// </summary>
|
||||||
|
public string ReasonUnknown
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<string>() != null);
|
||||||
|
|
||||||
|
return Native.Z3_solver_get_reason_unknown(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Solver statistics.
|
||||||
|
/// </summary>
|
||||||
|
public Statistics Statistics
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<Statistics>() != null);
|
||||||
|
|
||||||
|
return new Statistics(Context, Native.Z3_solver_get_statistics(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the solver.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_solver_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal Solver(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_solver_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_solver_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Solver_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Solver_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
745
Microsoft.Z3/Sort.cs
Normal file
745
Microsoft.Z3/Sort.cs
Normal file
|
@ -0,0 +1,745 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Sort.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Sorts
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The Sort class implements type information for ASTs.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Sort : AST
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Comparison operator.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="a">A Sort</param>
|
||||||
|
/// <param name="b">A Sort</param>
|
||||||
|
/// <returns>True if <paramref name="a"/> and <paramref name="b"/> are from the same context
|
||||||
|
/// and represent the same sort; false otherwise.</returns>
|
||||||
|
public static bool operator ==(Sort a, Sort b)
|
||||||
|
{
|
||||||
|
return Object.ReferenceEquals(a, b) ||
|
||||||
|
(!Object.ReferenceEquals(a, null) &&
|
||||||
|
!Object.ReferenceEquals(b, null) &&
|
||||||
|
a.Context == b.Context &&
|
||||||
|
Native.Z3_is_eq_sort(a.Context.nCtx, a.NativeObject, b.NativeObject) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Comparison operator.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="a">A Sort</param>
|
||||||
|
/// <param name="b">A Sort</param>
|
||||||
|
/// <returns>True if <paramref name="a"/> and <paramref name="b"/> are not from the same context
|
||||||
|
/// or represent different sorts; false otherwise.</returns>
|
||||||
|
public static bool operator !=(Sort a, Sort b)
|
||||||
|
{
|
||||||
|
return !(a == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Equality operator for objects of type Sort.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="o"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override bool Equals(object o)
|
||||||
|
{
|
||||||
|
Sort casted = o as Sort;
|
||||||
|
if (casted == null) return false;
|
||||||
|
return this == casted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hash code generation for Sorts
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A hash code</returns>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return base.GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a unique identifier for the sort.
|
||||||
|
/// </summary>
|
||||||
|
new public uint Id
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_sort_id(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The kind of the sort.
|
||||||
|
/// </summary>
|
||||||
|
public Z3_sort_kind SortKind
|
||||||
|
{
|
||||||
|
get { return (Z3_sort_kind)Native.Z3_get_sort_kind(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the sort
|
||||||
|
/// </summary>
|
||||||
|
public Symbol Name
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<Symbol>() != null);
|
||||||
|
return Symbol.Create(Context, Native.Z3_get_sort_name(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the sort.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_sort_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
/// <summary>
|
||||||
|
/// Sort constructor
|
||||||
|
/// </summary>
|
||||||
|
internal protected Sort(Context ctx) : base(ctx) { Contract.Requires(ctx != null); }
|
||||||
|
internal Sort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
internal override void CheckNativeObject(IntPtr obj)
|
||||||
|
{
|
||||||
|
if (Native.Z3_get_ast_kind(Context.nCtx, obj) != (uint)Z3_ast_kind.Z3_SORT_AST)
|
||||||
|
throw new Z3Exception("Underlying object is not a sort");
|
||||||
|
base.CheckNativeObject(obj);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
[ContractVerification(true)]
|
||||||
|
new internal static Sort Create(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Ensures(Contract.Result<Sort>() != null);
|
||||||
|
|
||||||
|
switch ((Z3_sort_kind)Native.Z3_get_sort_kind(ctx.nCtx, obj))
|
||||||
|
{
|
||||||
|
case Z3_sort_kind.Z3_ARRAY_SORT: return new ArraySort(ctx, obj);
|
||||||
|
case Z3_sort_kind.Z3_BOOL_SORT: return new BoolSort(ctx, obj);
|
||||||
|
case Z3_sort_kind.Z3_BV_SORT: return new BitVecSort(ctx, obj);
|
||||||
|
case Z3_sort_kind.Z3_DATATYPE_SORT: return new DatatypeSort(ctx, obj);
|
||||||
|
case Z3_sort_kind.Z3_INT_SORT: return new IntSort(ctx, obj);
|
||||||
|
case Z3_sort_kind.Z3_REAL_SORT: return new RealSort(ctx, obj);
|
||||||
|
case Z3_sort_kind.Z3_UNINTERPRETED_SORT: return new UninterpretedSort(ctx, obj);
|
||||||
|
case Z3_sort_kind.Z3_FINITE_DOMAIN_SORT: return new FiniteDomainSort(ctx, obj);
|
||||||
|
case Z3_sort_kind.Z3_RELATION_SORT: return new RelationSort(ctx, obj);
|
||||||
|
default:
|
||||||
|
throw new Z3Exception("Unknown sort kind");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Boolean sort.
|
||||||
|
/// </summary>
|
||||||
|
public class BoolSort : Sort
|
||||||
|
{
|
||||||
|
#region Internal
|
||||||
|
internal BoolSort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
internal BoolSort(Context ctx) : base(ctx, Native.Z3_mk_bool_sort(ctx.nCtx)) { Contract.Requires(ctx != null); }
|
||||||
|
#endregion
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An arithmetic sort, i.e., Int or Real.
|
||||||
|
/// </summary>
|
||||||
|
public class ArithSort : Sort
|
||||||
|
{
|
||||||
|
#region Internal
|
||||||
|
internal ArithSort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
#endregion
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An Integer sort
|
||||||
|
/// </summary>
|
||||||
|
public class IntSort : ArithSort
|
||||||
|
{
|
||||||
|
#region Internal
|
||||||
|
internal IntSort(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
internal IntSort(Context ctx)
|
||||||
|
: base(ctx, Native.Z3_mk_int_sort(ctx.nCtx))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A real sort
|
||||||
|
/// </summary>
|
||||||
|
public class RealSort : ArithSort
|
||||||
|
{
|
||||||
|
#region Internal
|
||||||
|
internal RealSort(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
internal RealSort(Context ctx)
|
||||||
|
: base(ctx, Native.Z3_mk_real_sort(ctx.nCtx))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bit-vector sorts.
|
||||||
|
/// </summary>
|
||||||
|
public class BitVecSort : Sort
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The size of the bit-vector sort.
|
||||||
|
/// </summary>
|
||||||
|
public uint Size
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_bv_sort_size(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal BitVecSort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
internal BitVecSort(Context ctx, uint size) : base(ctx, Native.Z3_mk_bv_sort(ctx.nCtx, size)) { Contract.Requires(ctx != null); }
|
||||||
|
#endregion
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Array sorts.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class ArraySort : Sort
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The domain of the array sort.
|
||||||
|
/// </summary>
|
||||||
|
public Sort Domain
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<Sort>() != null);
|
||||||
|
|
||||||
|
return Sort.Create(Context, Native.Z3_get_array_sort_domain(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The range of the array sort.
|
||||||
|
/// </summary>
|
||||||
|
public Sort Range
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<Sort>() != null);
|
||||||
|
|
||||||
|
return Sort.Create(Context, Native.Z3_get_array_sort_range(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal ArraySort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
internal ArraySort(Context ctx, Sort domain, Sort range)
|
||||||
|
: base(ctx, Native.Z3_mk_array_sort(ctx.nCtx, domain.NativeObject, range.NativeObject))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(domain != null);
|
||||||
|
Contract.Requires(range != null);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Datatype sorts.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class DatatypeSort : Sort
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The number of constructors of the datatype sort.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumConstructors
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_datatype_sort_num_constructors(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The constructors.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl[] Constructors
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl[]>() != null);
|
||||||
|
|
||||||
|
uint n = NumConstructors;
|
||||||
|
FuncDecl[] res = new FuncDecl[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = new FuncDecl(Context, Native.Z3_get_datatype_sort_constructor(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The recognizers.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl[] Recognizers
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl[]>() != null);
|
||||||
|
|
||||||
|
uint n = NumConstructors;
|
||||||
|
FuncDecl[] res = new FuncDecl[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = new FuncDecl(Context, Native.Z3_get_datatype_sort_recognizer(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The constructor accessors.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl[][] Accessors
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl[][]>() != null);
|
||||||
|
|
||||||
|
uint n = NumConstructors;
|
||||||
|
FuncDecl[][] res = new FuncDecl[n][];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
FuncDecl fd = new FuncDecl(Context, Native.Z3_get_datatype_sort_constructor(Context.nCtx, NativeObject, i));
|
||||||
|
uint ds = fd.DomainSize;
|
||||||
|
FuncDecl[] tmp = new FuncDecl[ds];
|
||||||
|
for (uint j = 0; j < ds; j++)
|
||||||
|
tmp[j] = new FuncDecl(Context, Native.Z3_get_datatype_sort_constructor_accessor(Context.nCtx, NativeObject, i, j));
|
||||||
|
res[i] = tmp;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal DatatypeSort(Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
|
||||||
|
|
||||||
|
internal DatatypeSort(Context ctx, Symbol name, Constructor[] constructors)
|
||||||
|
: base(ctx, Native.Z3_mk_datatype(ctx.nCtx, name.NativeObject, (uint)constructors.Length, ArrayToNative(constructors)))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
Contract.Requires(constructors != null);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Uninterpreted Sorts
|
||||||
|
/// </summary>
|
||||||
|
public class UninterpretedSort : Sort
|
||||||
|
{
|
||||||
|
#region Internal
|
||||||
|
internal UninterpretedSort(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
internal UninterpretedSort(Context ctx, Symbol s)
|
||||||
|
: base(ctx, Native.Z3_mk_uninterpreted_sort(ctx.nCtx, s.NativeObject))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(s != null);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tuple sorts.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class TupleSort : Sort
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The constructor function of the tuple.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl MkDecl
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl>() != null);
|
||||||
|
|
||||||
|
return new FuncDecl(Context, Native.Z3_get_tuple_sort_mk_decl(Context.nCtx, NativeObject)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of fields in the tuple.
|
||||||
|
/// </summary>
|
||||||
|
public uint NumFields
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_tuple_sort_num_fields(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The field declarations.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl[] FieldDecls
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl[]>() != null);
|
||||||
|
|
||||||
|
uint n = NumFields;
|
||||||
|
FuncDecl[] res = new FuncDecl[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = new FuncDecl(Context, Native.Z3_get_tuple_sort_field_decl(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal TupleSort(Context ctx, Symbol name, uint numFields, Symbol[] fieldNames, Sort[] fieldSorts)
|
||||||
|
: base(ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
|
||||||
|
IntPtr t = IntPtr.Zero;
|
||||||
|
NativeObject = Native.Z3_mk_tuple_sort(ctx.nCtx, name.NativeObject, numFields,
|
||||||
|
Symbol.ArrayToNative(fieldNames), AST.ArrayToNative(fieldSorts),
|
||||||
|
ref t, new IntPtr[numFields]);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enumeration sorts.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class EnumSort : Sort
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The function declarations of the constants in the enumeration.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl[] ConstDecls
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl[]>() != null);
|
||||||
|
|
||||||
|
return _constdecls; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The constants in the enumeration.
|
||||||
|
/// </summary>
|
||||||
|
public Expr[] Consts
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<Expr[]>() != null);
|
||||||
|
|
||||||
|
return _consts; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The test predicates for the constants in the enumeration.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl[] TesterDecls
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl[]>() != null);
|
||||||
|
|
||||||
|
return _testerdecls;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Object Invariant
|
||||||
|
|
||||||
|
[ContractInvariantMethod]
|
||||||
|
private void ObjectInvariant()
|
||||||
|
{
|
||||||
|
Contract.Invariant(this._constdecls != null);
|
||||||
|
Contract.Invariant(this._testerdecls != null);
|
||||||
|
Contract.Invariant(this._consts != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
readonly private FuncDecl[] _constdecls = null, _testerdecls = null;
|
||||||
|
readonly private Expr[] _consts = null;
|
||||||
|
|
||||||
|
internal EnumSort(Context ctx, Symbol name, Symbol[] enumNames)
|
||||||
|
: base(ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
Contract.Requires(enumNames != null);
|
||||||
|
|
||||||
|
int n = enumNames.Length;
|
||||||
|
IntPtr[] n_constdecls = new IntPtr[n];
|
||||||
|
IntPtr[] n_testers = new IntPtr[n];
|
||||||
|
NativeObject = Native.Z3_mk_enumeration_sort(ctx.nCtx, name.NativeObject, (uint)n,
|
||||||
|
Symbol.ArrayToNative(enumNames), n_constdecls, n_testers);
|
||||||
|
_constdecls = new FuncDecl[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
_constdecls[i] = new FuncDecl(ctx, n_constdecls[i]);
|
||||||
|
_testerdecls = new FuncDecl[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
_testerdecls[i] = new FuncDecl(ctx, n_testers[i]);
|
||||||
|
_consts = new Expr[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
_consts[i] = ctx.MkApp(_constdecls[i]);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List sorts.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class ListSort : Sort
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The declaration of the nil function of this list sort.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl NilDecl { get {
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl>() != null);
|
||||||
|
return nilDecl; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The empty list.
|
||||||
|
/// </summary>
|
||||||
|
public Expr Nil
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Expr>() != null);
|
||||||
|
return nilConst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The declaration of the isNil function of this list sort.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl IsNilDecl
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl>() != null);
|
||||||
|
return isNilDecl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The declaration of the cons function of this list sort.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl ConsDecl
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl>() != null);
|
||||||
|
return consDecl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The declaration of the isCons function of this list sort.
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
public FuncDecl IsConsDecl
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl>() != null);
|
||||||
|
return isConsDecl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The declaration of the head function of this list sort.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl HeadDecl
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl>() != null);
|
||||||
|
return headDecl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The declaration of the tail function of this list sort.
|
||||||
|
/// </summary>
|
||||||
|
public FuncDecl TailDecl
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<FuncDecl>() != null);
|
||||||
|
return tailDecl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Object Invariant
|
||||||
|
|
||||||
|
[ContractInvariantMethod]
|
||||||
|
private void ObjectInvariant()
|
||||||
|
{
|
||||||
|
Contract.Invariant(nilConst != null);
|
||||||
|
Contract.Invariant(nilDecl != null);
|
||||||
|
Contract.Invariant(isNilDecl != null);
|
||||||
|
Contract.Invariant(consDecl != null);
|
||||||
|
Contract.Invariant(isConsDecl != null);
|
||||||
|
Contract.Invariant(headDecl != null);
|
||||||
|
Contract.Invariant(tailDecl != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
readonly private FuncDecl nilDecl, isNilDecl, consDecl, isConsDecl, headDecl, tailDecl;
|
||||||
|
readonly private Expr nilConst;
|
||||||
|
|
||||||
|
internal ListSort(Context ctx, Symbol name, Sort elemSort)
|
||||||
|
: base(ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
Contract.Requires(elemSort != null);
|
||||||
|
|
||||||
|
IntPtr inil = IntPtr.Zero,
|
||||||
|
iisnil = IntPtr.Zero,
|
||||||
|
icons = IntPtr.Zero,
|
||||||
|
iiscons = IntPtr.Zero,
|
||||||
|
ihead = IntPtr.Zero,
|
||||||
|
itail = IntPtr.Zero;
|
||||||
|
|
||||||
|
NativeObject = Native.Z3_mk_list_sort(ctx.nCtx, name.NativeObject, elemSort.NativeObject,
|
||||||
|
ref inil, ref iisnil, ref icons, ref iiscons, ref ihead, ref itail);
|
||||||
|
nilDecl = new FuncDecl(ctx, inil);
|
||||||
|
isNilDecl = new FuncDecl(ctx, iisnil);
|
||||||
|
consDecl = new FuncDecl(ctx, icons);
|
||||||
|
isConsDecl = new FuncDecl(ctx, iiscons);
|
||||||
|
headDecl = new FuncDecl(ctx, ihead);
|
||||||
|
tailDecl = new FuncDecl(ctx, itail);
|
||||||
|
nilConst = ctx.MkConst(nilDecl);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Relation sorts.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class RelationSort : Sort
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The arity of the relation sort.
|
||||||
|
/// </summary>
|
||||||
|
public uint Arity
|
||||||
|
{
|
||||||
|
get { return Native.Z3_get_relation_arity(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The sorts of the columns of the relation sort.
|
||||||
|
/// </summary>
|
||||||
|
public Sort[] ColumnSorts
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Sort[]>() != null);
|
||||||
|
|
||||||
|
if (m_columnSorts != null)
|
||||||
|
return m_columnSorts;
|
||||||
|
|
||||||
|
uint n = Arity;
|
||||||
|
Sort[] res = new Sort[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = Sort.Create(Context, Native.Z3_get_relation_column(Context.nCtx, NativeObject, i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
private Sort[] m_columnSorts = null;
|
||||||
|
|
||||||
|
internal RelationSort(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finite domain sorts.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class FiniteDomainSort : Sort
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The size of the finite domain sort.
|
||||||
|
/// </summary>
|
||||||
|
public ulong Size
|
||||||
|
{
|
||||||
|
get { ulong res = 0; Native.Z3_get_finite_domain_sort_size(Context.nCtx, NativeObject, ref res); return res; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal FiniteDomainSort(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
internal FiniteDomainSort(Context ctx, Symbol name, ulong size)
|
||||||
|
: base(ctx, Native.Z3_mk_finite_domain_sort(ctx.nCtx, name.NativeObject, size))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(name != null);
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set sorts.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class SetSort : Sort
|
||||||
|
{
|
||||||
|
#region Internal
|
||||||
|
internal SetSort(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
internal SetSort(Context ctx, Sort ty)
|
||||||
|
: base(ctx, Native.Z3_mk_set_sort(ctx.nCtx, ty.NativeObject))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Requires(ty != null);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
206
Microsoft.Z3/Statistics.cs
Normal file
206
Microsoft.Z3/Statistics.cs
Normal file
|
@ -0,0 +1,206 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Statistics.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Statistics
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-22
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Objects of this class track statistical information about solvers.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Statistics : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Statistical data is organized into pairs of [Key, Entry], where every
|
||||||
|
/// Entry is either a <c>DoubleEntry</c> or a <c>UIntEntry</c>
|
||||||
|
/// </summary>
|
||||||
|
public class Entry
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The key of the entry.
|
||||||
|
/// </summary>
|
||||||
|
readonly public string Key;
|
||||||
|
/// <summary>
|
||||||
|
/// The uint-value of the entry.
|
||||||
|
/// </summary>
|
||||||
|
public uint UIntValue { get { return m_uint; } }
|
||||||
|
/// <summary>
|
||||||
|
/// The double-value of the entry.
|
||||||
|
/// </summary>
|
||||||
|
public double DoubleValue { get { return m_double; } }
|
||||||
|
/// <summary>
|
||||||
|
/// True if the entry is uint-valued.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsUInt { get { return m_is_uint; } }
|
||||||
|
/// <summary>
|
||||||
|
/// True if the entry is double-valued.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDouble { get { return m_is_double; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The string representation of the the entry's value.
|
||||||
|
/// </summary>
|
||||||
|
public string Value
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<string>() != null);
|
||||||
|
|
||||||
|
if (IsUInt)
|
||||||
|
return m_uint.ToString();
|
||||||
|
else if (IsDouble)
|
||||||
|
return m_double.ToString();
|
||||||
|
else
|
||||||
|
throw new Z3Exception("Unknown statistical entry type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The string representation of the Entry.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Key + ": " + Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
readonly private bool m_is_uint = false;
|
||||||
|
readonly private bool m_is_double = false;
|
||||||
|
readonly private uint m_uint = 0;
|
||||||
|
readonly private double m_double = 0.0;
|
||||||
|
internal Entry(string k, uint v) { Key = k; m_is_uint = true; m_uint = v; }
|
||||||
|
internal Entry(string k, double v) { Key = k; m_is_double = true; m_double = v; }
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the statistical data.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Native.Z3_stats_to_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of statistical data.
|
||||||
|
/// </summary>
|
||||||
|
public uint Size
|
||||||
|
{
|
||||||
|
get { return Native.Z3_stats_size(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The data entries.
|
||||||
|
/// </summary>
|
||||||
|
public Entry[] Entries
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Entry[]>() != null);
|
||||||
|
Contract.Ensures(Contract.Result<Entry[]>().Length == this.Size);
|
||||||
|
Contract.Ensures(Contract.ForAll(0, Contract.Result<Entry[]>().Length, j => Contract.Result<Entry[]>()[j] != null));
|
||||||
|
|
||||||
|
uint n = Size;
|
||||||
|
Entry[] res = new Entry[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
Entry e;
|
||||||
|
string k = Native.Z3_stats_get_key(Context.nCtx, NativeObject, i);
|
||||||
|
if (Native.Z3_stats_is_uint(Context.nCtx, NativeObject, i) != 0)
|
||||||
|
e = new Entry(k, Native.Z3_stats_get_uint_value(Context.nCtx, NativeObject, i));
|
||||||
|
else if (Native.Z3_stats_is_double(Context.nCtx, NativeObject, i) != 0)
|
||||||
|
e = new Entry(k, Native.Z3_stats_get_double_value(Context.nCtx, NativeObject, i));
|
||||||
|
else
|
||||||
|
throw new Z3Exception("Unknown data entry value");
|
||||||
|
res[i] = e;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The statistical counters.
|
||||||
|
/// </summary>
|
||||||
|
public string[] Keys
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<string[]>() != null);
|
||||||
|
|
||||||
|
uint n = Size;
|
||||||
|
string[] res = new string[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = Native.Z3_stats_get_key(Context.nCtx, NativeObject, i);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The value of a particular statistical counter.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Returns null if the key is unknown.</remarks>
|
||||||
|
public Entry this[string key]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
uint n = Size;
|
||||||
|
Entry[] es = Entries;
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
if (es[i].Key == key)
|
||||||
|
return es[i];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal Statistics(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_stats_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_stats_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Statistics_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Statistics_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
45
Microsoft.Z3/Status.cs
Normal file
45
Microsoft.Z3/Status.cs
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Status.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Status
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Status values.
|
||||||
|
/// </summary>
|
||||||
|
public enum Status
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Used to signify an unsatisfiable status.
|
||||||
|
/// </summary>
|
||||||
|
UNSATISFIABLE = -1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to signify an unknown status.
|
||||||
|
/// </summary>
|
||||||
|
UNKNOWN = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to signify a satisfiable status.
|
||||||
|
/// </summary>
|
||||||
|
SATISFIABLE = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
181
Microsoft.Z3/Symbol.cs
Normal file
181
Microsoft.Z3/Symbol.cs
Normal file
|
@ -0,0 +1,181 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Symbol.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Symbols
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-16
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Symbols are used to name several term and type constructors.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Symbol : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The kind of the symbol (int or string)
|
||||||
|
/// </summary>
|
||||||
|
protected Z3_symbol_kind Kind
|
||||||
|
{
|
||||||
|
get { return (Z3_symbol_kind)Native.Z3_get_symbol_kind(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the symbol is of Int kind
|
||||||
|
/// </summary>
|
||||||
|
public bool IsIntSymbol()
|
||||||
|
{
|
||||||
|
return Kind == Z3_symbol_kind.Z3_INT_SYMBOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the symbol is of string kind.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsStringSymbol()
|
||||||
|
{
|
||||||
|
return Kind == Z3_symbol_kind.Z3_STRING_SYMBOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the symbol.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
if (IsIntSymbol())
|
||||||
|
return ((IntSymbol)this).Int.ToString();
|
||||||
|
else if (IsStringSymbol())
|
||||||
|
return ((StringSymbol)this).String;
|
||||||
|
else
|
||||||
|
throw new Z3Exception("Unknown symbol kind encountered");
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
/// <summary>
|
||||||
|
/// Symbol constructor
|
||||||
|
/// </summary>
|
||||||
|
internal protected Symbol(Context ctx, IntPtr obj) : base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static Symbol Create(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
Contract.Ensures(Contract.Result<Symbol>() != null);
|
||||||
|
|
||||||
|
switch ((Z3_symbol_kind)Native.Z3_get_symbol_kind(ctx.nCtx, obj))
|
||||||
|
{
|
||||||
|
case Z3_symbol_kind.Z3_INT_SYMBOL: return new IntSymbol(ctx, obj);
|
||||||
|
case Z3_symbol_kind.Z3_STRING_SYMBOL: return new StringSymbol(ctx, obj);
|
||||||
|
default:
|
||||||
|
throw new Z3Exception("Unknown symbol kind encountered");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Numbered symbols
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class IntSymbol : Symbol
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The int value of the symbol.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Throws an exception if the symbol is not of int kind. </remarks>
|
||||||
|
public int Int
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!IsIntSymbol())
|
||||||
|
throw new Z3Exception("Int requested from non-Int symbol");
|
||||||
|
return Native.Z3_get_symbol_int(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal IntSymbol(Context ctx, IntPtr obj)
|
||||||
|
: base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
internal IntSymbol(Context ctx, int i)
|
||||||
|
: base(ctx, Native.Z3_mk_int_symbol(ctx.nCtx, i))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
internal override void CheckNativeObject(IntPtr obj)
|
||||||
|
{
|
||||||
|
if ((Z3_symbol_kind)Native.Z3_get_symbol_kind(Context.nCtx, obj) != Z3_symbol_kind.Z3_INT_SYMBOL)
|
||||||
|
throw new Z3Exception("Symbol is not of integer kind");
|
||||||
|
base.CheckNativeObject(obj);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Named symbols
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class StringSymbol : Symbol
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The string value of the symbol.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Throws an exception if the symbol is not of string kind.</remarks>
|
||||||
|
public string String
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<string>() != null);
|
||||||
|
|
||||||
|
if (!IsStringSymbol())
|
||||||
|
throw new Z3Exception("String requested from non-String symbol");
|
||||||
|
return Native.Z3_get_symbol_string(Context.nCtx, NativeObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal StringSymbol(Context ctx, IntPtr obj) : base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal StringSymbol(Context ctx, string s) : base(ctx, Native.Z3_mk_string_symbol(ctx.nCtx, s))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
internal override void CheckNativeObject(IntPtr obj)
|
||||||
|
{
|
||||||
|
if ((Z3_symbol_kind)Native.Z3_get_symbol_kind(Context.nCtx, obj) != Z3_symbol_kind.Z3_STRING_SYMBOL)
|
||||||
|
throw new Z3Exception("Symbol is not of string kind");
|
||||||
|
|
||||||
|
base.CheckNativeObject(obj);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
141
Microsoft.Z3/Tactic.cs
Normal file
141
Microsoft.Z3/Tactic.cs
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Tactic.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Tactics
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-21
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Tactics are the basic building block for creating custom solvers for specific problem domains.
|
||||||
|
/// The complete list of tactics may be obtained using <c>Context.NumTactics</c>
|
||||||
|
/// and <c>Context.TacticNames</c>.
|
||||||
|
/// It may also be obtained using the command <c>(help-tactics)</c> in the SMT 2.0 front-end.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Tactic : Z3Object
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A string containing a description of parameters accepted by the tactic.
|
||||||
|
/// </summary>
|
||||||
|
public string Help
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<string>() != null);
|
||||||
|
|
||||||
|
return Native.Z3_tactic_get_help(Context.nCtx, NativeObject); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves parameter descriptions for Tactics.
|
||||||
|
/// </summary>
|
||||||
|
public ParamDescrs ParameterDescriptions
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new ParamDescrs(Context, Native.Z3_tactic_get_param_descrs(Context.nCtx, NativeObject));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Execute the tactic over the goal.
|
||||||
|
/// </summary>
|
||||||
|
public ApplyResult Apply(Goal g, Params p = null)
|
||||||
|
{
|
||||||
|
Contract.Requires(g != null);
|
||||||
|
Contract.Ensures(Contract.Result<ApplyResult>() != null);
|
||||||
|
|
||||||
|
Context.CheckContextMatch(g);
|
||||||
|
if (p == null)
|
||||||
|
return new ApplyResult(Context, Native.Z3_tactic_apply(Context.nCtx, NativeObject, g.NativeObject));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Context.CheckContextMatch(p);
|
||||||
|
return new ApplyResult(Context, Native.Z3_tactic_apply_ex(Context.nCtx, NativeObject, g.NativeObject, p.NativeObject));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Apply the tactic to a goal.
|
||||||
|
/// </summary>
|
||||||
|
public ApplyResult this[Goal g]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Requires(g != null);
|
||||||
|
Contract.Ensures(Contract.Result<ApplyResult>() != null);
|
||||||
|
|
||||||
|
return Apply(g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a solver that is implemented using the given tactic.
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref="Context.MkSolver(Tactic)"/>
|
||||||
|
public Solver Solver
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Solver>() != null);
|
||||||
|
|
||||||
|
return Context.MkSolver(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
internal Tactic(Context ctx, IntPtr obj) : base(ctx, obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
internal Tactic(Context ctx, string name) : base(ctx, Native.Z3_mk_tactic(ctx.nCtx, name))
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DecRefQueue : Z3.DecRefQueue
|
||||||
|
{
|
||||||
|
public override void IncRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_tactic_inc_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DecRef(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Native.Z3_tactic_dec_ref(ctx.nCtx, obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
internal override void IncRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Tactic_DRQ.IncAndClear(Context, o);
|
||||||
|
base.IncRef(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal override void DecRef(IntPtr o)
|
||||||
|
{
|
||||||
|
Context.Tactic_DRQ.Add(o);
|
||||||
|
base.DecRef(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
98
Microsoft.Z3/Version.cs
Normal file
98
Microsoft.Z3/Version.cs
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Version.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Version information
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-16
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Version information.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Note that this class is static.</remarks>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public static class Version
|
||||||
|
{
|
||||||
|
static Version() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The major version
|
||||||
|
/// </summary>
|
||||||
|
public static uint Major
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
uint major = 0, minor = 0, build = 0, revision = 0;
|
||||||
|
Native.Z3_get_version(ref major, ref minor, ref build, ref revision);
|
||||||
|
return major;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The minor version
|
||||||
|
/// </summary>
|
||||||
|
public static uint Minor
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
uint major = 0, minor = 0, build = 0, revision = 0;
|
||||||
|
Native.Z3_get_version(ref major, ref minor, ref build, ref revision);
|
||||||
|
return minor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The build version
|
||||||
|
/// </summary>
|
||||||
|
public static uint Build
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
uint major = 0, minor = 0, build = 0, revision = 0;
|
||||||
|
Native.Z3_get_version(ref major, ref minor, ref build, ref revision);
|
||||||
|
return build;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The revision
|
||||||
|
/// </summary>
|
||||||
|
public static uint Revision
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
uint major = 0, minor = 0, build = 0, revision = 0;
|
||||||
|
Native.Z3_get_version(ref major, ref minor, ref build, ref revision);
|
||||||
|
return revision;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A string representation of the version information.
|
||||||
|
/// </summary>
|
||||||
|
new public static string ToString()
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<string>() != null);
|
||||||
|
|
||||||
|
uint major = 0, minor = 0, build = 0, revision = 0;
|
||||||
|
Native.Z3_get_version(ref major, ref minor, ref build, ref revision);
|
||||||
|
return major.ToString() + "." + minor.ToString() + "." + build.ToString() + "." + revision.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
44
Microsoft.Z3/Z3Exception.cs
Normal file
44
Microsoft.Z3/Z3Exception.cs
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Exception.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Exceptions
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The exception base class for error reporting from Z3
|
||||||
|
/// </summary>
|
||||||
|
public class Z3Exception : Exception
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
public Z3Exception() : base() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
public Z3Exception(string message) : base(message) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
public Z3Exception(string message, System.Exception inner) : base(message, inner) { }
|
||||||
|
}
|
||||||
|
}
|
145
Microsoft.Z3/Z3Object.cs
Normal file
145
Microsoft.Z3/Z3Object.cs
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2012 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Z3Object.cs
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 Managed API: Internal Z3 Objects
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Christoph Wintersteiger (cwinter) 2012-03-21
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Internal base class for interfacing with native Z3 objects.
|
||||||
|
/// Should not be used externally.
|
||||||
|
/// </summary>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
public class Z3Object : IDisposable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Finalizer.
|
||||||
|
/// </summary>
|
||||||
|
~Z3Object()
|
||||||
|
{
|
||||||
|
Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disposes of the underlying native Z3 object.
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (m_n_obj != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
DecRef(m_n_obj);
|
||||||
|
m_n_obj = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_ctx != null)
|
||||||
|
{
|
||||||
|
m_ctx.refCount--;
|
||||||
|
if (m_ctx.refCount == 0)
|
||||||
|
GC.ReRegisterForFinalize(m_ctx);
|
||||||
|
m_ctx = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Object Invariant
|
||||||
|
|
||||||
|
[ContractInvariantMethod]
|
||||||
|
private void ObjectInvariant()
|
||||||
|
{
|
||||||
|
Contract.Invariant(this.m_ctx != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Internal
|
||||||
|
private Context m_ctx = null;
|
||||||
|
private IntPtr m_n_obj = IntPtr.Zero;
|
||||||
|
|
||||||
|
internal Z3Object(Context ctx)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
|
||||||
|
ctx.refCount++;
|
||||||
|
m_ctx = ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Z3Object(Context ctx, IntPtr obj)
|
||||||
|
{
|
||||||
|
Contract.Requires(ctx != null);
|
||||||
|
|
||||||
|
ctx.refCount++;
|
||||||
|
m_ctx = ctx;
|
||||||
|
IncRef(obj);
|
||||||
|
m_n_obj = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal virtual void IncRef(IntPtr o) { }
|
||||||
|
internal virtual void DecRef(IntPtr o) { }
|
||||||
|
|
||||||
|
internal virtual void CheckNativeObject(IntPtr obj) { }
|
||||||
|
|
||||||
|
internal virtual IntPtr NativeObject
|
||||||
|
{
|
||||||
|
get { return m_n_obj; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != IntPtr.Zero) { CheckNativeObject(value); IncRef(value); }
|
||||||
|
if (m_n_obj != IntPtr.Zero) { DecRef(m_n_obj); }
|
||||||
|
m_n_obj = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static IntPtr GetNativeObject(Z3Object s)
|
||||||
|
{
|
||||||
|
if (s == null) return new IntPtr();
|
||||||
|
return s.NativeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal Context Context
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Contract.Ensures(Contract.Result<Context>() != null);
|
||||||
|
return m_ctx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Pure]
|
||||||
|
internal static IntPtr[] ArrayToNative(Z3Object[] a)
|
||||||
|
{
|
||||||
|
Contract.Ensures(a == null || Contract.Result<IntPtr[]>() != null);
|
||||||
|
Contract.Ensures(a == null || Contract.Result<IntPtr[]>().Length == a.Length);
|
||||||
|
|
||||||
|
if (a == null) return null;
|
||||||
|
IntPtr[] an = new IntPtr[a.Length];
|
||||||
|
for (uint i = 0; i < a.Length; i++)
|
||||||
|
if (a[i] != null) an[i] = a[i].NativeObject;
|
||||||
|
return an;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Pure]
|
||||||
|
internal static uint ArrayLength(Z3Object[] a)
|
||||||
|
{
|
||||||
|
return (a == null)?0:(uint)a.Length;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
85
Microsoft.Z3/mk_z3consts.py
Normal file
85
Microsoft.Z3/mk_z3consts.py
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
############################################
|
||||||
|
# Copyright (c) 2012 Microsoft Corporation
|
||||||
|
#
|
||||||
|
# Extract enumeration types from z3_api.h
|
||||||
|
#
|
||||||
|
# Author: Leonardo de Moura (leonardo)
|
||||||
|
# Christoph M. Wintersteiger (cwinter)
|
||||||
|
############################################
|
||||||
|
import re
|
||||||
|
|
||||||
|
blank_pat = re.compile("^ *$")
|
||||||
|
comment_pat = re.compile("^ *//.*$")
|
||||||
|
typedef_pat = re.compile("typedef enum *")
|
||||||
|
typedef2_pat = re.compile("typedef enum { *")
|
||||||
|
openbrace_pat = re.compile("{ *")
|
||||||
|
closebrace_pat = re.compile("}.*;")
|
||||||
|
|
||||||
|
api = open('..\\lib\\z3_api.h', 'r')
|
||||||
|
|
||||||
|
DeprecatedEnums = { 'Z3_search_failure' }
|
||||||
|
|
||||||
|
z3consts = open('Enumerations.cs', 'w')
|
||||||
|
z3consts.write('// Automatically generated file, generator: mk_z3consts.py\n\n')
|
||||||
|
z3consts.write('using System;\n\n'
|
||||||
|
'#pragma warning disable 1591\n\n'
|
||||||
|
'namespace Microsoft.Z3\n'
|
||||||
|
'{\n');
|
||||||
|
|
||||||
|
SEARCHING = 0
|
||||||
|
FOUND_ENUM = 1
|
||||||
|
IN_ENUM = 2
|
||||||
|
|
||||||
|
mode = SEARCHING
|
||||||
|
decls = {}
|
||||||
|
idx = 0
|
||||||
|
|
||||||
|
linenum = 1
|
||||||
|
for line in api:
|
||||||
|
m1 = blank_pat.match(line)
|
||||||
|
m2 = comment_pat.match(line)
|
||||||
|
if m1 or m2:
|
||||||
|
# skip blank lines and comments
|
||||||
|
linenum = linenum + 1
|
||||||
|
elif mode == SEARCHING:
|
||||||
|
m = typedef_pat.match(line)
|
||||||
|
if m:
|
||||||
|
mode = FOUND_ENUM
|
||||||
|
m = typedef2_pat.match(line)
|
||||||
|
if m:
|
||||||
|
mode = IN_ENUM
|
||||||
|
decls = {}
|
||||||
|
idx = 0
|
||||||
|
elif mode == FOUND_ENUM:
|
||||||
|
m = openbrace_pat.match(line)
|
||||||
|
if m:
|
||||||
|
mode = IN_ENUM
|
||||||
|
decls = {}
|
||||||
|
idx = 0
|
||||||
|
else:
|
||||||
|
assert False, "Invalid z3_api.h, line: %s" % linenum
|
||||||
|
else:
|
||||||
|
assert mode == IN_ENUM
|
||||||
|
words = re.split('[^\-a-zA-Z0-9_]+', line)
|
||||||
|
m = closebrace_pat.match(line)
|
||||||
|
if m:
|
||||||
|
name = words[1]
|
||||||
|
if name not in DeprecatedEnums:
|
||||||
|
z3consts.write(' /// <summary>%s</summary>\n' % name)
|
||||||
|
z3consts.write(' public enum %s {\n' % name)
|
||||||
|
z3consts.write
|
||||||
|
for k, i in decls.iteritems():
|
||||||
|
z3consts.write(' %s = %s,\n' % (k, i))
|
||||||
|
z3consts.write(' }\n\n')
|
||||||
|
mode = SEARCHING
|
||||||
|
else:
|
||||||
|
if words[2] != '':
|
||||||
|
if len(words[2]) > 1 and words[2][1] == 'x':
|
||||||
|
idx = int(words[2], 16)
|
||||||
|
else:
|
||||||
|
idx = int(words[2])
|
||||||
|
decls[words[1]] = idx
|
||||||
|
idx = idx + 1
|
||||||
|
linenum = linenum + 1
|
||||||
|
|
||||||
|
z3consts.write('}\n');
|
2115
Microsoft.Z3/test_mapi/Program.cs
Normal file
2115
Microsoft.Z3/test_mapi/Program.cs
Normal file
File diff suppressed because it is too large
Load diff
4
Microsoft.Z3/test_mapi/build-external.cmd
Normal file
4
Microsoft.Z3/test_mapi/build-external.cmd
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
copy ..\..\bin\Microsoft.Z3.dll .
|
||||||
|
copy ..\..\bin\Z3.dll .
|
||||||
|
|
||||||
|
csc /reference:Microsoft.Z3.dll /debug:full /platform:x86 /reference:System.Numerics.dll Program.cs
|
4
Microsoft.Z3/test_mapi/build.cmd
Normal file
4
Microsoft.Z3/test_mapi/build.cmd
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
copy ..\..\x64\release\Microsoft.Z3.dll .
|
||||||
|
copy ..\..\x64\release\Z3.dll .
|
||||||
|
|
||||||
|
csc /reference:..\..\x64\release\Microsoft.Z3.dll /debug:full /platform:x64 /reference:System.Numerics.dll Program.cs
|
68
Microsoft.Z3/test_mapi/test_mapi.csproj
Normal file
68
Microsoft.Z3/test_mapi/test_mapi.csproj
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{D350BC78-8455-45D3-9759-073394378BF2}</ProjectGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>test_mapi</RootNamespace>
|
||||||
|
<AssemblyName>test_mapi</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
|
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<StartupObject>test_mapi.Program</StartupObject>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Numerics" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Microsoft.Z3.csproj">
|
||||||
|
<Project>{EC3DB697-B734-42F7-9468-5B62821EEB5A}</Project>
|
||||||
|
<Name>Microsoft.Z3</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Properties\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
BIN
Microsoft.Z3/z3.snk
Normal file
BIN
Microsoft.Z3/z3.snk
Normal file
Binary file not shown.
34
Microsoft.Z3V3/AssemblyInfo.cpp
Normal file
34
Microsoft.Z3V3/AssemblyInfo.cpp
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
using namespace System;
|
||||||
|
using namespace System::Reflection;
|
||||||
|
using namespace System::Runtime::CompilerServices;
|
||||||
|
using namespace System::Runtime::InteropServices;
|
||||||
|
using namespace System::Security::Permissions;
|
||||||
|
|
||||||
|
//
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
//
|
||||||
|
[assembly:AssemblyTitleAttribute("Z3 .NET Interface")];
|
||||||
|
[assembly:AssemblyDescriptionAttribute(".NET Interface to the Z3 Theorem Prover")];
|
||||||
|
[assembly:AssemblyConfigurationAttribute("")];
|
||||||
|
[assembly:AssemblyCompanyAttribute("Microsoft Corporation")];
|
||||||
|
[assembly:AssemblyProductAttribute("Z3")];
|
||||||
|
[assembly:AssemblyCopyrightAttribute("Copyright (c) Microsoft Corporation 2006")];
|
||||||
|
[assembly:AssemblyTrademarkAttribute("")];
|
||||||
|
[assembly:AssemblyCultureAttribute("")];
|
||||||
|
|
||||||
|
[assembly:ComVisible(false)];
|
||||||
|
[assembly:CLSCompliantAttribute(true)];
|
||||||
|
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
|
||||||
|
|
||||||
|
[assembly:AssemblyVersionAttribute("4.2.0.0")];
|
||||||
|
[assembly:AssemblyFileVersionAttribute("4.2.0.0")];
|
||||||
|
|
||||||
|
#ifdef DELAYSIGN
|
||||||
|
[assembly:AssemblyKeyFile("35MSSharedLib1024.snk")];
|
||||||
|
[assembly:AssemblyDelaySign(true)];
|
||||||
|
#else
|
||||||
|
[assembly:AssemblyKeyFile("z3.snk")];
|
||||||
|
[assembly:AssemblyDelaySign(true)];
|
||||||
|
#endif
|
3260
Microsoft.Z3V3/Microsoft.Z3V3.cpp
Normal file
3260
Microsoft.Z3V3/Microsoft.Z3V3.cpp
Normal file
File diff suppressed because it is too large
Load diff
4775
Microsoft.Z3V3/Microsoft.Z3V3.h
Normal file
4775
Microsoft.Z3V3/Microsoft.Z3V3.h
Normal file
File diff suppressed because it is too large
Load diff
1686
Microsoft.Z3V3/Microsoft.Z3V3.vcxproj
Normal file
1686
Microsoft.Z3V3/Microsoft.Z3V3.vcxproj
Normal file
File diff suppressed because it is too large
Load diff
3
Microsoft.Z3V3/Microsoft.Z3V3.vcxproj.user
Normal file
3
Microsoft.Z3V3/Microsoft.Z3V3.vcxproj.user
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
BIN
Microsoft.Z3V3/z3.snk
Normal file
BIN
Microsoft.Z3V3/z3.snk
Normal file
Binary file not shown.
52
README
Normal file
52
README
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
Z3 is a theorem prover from Microsoft Research.
|
||||||
|
Z3 is licensed under MSR-LA (Microsoft Research License Agreement).
|
||||||
|
See http://z3.codeplex.com/license for more information about this license.
|
||||||
|
Z3 can be built using Visual Studio Command Prompt, Visual Studio and make/gcc.
|
||||||
|
|
||||||
|
1) Building Z3 on Windows using Visual Studio Command Prompt
|
||||||
|
|
||||||
|
- Open a Visual Studio Command Prompt, then execute one of the following commands to build the desired component.
|
||||||
|
|
||||||
|
- For building all components, execute
|
||||||
|
msbuild z3-prover.sln /p:configuration=external
|
||||||
|
All components will be located at /external
|
||||||
|
|
||||||
|
- For building all components (64-bit), execute
|
||||||
|
msbuild z3-prover.sln /p:configuration=external_64 /p:platform=x64
|
||||||
|
All components will be located at /external_64
|
||||||
|
|
||||||
|
- For building all components (in debug mode), execute
|
||||||
|
msbuild z3-prover.sln
|
||||||
|
All components will be located at /debug
|
||||||
|
|
||||||
|
1) Building Z3 using g++/make
|
||||||
|
Your machine must also have the following commands to be able to build Z3:
|
||||||
|
autoconf, sed, awk, dos2unix commands
|
||||||
|
|
||||||
|
|
||||||
|
- Open a shell
|
||||||
|
- For building the z3 executable, execute
|
||||||
|
|
||||||
|
autoconf
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
|
||||||
|
The z3 executable will be located at bin/external/
|
||||||
|
|
||||||
|
- If you want a static library for Z3
|
||||||
|
|
||||||
|
make a
|
||||||
|
|
||||||
|
- If you also want the z3 shared library, execute
|
||||||
|
|
||||||
|
make so
|
||||||
|
|
||||||
|
for libz3.so (on Linux)
|
||||||
|
|
||||||
|
make dylib
|
||||||
|
|
||||||
|
for libz3.dylib (on OSX)
|
||||||
|
|
||||||
|
Remark: the Z3 makefile imports the source file list from Visual Studio project files.
|
||||||
|
To add new source files to the Z3 core, you must include them at: lib/lib.vcxproj
|
||||||
|
|
23
c++/README.txt
Normal file
23
c++/README.txt
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
This directory contains scripts to build the test application using
|
||||||
|
Microsoft C compiler, or g++.
|
||||||
|
|
||||||
|
1) Using Microsoft C compiler
|
||||||
|
|
||||||
|
Use 'build.cmd' to build the test application using Microsoft C
|
||||||
|
compiler.
|
||||||
|
|
||||||
|
Remark: The Microsoft C compiler (cl) must be in your path,
|
||||||
|
or you can use the Visual Studio Command Prompt.
|
||||||
|
|
||||||
|
The script 'exec.cmd' adds the bin directory to the path. So,
|
||||||
|
example.exe can find z3.dll.
|
||||||
|
|
||||||
|
2) Using gcc
|
||||||
|
|
||||||
|
Use 'build.sh' to build the test application using g++.
|
||||||
|
The script 'exec.sh' adds the bin directory to the path. So,
|
||||||
|
example.exe can find z3.dll.
|
||||||
|
|
||||||
|
Remark: the scripts 'build.sh' and 'exec.sh' assumes you are in a
|
||||||
|
Cygwin or Mingw shell.
|
||||||
|
|
1
c++/build-external-linux.sh
Normal file
1
c++/build-external-linux.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
g++ -fopenmp -o example -I ../../include example.cpp -L ../../lib -lz3
|
1
c++/build-external-osx.sh
Normal file
1
c++/build-external-osx.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
g++ -fopenmp -o example -I ../../include example.cpp -L ../../lib -lz3
|
1
c++/build-external.cmd
Normal file
1
c++/build-external.cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
cl /EHsc /I ..\..\include /I . ..\..\bin\z3.lib example.cpp
|
1
c++/build-external.sh
Normal file
1
c++/build-external.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
g++ -fopenmp -o example.exe -I ../../include ../../bin/z3.dll example.cpp
|
1
c++/build.cmd
Normal file
1
c++/build.cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
cl /W3 /EHsc /I ..\lib ..\debug\z3_dbg.lib example.cpp
|
701
c++/example.cpp
Normal file
701
c++/example.cpp
Normal file
|
@ -0,0 +1,701 @@
|
||||||
|
#include"z3++.h"
|
||||||
|
using namespace z3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Demonstration of how Z3 can be used to prove validity of
|
||||||
|
De Morgan's Duality Law: {e not(x and y) <-> (not x) or ( not y) }
|
||||||
|
*/
|
||||||
|
void demorgan() {
|
||||||
|
std::cout << "de-Morgan example\n";
|
||||||
|
|
||||||
|
context c;
|
||||||
|
|
||||||
|
expr x = c.bool_const("x");
|
||||||
|
expr y = c.bool_const("y");
|
||||||
|
expr conjecture = !(x && y) == (!x || !y);
|
||||||
|
|
||||||
|
solver s(c);
|
||||||
|
// adding the negation of the conjecture as a constraint.
|
||||||
|
s.add(!conjecture);
|
||||||
|
std::cout << s << "\n";
|
||||||
|
switch (s.check()) {
|
||||||
|
case unsat: std::cout << "de-Morgan is valid\n"; break;
|
||||||
|
case sat: std::cout << "de-Morgan is not valid\n"; break;
|
||||||
|
case unknown: std::cout << "unknown\n"; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Find a model for <tt>x >= 1 and y < x + 3</tt>.
|
||||||
|
*/
|
||||||
|
void find_model_example1() {
|
||||||
|
std::cout << "find_model_example1\n";
|
||||||
|
context c;
|
||||||
|
expr x = c.int_const("x");
|
||||||
|
expr y = c.int_const("y");
|
||||||
|
solver s(c);
|
||||||
|
|
||||||
|
s.add(x >= 1);
|
||||||
|
s.add(y < x + 3);
|
||||||
|
std::cout << s.check() << "\n";
|
||||||
|
|
||||||
|
model m = s.get_model();
|
||||||
|
std::cout << m << "\n";
|
||||||
|
// traversing the model
|
||||||
|
for (unsigned i = 0; i < m.size(); i++) {
|
||||||
|
func_decl v = m[i];
|
||||||
|
// this problem contains only constants
|
||||||
|
assert(v.arity() == 0);
|
||||||
|
std::cout << v.name() << " = " << m.get_const_interp(v) << "\n";
|
||||||
|
}
|
||||||
|
// we can evaluate expressions in the model.
|
||||||
|
std::cout << "x + y + 1 = " << m.eval(x + y + 1) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Prove <tt>x = y implies g(x) = g(y)</tt>, and
|
||||||
|
disprove <tt>x = y implies g(g(x)) = g(y)</tt>.
|
||||||
|
|
||||||
|
This function demonstrates how to create uninterpreted types and
|
||||||
|
functions.
|
||||||
|
*/
|
||||||
|
void prove_example1() {
|
||||||
|
std::cout << "prove_example1\n";
|
||||||
|
|
||||||
|
context c;
|
||||||
|
expr x = c.int_const("x");
|
||||||
|
expr y = c.int_const("y");
|
||||||
|
sort I = c.int_sort();
|
||||||
|
func_decl g = function("g", I, I);
|
||||||
|
|
||||||
|
solver s(c);
|
||||||
|
expr conjecture1 = implies(x == y, g(x) == g(y));
|
||||||
|
std::cout << "conjecture 1\n" << conjecture1 << "\n";
|
||||||
|
s.add(!conjecture1);
|
||||||
|
if (s.check() == unsat)
|
||||||
|
std::cout << "proved" << "\n";
|
||||||
|
else
|
||||||
|
std::cout << "failed to prove" << "\n";
|
||||||
|
|
||||||
|
s.reset(); // remove all assertions from solver s
|
||||||
|
|
||||||
|
expr conjecture2 = implies(x == y, g(g(x)) == g(y));
|
||||||
|
std::cout << "conjecture 2\n" << conjecture2 << "\n";
|
||||||
|
s.add(!conjecture2);
|
||||||
|
if (s.check() == unsat) {
|
||||||
|
std::cout << "proved" << "\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cout << "failed to prove" << "\n";
|
||||||
|
model m = s.get_model();
|
||||||
|
std::cout << "counterexample:\n" << m << "\n";
|
||||||
|
std::cout << "g(g(x)) = " << m.eval(g(g(x))) << "\n";
|
||||||
|
std::cout << "g(y) = " << m.eval(g(y)) << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Prove <tt>not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < 0 </tt>.
|
||||||
|
Then, show that <tt>z < -1</tt> is not implied.
|
||||||
|
|
||||||
|
This example demonstrates how to combine uninterpreted functions and arithmetic.
|
||||||
|
*/
|
||||||
|
void prove_example2() {
|
||||||
|
std::cout << "prove_example1\n";
|
||||||
|
|
||||||
|
context c;
|
||||||
|
expr x = c.int_const("x");
|
||||||
|
expr y = c.int_const("y");
|
||||||
|
expr z = c.int_const("z");
|
||||||
|
sort I = c.int_sort();
|
||||||
|
func_decl g = function("g", I, I);
|
||||||
|
|
||||||
|
expr conjecture1 = implies(g(g(x) - g(y)) != g(z) && x + z <= y && y <= x,
|
||||||
|
z < 0);
|
||||||
|
|
||||||
|
solver s(c);
|
||||||
|
s.add(!conjecture1);
|
||||||
|
std::cout << "conjecture 1:\n" << conjecture1 << "\n";
|
||||||
|
if (s.check() == unsat)
|
||||||
|
std::cout << "proved" << "\n";
|
||||||
|
else
|
||||||
|
std::cout << "failed to prove" << "\n";
|
||||||
|
|
||||||
|
expr conjecture2 = implies(g(g(x) - g(y)) != g(z) && x + z <= y && y <= x,
|
||||||
|
z < -1);
|
||||||
|
s.reset();
|
||||||
|
s.add(!conjecture2);
|
||||||
|
std::cout << "conjecture 2:\n" << conjecture2 << "\n";
|
||||||
|
if (s.check() == unsat) {
|
||||||
|
std::cout << "proved" << "\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cout << "failed to prove" << "\n";
|
||||||
|
std::cout << "counterexample:\n" << s.get_model() << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Nonlinear arithmetic example 1
|
||||||
|
*/
|
||||||
|
void nonlinear_example1() {
|
||||||
|
std::cout << "nonlinear example 1\n";
|
||||||
|
config cfg;
|
||||||
|
cfg.set(":auto-config", true);
|
||||||
|
context c(cfg);
|
||||||
|
|
||||||
|
expr x = c.real_const("x");
|
||||||
|
expr y = c.real_const("y");
|
||||||
|
expr z = c.real_const("z");
|
||||||
|
|
||||||
|
solver s(c);
|
||||||
|
|
||||||
|
s.add(x*x + y*y == 1); // x^2 + y^2 == 1
|
||||||
|
s.add(x*x*x + z*z*z < c.real_val("1/2")); // x^3 + z^3 < 1/2
|
||||||
|
s.add(z != 0);
|
||||||
|
std::cout << s.check() << "\n";
|
||||||
|
model m = s.get_model();
|
||||||
|
std::cout << m << "\n";
|
||||||
|
c.set(":pp-decimal", true); // set decimal notation
|
||||||
|
std::cout << "model in decimal notation\n";
|
||||||
|
std::cout << m << "\n";
|
||||||
|
c.set(":pp-decimal-precision", 50); // increase number of decimal places to 50.
|
||||||
|
std::cout << "model using 50 decimal places\n";
|
||||||
|
std::cout << m << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Simple function that tries to prove the given conjecture using the following steps:
|
||||||
|
1- create a solver
|
||||||
|
2- assert the negation of the conjecture
|
||||||
|
3- checks if the result is unsat.
|
||||||
|
*/
|
||||||
|
void prove(expr conjecture) {
|
||||||
|
context & c = conjecture.ctx();
|
||||||
|
solver s(c);
|
||||||
|
s.add(!conjecture);
|
||||||
|
std::cout << "conjecture:\n" << conjecture << "\n";
|
||||||
|
if (s.check() == unsat) {
|
||||||
|
std::cout << "proved" << "\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cout << "failed to prove" << "\n";
|
||||||
|
std::cout << "counterexample:\n" << s.get_model() << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Simple bit-vector example. This example disproves that x - 10 <= 0 IFF x <= 10 for (32-bit) machine integers
|
||||||
|
*/
|
||||||
|
void bitvector_example1() {
|
||||||
|
std::cout << "bitvector example 1\n";
|
||||||
|
context c;
|
||||||
|
expr x = c.bv_const("x", 32);
|
||||||
|
|
||||||
|
// using signed <=
|
||||||
|
prove((x - 10 <= 0) == (x <= 10));
|
||||||
|
|
||||||
|
// using unsigned <=
|
||||||
|
prove(ule(x - 10, 0) == ule(x, 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Find x and y such that: x ^ y - 103 == x * y
|
||||||
|
*/
|
||||||
|
void bitvector_example2() {
|
||||||
|
std::cout << "bitvector example 2\n";
|
||||||
|
context c;
|
||||||
|
expr x = c.bv_const("x", 32);
|
||||||
|
expr y = c.bv_const("y", 32);
|
||||||
|
solver s(c);
|
||||||
|
// In C++, the operator == has higher precedence than ^.
|
||||||
|
s.add((x ^ y) - 103 == x * y);
|
||||||
|
std::cout << s << "\n";
|
||||||
|
std::cout << s.check() << "\n";
|
||||||
|
std::cout << s.get_model() << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Mixing C and C++ APIs.
|
||||||
|
*/
|
||||||
|
void capi_example() {
|
||||||
|
std::cout << "capi example\n";
|
||||||
|
context c;
|
||||||
|
expr x = c.bv_const("x", 32);
|
||||||
|
expr y = c.bv_const("y", 32);
|
||||||
|
// Invoking a C API function, and wrapping the result using an expr object.
|
||||||
|
expr r = to_expr(c, Z3_mk_bvsrem(c, x, y));
|
||||||
|
std::cout << "r: " << r << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Demonstrate how to evaluate expressions in a model.
|
||||||
|
*/
|
||||||
|
void eval_example1() {
|
||||||
|
std::cout << "eval example 1\n";
|
||||||
|
context c;
|
||||||
|
expr x = c.int_const("x");
|
||||||
|
expr y = c.int_const("y");
|
||||||
|
solver s(c);
|
||||||
|
|
||||||
|
/* assert x < y */
|
||||||
|
s.add(x < y);
|
||||||
|
/* assert x > 2 */
|
||||||
|
s.add(x > 2);
|
||||||
|
|
||||||
|
std::cout << s.check() << "\n";
|
||||||
|
|
||||||
|
model m = s.get_model();
|
||||||
|
std::cout << "Model:\n" << m << "\n";
|
||||||
|
std::cout << "x+y = " << m.eval(x+y) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Several contexts can be used simultaneously.
|
||||||
|
*/
|
||||||
|
void two_contexts_example1() {
|
||||||
|
std::cout << "two contexts example 1\n";
|
||||||
|
context c1, c2;
|
||||||
|
|
||||||
|
expr x = c1.int_const("x");
|
||||||
|
expr n = x + 1;
|
||||||
|
// We cannot mix expressions from different contexts, but we can copy
|
||||||
|
// an expression from one context to another.
|
||||||
|
// The following statement copies the expression n from c1 to c2.
|
||||||
|
expr n1 = to_expr(c2, Z3_translate(c1, n, c2));
|
||||||
|
std::cout << n1 << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Demonstrates how to catch API usage errors.
|
||||||
|
*/
|
||||||
|
void error_example() {
|
||||||
|
std::cout << "error example\n";
|
||||||
|
|
||||||
|
context c;
|
||||||
|
expr x = c.bool_const("x");
|
||||||
|
|
||||||
|
// Error using the C API can be detected using Z3_get_error_code.
|
||||||
|
// The next call fails because x is a constant.
|
||||||
|
Z3_ast arg = Z3_get_app_arg(c, x, 0);
|
||||||
|
if (Z3_get_error_code(c) != Z3_OK) {
|
||||||
|
std::cout << "last call failed.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// The C++ layer converts API usage errors into exceptions.
|
||||||
|
try {
|
||||||
|
// The next call fails because x is a Boolean.
|
||||||
|
expr n = x + 1;
|
||||||
|
}
|
||||||
|
catch (exception ex) {
|
||||||
|
std::cout << "failed: " << ex << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// The functions to_expr, to_sort and to_func_decl also convert C API errors into exceptions.
|
||||||
|
try {
|
||||||
|
expr arg = to_expr(c, Z3_get_app_arg(c, x, 0));
|
||||||
|
}
|
||||||
|
catch (exception ex) {
|
||||||
|
std::cout << "failed: " << ex << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Demonstrate different ways of creating rational numbers: decimal and fractional representations.
|
||||||
|
*/
|
||||||
|
void numeral_example() {
|
||||||
|
std::cout << "numeral example\n";
|
||||||
|
context c;
|
||||||
|
|
||||||
|
expr n1 = c.real_val("1/2");
|
||||||
|
expr n2 = c.real_val("0.5");
|
||||||
|
expr n3 = c.real_val(1, 2);
|
||||||
|
std::cout << n1 << " " << n2 << " " << n3 << "\n";
|
||||||
|
prove(n1 == n2 && n1 == n3);
|
||||||
|
|
||||||
|
n1 = c.real_val("-1/3");
|
||||||
|
n2 = c.real_val("-0.3333333333333333333333333333333333");
|
||||||
|
std::cout << n1 << " " << n2 << "\n";
|
||||||
|
prove(n1 != n2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Test ite-term (if-then-else terms).
|
||||||
|
*/
|
||||||
|
void ite_example() {
|
||||||
|
std::cout << "if-then-else example\n";
|
||||||
|
context c;
|
||||||
|
|
||||||
|
expr f = c.bool_val(false);
|
||||||
|
expr one = c.int_val(1);
|
||||||
|
expr zero = c.int_val(0);
|
||||||
|
expr ite = to_expr(c, Z3_mk_ite(c, f, one, zero));
|
||||||
|
|
||||||
|
std::cout << "term: " << ite << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Unsat core example
|
||||||
|
*/
|
||||||
|
void unsat_core_example() {
|
||||||
|
std::cout << "unsat core example\n";
|
||||||
|
context c;
|
||||||
|
expr p1 = c.bool_const("p1");
|
||||||
|
expr p2 = c.bool_const("p2");
|
||||||
|
expr p3 = c.bool_const("p3");
|
||||||
|
expr x = c.int_const("x");
|
||||||
|
expr y = c.int_const("y");
|
||||||
|
solver s(c);
|
||||||
|
s.add(implies(p1, x > 10));
|
||||||
|
s.add(implies(p1, y > x));
|
||||||
|
s.add(implies(p2, y < 5));
|
||||||
|
s.add(implies(p3, y > 0));
|
||||||
|
expr assumptions[3] = { p1, p2, p3 };
|
||||||
|
std::cout << s.check(3, assumptions) << "\n";
|
||||||
|
expr_vector core = s.unsat_core();
|
||||||
|
std::cout << core << "\n";
|
||||||
|
std::cout << "size: " << core.size() << "\n";
|
||||||
|
for (unsigned i = 0; i < core.size(); i++) {
|
||||||
|
std::cout << core[i] << "\n";
|
||||||
|
}
|
||||||
|
// Trying again without p2
|
||||||
|
expr assumptions2[2] = { p1, p3 };
|
||||||
|
std::cout << s.check(2, assumptions2) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void tactic_example1() {
|
||||||
|
/*
|
||||||
|
Z3 implements a methodology for orchestrating reasoning engines where "big" symbolic
|
||||||
|
reasoning steps are represented as functions known as tactics, and tactics are composed
|
||||||
|
using combinators known as tacticals. Tactics process sets of formulas called Goals.
|
||||||
|
|
||||||
|
When a tactic is applied to some goal G, four different outcomes are possible. The tactic succeeds
|
||||||
|
in showing G to be satisfiable (i.e., feasible); succeeds in showing G to be unsatisfiable (i.e., infeasible);
|
||||||
|
produces a sequence of subgoals; or fails. When reducing a goal G to a sequence of subgoals G1, ..., Gn,
|
||||||
|
we face the problem of model conversion. A model converter construct a model for G using a model for some subgoal Gi.
|
||||||
|
|
||||||
|
In this example, we create a goal g consisting of three formulas, and a tactic t composed of two built-in tactics:
|
||||||
|
simplify and solve-eqs. The tactic simplify apply transformations equivalent to the ones found in the command simplify.
|
||||||
|
The tactic solver-eqs eliminate variables using Gaussian elimination. Actually, solve-eqs is not restricted
|
||||||
|
only to linear arithmetic. It can also eliminate arbitrary variables.
|
||||||
|
Then, sequential composition combinator & applies simplify to the input goal and solve-eqs to each subgoal produced by simplify.
|
||||||
|
In this example, only one subgoal is produced.
|
||||||
|
*/
|
||||||
|
std::cout << "tactic example 1\n";
|
||||||
|
context c;
|
||||||
|
expr x = c.real_const("x");
|
||||||
|
expr y = c.real_const("y");
|
||||||
|
goal g(c);
|
||||||
|
g.add(x > 0);
|
||||||
|
g.add(y > 0);
|
||||||
|
g.add(x == y + 2);
|
||||||
|
std::cout << g << "\n";
|
||||||
|
tactic t1(c, "simplify");
|
||||||
|
tactic t2(c, "solve-eqs");
|
||||||
|
tactic t = t1 & t2;
|
||||||
|
apply_result r = t(g);
|
||||||
|
std::cout << r << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void tactic_example2() {
|
||||||
|
/*
|
||||||
|
In Z3, we say a clause is any constraint of the form (f_1 || ... || f_n).
|
||||||
|
The tactic split-clause will select a clause in the input goal, and split it n subgoals.
|
||||||
|
One for each subformula f_i.
|
||||||
|
*/
|
||||||
|
std::cout << "tactic example 2\n";
|
||||||
|
context c;
|
||||||
|
expr x = c.real_const("x");
|
||||||
|
expr y = c.real_const("y");
|
||||||
|
goal g(c);
|
||||||
|
g.add(x < 0 || x > 0);
|
||||||
|
g.add(x == y + 1);
|
||||||
|
g.add(y < 0);
|
||||||
|
tactic t(c, "split-clause");
|
||||||
|
apply_result r = t(g);
|
||||||
|
for (unsigned i = 0; i < r.size(); i++) {
|
||||||
|
std::cout << "subgoal " << i << "\n" << r[i] << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void tactic_example3() {
|
||||||
|
/*
|
||||||
|
- The choice combinator t | s first applies t to the given goal, if it fails then returns the result of s applied to the given goal.
|
||||||
|
- repeat(t) Keep applying the given tactic until no subgoal is modified by it.
|
||||||
|
- repeat(t, n) Keep applying the given tactic until no subgoal is modified by it, or the number of iterations is greater than n.
|
||||||
|
- try_for(t, ms) Apply tactic t to the input goal, if it does not return in ms millisenconds, it fails.
|
||||||
|
- with(t, params) Apply the given tactic using the given parameters.
|
||||||
|
*/
|
||||||
|
std::cout << "tactic example 3\n";
|
||||||
|
context c;
|
||||||
|
expr x = c.real_const("x");
|
||||||
|
expr y = c.real_const("y");
|
||||||
|
expr z = c.real_const("z");
|
||||||
|
goal g(c);
|
||||||
|
g.add(x == 0 || x == 1);
|
||||||
|
g.add(y == 0 || y == 1);
|
||||||
|
g.add(z == 0 || z == 1);
|
||||||
|
g.add(x + y + z > 2);
|
||||||
|
// split all clauses
|
||||||
|
tactic split_all = repeat(tactic(c, "split-clause") | tactic(c, "skip"));
|
||||||
|
std::cout << split_all(g) << "\n";
|
||||||
|
tactic split_at_most_2 = repeat(tactic(c, "split-clause") | tactic(c, "skip"), 1);
|
||||||
|
std::cout << split_at_most_2(g) << "\n";
|
||||||
|
// In the tactic split_solver, the tactic solve-eqs discharges all but one goal.
|
||||||
|
// Note that, this tactic generates one goal: the empty goal which is trivially satisfiable (i.e., feasible)
|
||||||
|
tactic split_solve = split_all & tactic(c, "solve-eqs");
|
||||||
|
std::cout << split_solve(g) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void tactic_example4() {
|
||||||
|
/*
|
||||||
|
A tactic can be converted into a solver object using the method mk_solver().
|
||||||
|
If the tactic produces the empty goal, then the associated solver returns sat.
|
||||||
|
If the tactic produces a single goal containing False, then the solver returns unsat.
|
||||||
|
Otherwise, it returns unknown.
|
||||||
|
|
||||||
|
In this example, the tactic t implements a basic bit-vector solver using equation solving,
|
||||||
|
bit-blasting, and a propositional SAT solver.
|
||||||
|
We use the combinator `with` to configure our little solver.
|
||||||
|
We also include the tactic `aig` which tries to compress Boolean formulas using And-Inverted Graphs.
|
||||||
|
*/
|
||||||
|
std::cout << "tactic example 4\n";
|
||||||
|
context c;
|
||||||
|
params p(c);
|
||||||
|
p.set(":mul2concat", true);
|
||||||
|
tactic t =
|
||||||
|
with(tactic(c, "simplify"), p) &
|
||||||
|
tactic(c, "solve-eqs") &
|
||||||
|
tactic(c, "bit-blast") &
|
||||||
|
tactic(c, "aig") &
|
||||||
|
tactic(c, "sat");
|
||||||
|
solver s = t.mk_solver();
|
||||||
|
expr x = c.bv_const("x", 16);
|
||||||
|
expr y = c.bv_const("y", 16);
|
||||||
|
s.add(x*32 + y == 13);
|
||||||
|
// In C++, the operator < has higher precedence than &.
|
||||||
|
s.add((x & y) < 10);
|
||||||
|
s.add(y > -100);
|
||||||
|
std::cout << s.check() << "\n";
|
||||||
|
model m = s.get_model();
|
||||||
|
std::cout << m << "\n";
|
||||||
|
std::cout << "x*32 + y = " << m.eval(x*32 + y) << "\n";
|
||||||
|
std::cout << "x & y = " << m.eval(x & y) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void tactic_example5() {
|
||||||
|
/*
|
||||||
|
The tactic smt wraps the main solver in Z3 as a tactic.
|
||||||
|
*/
|
||||||
|
std::cout << "tactic example 5\n";
|
||||||
|
context c;
|
||||||
|
expr x = c.int_const("x");
|
||||||
|
expr y = c.int_const("y");
|
||||||
|
solver s = tactic(c, "smt").mk_solver();
|
||||||
|
s.add(x > y + 1);
|
||||||
|
std::cout << s.check() << "\n";
|
||||||
|
std::cout << s.get_model() << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void tactic_example6() {
|
||||||
|
/*
|
||||||
|
In this example, we show how to implement a solver for integer arithmetic using SAT.
|
||||||
|
The solver is complete only for problems where every variable has a lower and upper bound.
|
||||||
|
*/
|
||||||
|
std::cout << "tactic example 6\n";
|
||||||
|
context c;
|
||||||
|
params p(c);
|
||||||
|
p.set(":arith-lhs", true);
|
||||||
|
p.set(":som", true); // sum-of-monomials normal form
|
||||||
|
solver s =
|
||||||
|
(with(tactic(c, "simplify"), p) &
|
||||||
|
tactic(c, "normalize-bounds") &
|
||||||
|
tactic(c, "lia2pb") &
|
||||||
|
tactic(c, "pb2bv") &
|
||||||
|
tactic(c, "bit-blast") &
|
||||||
|
tactic(c, "sat")).mk_solver();
|
||||||
|
expr x = c.int_const("x");
|
||||||
|
expr y = c.int_const("y");
|
||||||
|
expr z = c.int_const("z");
|
||||||
|
s.add(x > 0 && x < 10);
|
||||||
|
s.add(y > 0 && y < 10);
|
||||||
|
s.add(z > 0 && z < 10);
|
||||||
|
s.add(3*y + 2*x == z);
|
||||||
|
std::cout << s.check() << "\n";
|
||||||
|
std::cout << s.get_model() << "\n";
|
||||||
|
s.reset();
|
||||||
|
s.add(3*y + 2*x == z);
|
||||||
|
std::cout << s.check() << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void tactic_example7() {
|
||||||
|
/*
|
||||||
|
Tactics can be combined with solvers.
|
||||||
|
For example, we can apply a tactic to a goal, produced a set of subgoals,
|
||||||
|
then select one of the subgoals and solve it using a solver.
|
||||||
|
This example demonstrates how to do that, and
|
||||||
|
how to use model converters to convert a model for a subgoal into a model for the original goal.
|
||||||
|
*/
|
||||||
|
std::cout << "tactic example 7\n";
|
||||||
|
context c;
|
||||||
|
tactic t =
|
||||||
|
tactic(c, "simplify") &
|
||||||
|
tactic(c, "normalize-bounds") &
|
||||||
|
tactic(c, "solve-eqs");
|
||||||
|
expr x = c.int_const("x");
|
||||||
|
expr y = c.int_const("y");
|
||||||
|
expr z = c.int_const("z");
|
||||||
|
goal g(c);
|
||||||
|
g.add(x > 10);
|
||||||
|
g.add(y == x + 3);
|
||||||
|
g.add(z > y);
|
||||||
|
apply_result r = t(g);
|
||||||
|
// r contains only one subgoal
|
||||||
|
std::cout << r << "\n";
|
||||||
|
solver s(c);
|
||||||
|
goal subgoal = r[0];
|
||||||
|
for (unsigned i = 0; i < subgoal.size(); i++) {
|
||||||
|
s.add(subgoal[i]);
|
||||||
|
}
|
||||||
|
std::cout << s.check() << "\n";
|
||||||
|
model m = s.get_model();
|
||||||
|
std::cout << "model for subgoal:\n" << m << "\n";
|
||||||
|
std::cout << "model for original goal:\n" << r.convert_model(m) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void tactic_example8() {
|
||||||
|
/*
|
||||||
|
Probes (aka formula measures) are evaluated over goals.
|
||||||
|
Boolean expressions over them can be built using relational operators and Boolean connectives.
|
||||||
|
The tactic fail_if(cond) fails if the given goal does not satisfy the condition cond.
|
||||||
|
Many numeric and Boolean measures are available in Z3.
|
||||||
|
|
||||||
|
In this example, we build a simple tactic using fail_if.
|
||||||
|
It also shows that a probe can be applied directly to a goal.
|
||||||
|
*/
|
||||||
|
std::cout << "tactic example 8\n";
|
||||||
|
context c;
|
||||||
|
|
||||||
|
expr x = c.int_const("x");
|
||||||
|
expr y = c.int_const("y");
|
||||||
|
expr z = c.int_const("z");
|
||||||
|
|
||||||
|
goal g(c);
|
||||||
|
g.add(x + y + z > 0);
|
||||||
|
|
||||||
|
probe p(c, "num-consts");
|
||||||
|
std::cout << "num-consts: " << p(g) << "\n";
|
||||||
|
|
||||||
|
tactic t = fail_if(p > 2);
|
||||||
|
try {
|
||||||
|
t(g);
|
||||||
|
}
|
||||||
|
catch (exception) {
|
||||||
|
std::cout << "tactic failed...\n";
|
||||||
|
}
|
||||||
|
std::cout << "trying again...\n";
|
||||||
|
g.reset();
|
||||||
|
g.add(x + y > 0);
|
||||||
|
std::cout << t(g) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void tactic_example9() {
|
||||||
|
/*
|
||||||
|
The combinator (tactical) cond(p, t1, t2) is a shorthand for:
|
||||||
|
|
||||||
|
(fail_if(p) & t1) | t2
|
||||||
|
|
||||||
|
The combinator when(p, t) is a shorthand for:
|
||||||
|
|
||||||
|
cond(p, t, tactic(c, "skip"))
|
||||||
|
|
||||||
|
The tactic skip just returns the input goal.
|
||||||
|
This example demonstrates how to use the cond combinator.
|
||||||
|
*/
|
||||||
|
std::cout << "tactic example 9\n";
|
||||||
|
context c;
|
||||||
|
|
||||||
|
expr x = c.int_const("x");
|
||||||
|
expr y = c.int_const("y");
|
||||||
|
expr z = c.int_const("z");
|
||||||
|
|
||||||
|
goal g(c);
|
||||||
|
g.add(x*x - y*y >= 0);
|
||||||
|
|
||||||
|
probe p(c, "num-consts");
|
||||||
|
tactic t = cond(p > 2, tactic(c, "simplify"), tactic(c, "factor"));
|
||||||
|
std::cout << t(g) << "\n";
|
||||||
|
|
||||||
|
g.reset();
|
||||||
|
g.add(x + x + y + z >= 0);
|
||||||
|
g.add(x*x - y*y >= 0);
|
||||||
|
std::cout << t(g) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void visit(expr const & e) {
|
||||||
|
if (e.is_app()) {
|
||||||
|
unsigned num = e.num_args();
|
||||||
|
for (unsigned i = 0; i < num; i++) {
|
||||||
|
visit(e.arg(i));
|
||||||
|
}
|
||||||
|
// do something
|
||||||
|
// Example: print the visited expression
|
||||||
|
func_decl f = e.decl();
|
||||||
|
std::cout << "application of " << f.name() << ": " << e << "\n";
|
||||||
|
}
|
||||||
|
else if (e.is_quantifier()) {
|
||||||
|
visit(e.body());
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
assert(e.is_var());
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_visit() {
|
||||||
|
std::cout << "visit example\n";
|
||||||
|
context c;
|
||||||
|
|
||||||
|
expr x = c.int_const("x");
|
||||||
|
expr y = c.int_const("y");
|
||||||
|
expr z = c.int_const("z");
|
||||||
|
expr f = x*x - y*y >= 0;
|
||||||
|
|
||||||
|
visit(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
try {
|
||||||
|
demorgan(); std::cout << "\n";
|
||||||
|
find_model_example1(); std::cout << "\n";
|
||||||
|
prove_example1(); std::cout << "\n";
|
||||||
|
prove_example2(); std::cout << "\n";
|
||||||
|
nonlinear_example1(); std::cout << "\n";
|
||||||
|
bitvector_example1(); std::cout << "\n";
|
||||||
|
bitvector_example2(); std::cout << "\n";
|
||||||
|
capi_example(); std::cout << "\n";
|
||||||
|
eval_example1(); std::cout << "\n";
|
||||||
|
two_contexts_example1(); std::cout << "\n";
|
||||||
|
error_example(); std::cout << "\n";
|
||||||
|
numeral_example(); std::cout << "\n";
|
||||||
|
ite_example(); std::cout << "\n";
|
||||||
|
unsat_core_example(); std::cout << "\n";
|
||||||
|
tactic_example1(); std::cout << "\n";
|
||||||
|
tactic_example2(); std::cout << "\n";
|
||||||
|
tactic_example3(); std::cout << "\n";
|
||||||
|
tactic_example4(); std::cout << "\n";
|
||||||
|
tactic_example5(); std::cout << "\n";
|
||||||
|
tactic_example6(); std::cout << "\n";
|
||||||
|
tactic_example7(); std::cout << "\n";
|
||||||
|
tactic_example8(); std::cout << "\n";
|
||||||
|
tactic_example9(); std::cout << "\n";
|
||||||
|
tst_visit(); std::cout << "\n";
|
||||||
|
std::cout << "done\n";
|
||||||
|
}
|
||||||
|
catch (exception & ex) {
|
||||||
|
std::cout << "unexpected error: " << ex << "\n";
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
2
c++/exec-external-linux.sh
Normal file
2
c++/exec-external-linux.sh
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export LD_LIBRARY_PATH=../../lib:$LD_LIBRARY_PATH
|
||||||
|
./example
|
2
c++/exec-external-osx.sh
Normal file
2
c++/exec-external-osx.sh
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export DYLD_LIBRARY_PATH=../../lib:$DYLD_LIBRARY_PATH
|
||||||
|
./example
|
5
c++/exec-external.cmd
Normal file
5
c++/exec-external.cmd
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
@echo off
|
||||||
|
SETLOCAL
|
||||||
|
set PATH=..\..\bin;%PATH%
|
||||||
|
example.exe
|
||||||
|
ENDLOCAL
|
2
c++/exec-external.sh
Normal file
2
c++/exec-external.sh
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export PATH=../../bin:$PATH
|
||||||
|
./example.exe
|
1342
c++/z3++.h
Normal file
1342
c++/z3++.h
Normal file
File diff suppressed because it is too large
Load diff
113
configure.in
Normal file
113
configure.in
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
AC_PREREQ(2.50)
|
||||||
|
AC_INIT(lib/util.h)
|
||||||
|
|
||||||
|
ARITH="internal"
|
||||||
|
AC_ARG_WITH([gmp], [AS_HELP_STRING([--with-gmp], [Use GMP for multi-precision naturals (default=no)])], [use_gmp=yes], [use_gmp=no])
|
||||||
|
AS_IF([test "$use_gmp" = "yes"],[
|
||||||
|
ARITH="gmp"
|
||||||
|
CPPFLAGS="$CPPFLAGS -D_MP_GMP"
|
||||||
|
],[
|
||||||
|
CPPFLAGS="$CPPFLAGS -D_MP_INTERNAL"
|
||||||
|
])
|
||||||
|
AC_SUBST(EXTRA_LIB_SRCS)
|
||||||
|
|
||||||
|
AC_PATH_PROG([D2U], [dos2unix], [no], [~/bin$PATH_SEPARATOR$PATH])
|
||||||
|
AS_IF([test "$D2U" = "no"], [AC_MSG_ERROR(dos2unix not found)])
|
||||||
|
AC_SUBST(D2U)
|
||||||
|
|
||||||
|
AC_PROG_CXX(g++)
|
||||||
|
AC_PROG_MAKE_SET
|
||||||
|
|
||||||
|
AC_LANG_CPLUSPLUS
|
||||||
|
|
||||||
|
host_os=`uname -s`
|
||||||
|
|
||||||
|
AS_IF([test "$host_os" = "Darwin"], [
|
||||||
|
PLATFORM=osx
|
||||||
|
SO_EXT=dylib
|
||||||
|
SLIBFLAGS="-dynamiclib -fopenmp"
|
||||||
|
COMP_VERSIONS="-compatibility_version \$(Z3_VERSION) -current_version \$(Z3_VERSION)"
|
||||||
|
STATIC_FLAGS=
|
||||||
|
CPPFLAGS+=" -mmacosx-version-min=10.4"
|
||||||
|
], [test "$host_os" = "Linux"], [
|
||||||
|
PLATFORM=linux
|
||||||
|
SO_EXT=so
|
||||||
|
LDFLAGS=-lrt
|
||||||
|
SLIBFLAGS="-shared -fopenmp"
|
||||||
|
COMP_VERSIONS=
|
||||||
|
STATIC_FLAGS=-static
|
||||||
|
], [
|
||||||
|
AC_MSG_ERROR([Unknown host platform: $host_os])
|
||||||
|
])
|
||||||
|
AC_SUBST(PLATFORM)
|
||||||
|
AC_SUBST(SO_EXT)
|
||||||
|
AC_SUBST(SLIBFLAGS)
|
||||||
|
AC_SUBST(COMP_VERSIONS)
|
||||||
|
AC_SUBST(STATIC_FLAGS)
|
||||||
|
|
||||||
|
cat > tst64.c <<EOF
|
||||||
|
int main() {
|
||||||
|
return sizeof(unsigned) == sizeof(void*);
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
AC_SUBST(EXTRA_LIBS)
|
||||||
|
|
||||||
|
g++ $CPPFLAGS tst64.c -o tst64
|
||||||
|
if ./tst64; then
|
||||||
|
dnl In 64-bit systems we have to compile using -fPIC
|
||||||
|
CPPFLAGS="$CPPFLAGS -D_AMD64_"
|
||||||
|
dnl Only enable use of thread local storage for 64-bit Linux. It is disabled for OSX and 32-bit Linux
|
||||||
|
if test $PLATFORM = "linux"; then
|
||||||
|
CPPFLAGS="$CPPFLAGS -D_USE_THREAD_LOCAL"
|
||||||
|
fi
|
||||||
|
CXXFLAGS="-fPIC"
|
||||||
|
EXTRA_LIBS=""
|
||||||
|
dnl Rewrite -lz3-gmp to -lz3 in the files:
|
||||||
|
dnl - test_capi/build-external-linux.sh
|
||||||
|
dnl - test_user_theory/build-external-linux.sh
|
||||||
|
dnl Reason: the library libz3-gmp.so is not available in 64-bit systems
|
||||||
|
dnl sed 's|lz3-gmp|lz3|' test_capi/build-external-linux.sh > tmp.sh
|
||||||
|
dnl mv tmp.sh test_capi/build-external-linux.sh
|
||||||
|
dnl sed 's|lz3-gmp|lz3|' test_user_theory/build-external-linux.sh > tmp.sh
|
||||||
|
dnl mv tmp.sh test_user_theory/build-external-linux.sh
|
||||||
|
else
|
||||||
|
CXXFLAGS=""
|
||||||
|
dnl In 64-bit systems it is not possible to build a dynamic library using static gmp.
|
||||||
|
dnl EXTRA_LIBS="\$(BIN_DIR)/lib\$(Z3)-gmp.so"
|
||||||
|
fi
|
||||||
|
rm -f tst64.c
|
||||||
|
rm -f tst64
|
||||||
|
|
||||||
|
AC_SUBST(GMP_STATIC_LIB)
|
||||||
|
GMP_STATIC_LIB=""
|
||||||
|
|
||||||
|
if test "$ARITH" = "gmp"; then
|
||||||
|
AC_CHECK_HEADER([gmp.h], GMP='gmp', AC_MSG_ERROR([GMP include file not found]))
|
||||||
|
AC_SUBST(LIBS)
|
||||||
|
AC_CHECK_LIB(gmp, __gmpz_cmp, LIBS="-lgmp $LIBS", AC_MSG_ERROR([GMP library not found]))
|
||||||
|
dnl Look for libgmp.a at /usr/local/lib and /usr/lib
|
||||||
|
dnl TODO: make the following test more robust...
|
||||||
|
if test -e /usr/local/lib/libgmp.a; then
|
||||||
|
GMP_STATIC_LIB="/usr/local/lib/libgmp.a"
|
||||||
|
else if test -e /usr/lib/libgmp.a; then
|
||||||
|
GMP_STATIC_LIB="/usr/lib/libgmp.a"
|
||||||
|
else if test -e /usr/lib/libgmp.dll.a; then
|
||||||
|
GMP_STATIC_LIB="/usr/lib/libgmp.dll.a"
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([Failed to find libgmp.a])
|
||||||
|
fi fi fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_PROG_CXXCPP
|
||||||
|
|
||||||
|
AC_OUTPUT(Makefile)
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
Z3 was configured with success.
|
||||||
|
Host platform: $PLATFORM
|
||||||
|
Arithmetic: $ARITH
|
||||||
|
|
||||||
|
Type 'make' to compile Z3.
|
||||||
|
EOF
|
27
dll/dll.cpp
Normal file
27
dll/dll.cpp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
#include "windows.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _MANAGED
|
||||||
|
#pragma managed(push, off)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||||
|
DWORD ul_reason_for_call,
|
||||||
|
LPVOID lpReserved
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (ul_reason_for_call)
|
||||||
|
{
|
||||||
|
case DLL_PROCESS_ATTACH:
|
||||||
|
case DLL_THREAD_ATTACH:
|
||||||
|
case DLL_THREAD_DETACH:
|
||||||
|
case DLL_PROCESS_DETACH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _MANAGED
|
||||||
|
#pragma managed(pop)
|
||||||
|
#endif
|
101
dll/dll.rc
Normal file
101
dll/dll.rc
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "afxres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (U.S.) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"#include ""afxres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION 4,2,0,0
|
||||||
|
PRODUCTVERSION 4,2,0,0
|
||||||
|
FILEFLAGSMASK 0x17L
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x4L
|
||||||
|
FILETYPE 0x2L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "FileDescription", "Z3 Dynamic Link Library"
|
||||||
|
VALUE "FileVersion" "4,2,0,0"
|
||||||
|
VALUE "InternalName", "Z3 DLL"
|
||||||
|
VALUE "LegalCopyright", "(c) Microsoft Corporation. All rights reserved."
|
||||||
|
VALUE "OriginalFilename", "z3.dll"
|
||||||
|
VALUE "ProductName", "Z3"
|
||||||
|
VALUE "ProductVersion", "4,2,0,0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // English (U.S.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
1340
dll/dll.vcxproj
Normal file
1340
dll/dll.vcxproj
Normal file
File diff suppressed because it is too large
Load diff
3
dll/dll.vcxproj.user
Normal file
3
dll/dll.vcxproj.user
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
24
dll/mk_def.py
Normal file
24
dll/mk_def.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import re
|
||||||
|
|
||||||
|
pat1 = re.compile(".*Z3_API.*")
|
||||||
|
api = open('..\lib\z3_api.h', 'r')
|
||||||
|
|
||||||
|
z3def = open('z3.def', 'w')
|
||||||
|
z3dbgdef = open('z3_dbg.def', 'w')
|
||||||
|
|
||||||
|
z3def.write('LIBRARY "Z3"\nEXPORTS\n')
|
||||||
|
z3dbgdef.write('LIBRARY "Z3_DBG"\nEXPORTS\n')
|
||||||
|
|
||||||
|
num = 1
|
||||||
|
for line in api:
|
||||||
|
m = pat1.match(line)
|
||||||
|
if m:
|
||||||
|
words = re.split('\W+', line)
|
||||||
|
i = 0
|
||||||
|
for w in words:
|
||||||
|
if w == 'Z3_API':
|
||||||
|
f = words[i+1]
|
||||||
|
z3def.write('\t%s @%s\n' % (f, num))
|
||||||
|
z3dbgdef.write('\t%s @%s\n' % (f, num))
|
||||||
|
i = i + 1
|
||||||
|
num = num + 1
|
14
dll/resource.h
Normal file
14
dll/resource.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by dll.rc
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
521
dll/z3.def
Normal file
521
dll/z3.def
Normal file
|
@ -0,0 +1,521 @@
|
||||||
|
LIBRARY "Z3"
|
||||||
|
EXPORTS
|
||||||
|
Z3_mk_config @1
|
||||||
|
Z3_del_config @2
|
||||||
|
Z3_set_param_value @3
|
||||||
|
Z3_mk_context @4
|
||||||
|
Z3_mk_context_rc @5
|
||||||
|
Z3_del_context @6
|
||||||
|
Z3_inc_ref @7
|
||||||
|
Z3_dec_ref @8
|
||||||
|
Z3_update_param_value @9
|
||||||
|
Z3_get_param_value @10
|
||||||
|
Z3_interrupt @11
|
||||||
|
Z3_mk_params @12
|
||||||
|
Z3_params_inc_ref @13
|
||||||
|
Z3_params_dec_ref @14
|
||||||
|
Z3_params_set_bool @15
|
||||||
|
Z3_params_set_uint @16
|
||||||
|
Z3_params_set_double @17
|
||||||
|
Z3_params_set_symbol @18
|
||||||
|
Z3_params_to_string @19
|
||||||
|
Z3_params_validate @20
|
||||||
|
Z3_param_descrs_inc_ref @21
|
||||||
|
Z3_param_descrs_dec_ref @22
|
||||||
|
Z3_param_descrs_get_kind @23
|
||||||
|
Z3_param_descrs_size @24
|
||||||
|
Z3_param_descrs_get_name @25
|
||||||
|
Z3_mk_int_symbol @26
|
||||||
|
Z3_mk_string_symbol @27
|
||||||
|
Z3_mk_uninterpreted_sort @28
|
||||||
|
Z3_mk_bool_sort @29
|
||||||
|
Z3_mk_int_sort @30
|
||||||
|
Z3_mk_real_sort @31
|
||||||
|
Z3_mk_bv_sort @32
|
||||||
|
Z3_mk_finite_domain_sort @33
|
||||||
|
Z3_mk_array_sort @34
|
||||||
|
Z3_mk_tuple_sort @35
|
||||||
|
Z3_mk_enumeration_sort @36
|
||||||
|
Z3_mk_list_sort @37
|
||||||
|
Z3_mk_constructor @38
|
||||||
|
Z3_del_constructor @39
|
||||||
|
Z3_mk_datatype @40
|
||||||
|
Z3_mk_constructor_list @41
|
||||||
|
Z3_del_constructor_list @42
|
||||||
|
Z3_mk_datatypes @43
|
||||||
|
Z3_query_constructor @44
|
||||||
|
Z3_mk_func_decl @45
|
||||||
|
Z3_mk_app @46
|
||||||
|
Z3_mk_const @47
|
||||||
|
Z3_mk_fresh_func_decl @48
|
||||||
|
Z3_mk_fresh_const @49
|
||||||
|
Z3_mk_true @50
|
||||||
|
Z3_mk_false @51
|
||||||
|
Z3_mk_eq @52
|
||||||
|
Z3_mk_distinct @53
|
||||||
|
Z3_mk_not @54
|
||||||
|
Z3_mk_ite @55
|
||||||
|
Z3_mk_iff @56
|
||||||
|
Z3_mk_implies @57
|
||||||
|
Z3_mk_xor @58
|
||||||
|
Z3_mk_and @59
|
||||||
|
Z3_mk_or @60
|
||||||
|
Z3_mk_add @61
|
||||||
|
Z3_mk_mul @62
|
||||||
|
Z3_mk_sub @63
|
||||||
|
Z3_mk_unary_minus @64
|
||||||
|
Z3_mk_div @65
|
||||||
|
Z3_mk_mod @66
|
||||||
|
Z3_mk_rem @67
|
||||||
|
Z3_mk_power @68
|
||||||
|
Z3_mk_lt @69
|
||||||
|
Z3_mk_le @70
|
||||||
|
Z3_mk_gt @71
|
||||||
|
Z3_mk_ge @72
|
||||||
|
Z3_mk_int2real @73
|
||||||
|
Z3_mk_real2int @74
|
||||||
|
Z3_mk_is_int @75
|
||||||
|
Z3_mk_bvnot @76
|
||||||
|
Z3_mk_bvredand @77
|
||||||
|
Z3_mk_bvredor @78
|
||||||
|
Z3_mk_bvand @79
|
||||||
|
Z3_mk_bvor @80
|
||||||
|
Z3_mk_bvxor @81
|
||||||
|
Z3_mk_bvnand @82
|
||||||
|
Z3_mk_bvnor @83
|
||||||
|
Z3_mk_bvxnor @84
|
||||||
|
Z3_mk_bvneg @85
|
||||||
|
Z3_mk_bvadd @86
|
||||||
|
Z3_mk_bvsub @87
|
||||||
|
Z3_mk_bvmul @88
|
||||||
|
Z3_mk_bvudiv @89
|
||||||
|
Z3_mk_bvsdiv @90
|
||||||
|
Z3_mk_bvurem @91
|
||||||
|
Z3_mk_bvsrem @92
|
||||||
|
Z3_mk_bvsmod @93
|
||||||
|
Z3_mk_bvult @94
|
||||||
|
Z3_mk_bvslt @95
|
||||||
|
Z3_mk_bvule @96
|
||||||
|
Z3_mk_bvsle @97
|
||||||
|
Z3_mk_bvuge @98
|
||||||
|
Z3_mk_bvsge @99
|
||||||
|
Z3_mk_bvugt @100
|
||||||
|
Z3_mk_bvsgt @101
|
||||||
|
Z3_mk_concat @102
|
||||||
|
Z3_mk_extract @103
|
||||||
|
Z3_mk_sign_ext @104
|
||||||
|
Z3_mk_zero_ext @105
|
||||||
|
Z3_mk_repeat @106
|
||||||
|
Z3_mk_bvshl @107
|
||||||
|
Z3_mk_bvlshr @108
|
||||||
|
Z3_mk_bvashr @109
|
||||||
|
Z3_mk_rotate_left @110
|
||||||
|
Z3_mk_rotate_right @111
|
||||||
|
Z3_mk_ext_rotate_left @112
|
||||||
|
Z3_mk_ext_rotate_right @113
|
||||||
|
Z3_mk_int2bv @114
|
||||||
|
Z3_mk_bv2int @115
|
||||||
|
Z3_mk_bvadd_no_overflow @116
|
||||||
|
Z3_mk_bvadd_no_underflow @117
|
||||||
|
Z3_mk_bvsub_no_overflow @118
|
||||||
|
Z3_mk_bvsub_no_underflow @119
|
||||||
|
Z3_mk_bvsdiv_no_overflow @120
|
||||||
|
Z3_mk_bvneg_no_overflow @121
|
||||||
|
Z3_mk_bvmul_no_overflow @122
|
||||||
|
Z3_mk_bvmul_no_underflow @123
|
||||||
|
Z3_mk_select @124
|
||||||
|
Z3_mk_store @125
|
||||||
|
Z3_mk_const_array @126
|
||||||
|
Z3_mk_map @127
|
||||||
|
Z3_mk_array_default @128
|
||||||
|
Z3_mk_set_sort @129
|
||||||
|
Z3_mk_empty_set @130
|
||||||
|
Z3_mk_full_set @131
|
||||||
|
Z3_mk_set_add @132
|
||||||
|
Z3_mk_set_del @133
|
||||||
|
Z3_mk_set_union @134
|
||||||
|
Z3_mk_set_intersect @135
|
||||||
|
Z3_mk_set_difference @136
|
||||||
|
Z3_mk_set_complement @137
|
||||||
|
Z3_mk_set_member @138
|
||||||
|
Z3_mk_set_subset @139
|
||||||
|
Z3_mk_numeral @140
|
||||||
|
Z3_mk_real @141
|
||||||
|
Z3_mk_int @142
|
||||||
|
Z3_mk_unsigned_int @143
|
||||||
|
Z3_mk_int64 @144
|
||||||
|
Z3_mk_unsigned_int64 @145
|
||||||
|
Z3_mk_pattern @146
|
||||||
|
Z3_mk_bound @147
|
||||||
|
Z3_mk_forall @148
|
||||||
|
Z3_mk_exists @149
|
||||||
|
Z3_mk_quantifier @150
|
||||||
|
Z3_mk_quantifier_ex @151
|
||||||
|
Z3_mk_forall_const @152
|
||||||
|
Z3_mk_exists_const @153
|
||||||
|
Z3_mk_quantifier_const @154
|
||||||
|
Z3_mk_quantifier_const_ex @155
|
||||||
|
Z3_get_symbol_kind @156
|
||||||
|
Z3_get_symbol_int @157
|
||||||
|
Z3_get_symbol_string @158
|
||||||
|
Z3_get_sort_name @159
|
||||||
|
Z3_get_sort_id @160
|
||||||
|
Z3_sort_to_ast @161
|
||||||
|
Z3_is_eq_sort @162
|
||||||
|
Z3_get_sort_kind @163
|
||||||
|
Z3_get_bv_sort_size @164
|
||||||
|
Z3_get_finite_domain_sort_size @165
|
||||||
|
Z3_get_array_sort_domain @166
|
||||||
|
Z3_get_array_sort_range @167
|
||||||
|
Z3_get_tuple_sort_mk_decl @168
|
||||||
|
Z3_get_tuple_sort_num_fields @169
|
||||||
|
Z3_get_tuple_sort_field_decl @170
|
||||||
|
Z3_get_datatype_sort_num_constructors @171
|
||||||
|
Z3_get_datatype_sort_constructor @172
|
||||||
|
Z3_get_datatype_sort_recognizer @173
|
||||||
|
Z3_get_datatype_sort_constructor_accessor @174
|
||||||
|
Z3_get_relation_arity @175
|
||||||
|
Z3_get_relation_column @176
|
||||||
|
Z3_func_decl_to_ast @177
|
||||||
|
Z3_is_eq_func_decl @178
|
||||||
|
Z3_get_func_decl_id @179
|
||||||
|
Z3_get_decl_name @180
|
||||||
|
Z3_get_decl_kind @181
|
||||||
|
Z3_get_domain_size @182
|
||||||
|
Z3_get_arity @183
|
||||||
|
Z3_get_domain @184
|
||||||
|
Z3_get_range @185
|
||||||
|
Z3_get_decl_num_parameters @186
|
||||||
|
Z3_get_decl_parameter_kind @187
|
||||||
|
Z3_get_decl_int_parameter @188
|
||||||
|
Z3_get_decl_double_parameter @189
|
||||||
|
Z3_get_decl_symbol_parameter @190
|
||||||
|
Z3_get_decl_sort_parameter @191
|
||||||
|
Z3_get_decl_ast_parameter @192
|
||||||
|
Z3_get_decl_func_decl_parameter @193
|
||||||
|
Z3_get_decl_rational_parameter @194
|
||||||
|
Z3_app_to_ast @195
|
||||||
|
Z3_get_app_decl @196
|
||||||
|
Z3_get_app_num_args @197
|
||||||
|
Z3_get_app_arg @198
|
||||||
|
Z3_is_eq_ast @199
|
||||||
|
Z3_get_ast_id @200
|
||||||
|
Z3_get_ast_hash @201
|
||||||
|
Z3_get_sort @202
|
||||||
|
Z3_is_well_sorted @203
|
||||||
|
Z3_get_bool_value @204
|
||||||
|
Z3_get_ast_kind @205
|
||||||
|
Z3_is_app @206
|
||||||
|
Z3_is_numeral_ast @207
|
||||||
|
Z3_is_algebraic_number @208
|
||||||
|
Z3_to_app @209
|
||||||
|
Z3_to_func_decl @210
|
||||||
|
Z3_get_numeral_string @211
|
||||||
|
Z3_get_numeral_decimal_string @212
|
||||||
|
Z3_get_numerator @213
|
||||||
|
Z3_get_denominator @214
|
||||||
|
Z3_get_numeral_small @215
|
||||||
|
Z3_get_numeral_int @216
|
||||||
|
Z3_get_numeral_uint @217
|
||||||
|
Z3_get_numeral_uint64 @218
|
||||||
|
Z3_get_numeral_int64 @219
|
||||||
|
Z3_get_numeral_rational_int64 @220
|
||||||
|
Z3_get_algebraic_number_lower @221
|
||||||
|
Z3_get_algebraic_number_upper @222
|
||||||
|
Z3_pattern_to_ast @223
|
||||||
|
Z3_get_pattern_num_terms @224
|
||||||
|
Z3_get_pattern @225
|
||||||
|
Z3_get_index_value @226
|
||||||
|
Z3_is_quantifier_forall @227
|
||||||
|
Z3_get_quantifier_weight @228
|
||||||
|
Z3_get_quantifier_num_patterns @229
|
||||||
|
Z3_get_quantifier_pattern_ast @230
|
||||||
|
Z3_get_quantifier_num_no_patterns @231
|
||||||
|
Z3_get_quantifier_no_pattern_ast @232
|
||||||
|
Z3_get_quantifier_bound_name @233
|
||||||
|
Z3_get_quantifier_bound_sort @234
|
||||||
|
Z3_get_quantifier_body @235
|
||||||
|
Z3_get_quantifier_num_bound @236
|
||||||
|
Z3_simplify @237
|
||||||
|
Z3_simplify_ex @238
|
||||||
|
Z3_simplify_get_help @239
|
||||||
|
Z3_simplify_get_param_descrs @240
|
||||||
|
Z3_update_term @241
|
||||||
|
Z3_substitute @242
|
||||||
|
Z3_substitute_vars @243
|
||||||
|
Z3_translate @244
|
||||||
|
Z3_model_inc_ref @245
|
||||||
|
Z3_model_dec_ref @246
|
||||||
|
Z3_model_eval @247
|
||||||
|
Z3_model_get_const_interp @248
|
||||||
|
Z3_model_get_func_interp @249
|
||||||
|
Z3_model_get_num_consts @250
|
||||||
|
Z3_model_get_const_decl @251
|
||||||
|
Z3_model_get_num_funcs @252
|
||||||
|
Z3_model_get_func_decl @253
|
||||||
|
Z3_model_get_num_sorts @254
|
||||||
|
Z3_model_get_sort @255
|
||||||
|
Z3_model_get_sort_universe @256
|
||||||
|
Z3_is_as_array @257
|
||||||
|
Z3_get_as_array_func_decl @258
|
||||||
|
Z3_func_interp_inc_ref @259
|
||||||
|
Z3_func_interp_dec_ref @260
|
||||||
|
Z3_func_interp_get_num_entries @261
|
||||||
|
Z3_func_interp_get_entry @262
|
||||||
|
Z3_func_interp_get_else @263
|
||||||
|
Z3_func_interp_get_arity @264
|
||||||
|
Z3_func_entry_inc_ref @265
|
||||||
|
Z3_func_entry_dec_ref @266
|
||||||
|
Z3_func_entry_get_value @267
|
||||||
|
Z3_func_entry_get_num_args @268
|
||||||
|
Z3_func_entry_get_arg @269
|
||||||
|
Z3_open_log @270
|
||||||
|
Z3_append_log @271
|
||||||
|
Z3_close_log @272
|
||||||
|
Z3_toggle_warning_messages @273
|
||||||
|
Z3_set_ast_print_mode @274
|
||||||
|
Z3_ast_to_string @275
|
||||||
|
Z3_pattern_to_string @276
|
||||||
|
Z3_sort_to_string @277
|
||||||
|
Z3_func_decl_to_string @278
|
||||||
|
Z3_model_to_string @279
|
||||||
|
Z3_benchmark_to_smtlib_string @280
|
||||||
|
Z3_parse_smtlib2_string @281
|
||||||
|
Z3_parse_smtlib2_file @282
|
||||||
|
Z3_parse_smtlib_string @283
|
||||||
|
Z3_parse_smtlib_file @284
|
||||||
|
Z3_get_smtlib_num_formulas @285
|
||||||
|
Z3_get_smtlib_formula @286
|
||||||
|
Z3_get_smtlib_num_assumptions @287
|
||||||
|
Z3_get_smtlib_assumption @288
|
||||||
|
Z3_get_smtlib_num_decls @289
|
||||||
|
Z3_get_smtlib_decl @290
|
||||||
|
Z3_get_smtlib_num_sorts @291
|
||||||
|
Z3_get_smtlib_sort @292
|
||||||
|
Z3_get_smtlib_error @293
|
||||||
|
Z3_parse_z3_string @294
|
||||||
|
Z3_parse_z3_file @295
|
||||||
|
Z3_get_error_code @296
|
||||||
|
Z3_set_error_handler @297
|
||||||
|
Z3_set_error @298
|
||||||
|
Z3_get_error_msg @299
|
||||||
|
Z3_get_error_msg_ex @300
|
||||||
|
Z3_get_version @301
|
||||||
|
Z3_reset_memory @302
|
||||||
|
Z3_mk_theory @303
|
||||||
|
Z3_theory_get_ext_data @304
|
||||||
|
Z3_theory_mk_sort @305
|
||||||
|
Z3_theory_mk_value @306
|
||||||
|
Z3_theory_mk_constant @307
|
||||||
|
Z3_theory_mk_func_decl @308
|
||||||
|
Z3_theory_get_context @309
|
||||||
|
Z3_set_delete_callback @310
|
||||||
|
Z3_set_reduce_app_callback @311
|
||||||
|
Z3_set_reduce_eq_callback @312
|
||||||
|
Z3_set_reduce_distinct_callback @313
|
||||||
|
Z3_set_new_app_callback @314
|
||||||
|
Z3_set_new_elem_callback @315
|
||||||
|
Z3_set_init_search_callback @316
|
||||||
|
Z3_set_push_callback @317
|
||||||
|
Z3_set_pop_callback @318
|
||||||
|
Z3_set_restart_callback @319
|
||||||
|
Z3_set_reset_callback @320
|
||||||
|
Z3_set_final_check_callback @321
|
||||||
|
Z3_set_new_eq_callback @322
|
||||||
|
Z3_set_new_diseq_callback @323
|
||||||
|
Z3_set_new_assignment_callback @324
|
||||||
|
Z3_set_new_relevant_callback @325
|
||||||
|
Z3_theory_assert_axiom @326
|
||||||
|
Z3_theory_assume_eq @327
|
||||||
|
Z3_theory_enable_axiom_simplification @328
|
||||||
|
Z3_theory_get_eqc_root @329
|
||||||
|
Z3_theory_get_eqc_next @330
|
||||||
|
Z3_theory_get_num_parents @331
|
||||||
|
Z3_theory_get_parent @332
|
||||||
|
Z3_theory_is_value @333
|
||||||
|
Z3_theory_is_decl @334
|
||||||
|
Z3_theory_get_num_elems @335
|
||||||
|
Z3_theory_get_elem @336
|
||||||
|
Z3_theory_get_num_apps @337
|
||||||
|
Z3_theory_get_app @338
|
||||||
|
Z3_mk_fixedpoint @339
|
||||||
|
Z3_fixedpoint_inc_ref @340
|
||||||
|
Z3_fixedpoint_dec_ref @341
|
||||||
|
Z3_fixedpoint_add_rule @342
|
||||||
|
Z3_fixedpoint_add_fact @343
|
||||||
|
Z3_fixedpoint_assert @344
|
||||||
|
Z3_fixedpoint_query @345
|
||||||
|
Z3_fixedpoint_query_relations @346
|
||||||
|
Z3_fixedpoint_get_answer @347
|
||||||
|
Z3_fixedpoint_get_reason_unknown @348
|
||||||
|
Z3_fixedpoint_update_rule @349
|
||||||
|
Z3_fixedpoint_get_num_levels @350
|
||||||
|
Z3_fixedpoint_get_cover_delta @351
|
||||||
|
Z3_fixedpoint_add_cover @352
|
||||||
|
Z3_fixedpoint_get_statistics @353
|
||||||
|
Z3_fixedpoint_register_relation @354
|
||||||
|
Z3_fixedpoint_set_predicate_representation @355
|
||||||
|
Z3_fixedpoint_simplify_rules @356
|
||||||
|
Z3_fixedpoint_set_params @357
|
||||||
|
Z3_fixedpoint_get_help @358
|
||||||
|
Z3_fixedpoint_get_param_descrs @359
|
||||||
|
Z3_fixedpoint_to_string @360
|
||||||
|
Z3_fixedpoint_push @361
|
||||||
|
Z3_fixedpoint_pop @362
|
||||||
|
Z3_fixedpoint_init @363
|
||||||
|
Z3_fixedpoint_set_reduce_assign_callback @364
|
||||||
|
Z3_fixedpoint_set_reduce_app_callback @365
|
||||||
|
Z3_mk_ast_vector @366
|
||||||
|
Z3_ast_vector_inc_ref @367
|
||||||
|
Z3_ast_vector_dec_ref @368
|
||||||
|
Z3_ast_vector_size @369
|
||||||
|
Z3_ast_vector_get @370
|
||||||
|
Z3_ast_vector_set @371
|
||||||
|
Z3_ast_vector_resize @372
|
||||||
|
Z3_ast_vector_push @373
|
||||||
|
Z3_ast_vector_translate @374
|
||||||
|
Z3_ast_vector_to_string @375
|
||||||
|
Z3_mk_ast_map @376
|
||||||
|
Z3_ast_map_inc_ref @377
|
||||||
|
Z3_ast_map_dec_ref @378
|
||||||
|
Z3_ast_map_contains @379
|
||||||
|
Z3_ast_map_find @380
|
||||||
|
Z3_ast_map_insert @381
|
||||||
|
Z3_ast_map_erase @382
|
||||||
|
Z3_ast_map_reset @383
|
||||||
|
Z3_ast_map_size @384
|
||||||
|
Z3_ast_map_keys @385
|
||||||
|
Z3_ast_map_to_string @386
|
||||||
|
Z3_mk_goal @387
|
||||||
|
Z3_goal_inc_ref @388
|
||||||
|
Z3_goal_dec_ref @389
|
||||||
|
Z3_goal_precision @390
|
||||||
|
Z3_goal_assert @391
|
||||||
|
Z3_goal_inconsistent @392
|
||||||
|
Z3_goal_depth @393
|
||||||
|
Z3_goal_reset @394
|
||||||
|
Z3_goal_size @395
|
||||||
|
Z3_goal_formula @396
|
||||||
|
Z3_goal_num_exprs @397
|
||||||
|
Z3_goal_is_decided_sat @398
|
||||||
|
Z3_goal_is_decided_unsat @399
|
||||||
|
Z3_goal_translate @400
|
||||||
|
Z3_goal_to_string @401
|
||||||
|
Z3_mk_tactic @402
|
||||||
|
Z3_tactic_inc_ref @403
|
||||||
|
Z3_tactic_dec_ref @404
|
||||||
|
Z3_mk_probe @405
|
||||||
|
Z3_probe_inc_ref @406
|
||||||
|
Z3_probe_dec_ref @407
|
||||||
|
Z3_tactic_and_then @408
|
||||||
|
Z3_tactic_or_else @409
|
||||||
|
Z3_tactic_par_or @410
|
||||||
|
Z3_tactic_par_and_then @411
|
||||||
|
Z3_tactic_try_for @412
|
||||||
|
Z3_tactic_when @413
|
||||||
|
Z3_tactic_cond @414
|
||||||
|
Z3_tactic_repeat @415
|
||||||
|
Z3_tactic_skip @416
|
||||||
|
Z3_tactic_fail @417
|
||||||
|
Z3_tactic_fail_if @418
|
||||||
|
Z3_tactic_fail_if_not_decided @419
|
||||||
|
Z3_tactic_using_params @420
|
||||||
|
Z3_probe_const @421
|
||||||
|
Z3_probe_lt @422
|
||||||
|
Z3_probe_gt @423
|
||||||
|
Z3_probe_le @424
|
||||||
|
Z3_probe_ge @425
|
||||||
|
Z3_probe_eq @426
|
||||||
|
Z3_probe_and @427
|
||||||
|
Z3_probe_or @428
|
||||||
|
Z3_probe_not @429
|
||||||
|
Z3_get_num_tactics @430
|
||||||
|
Z3_get_tactic_name @431
|
||||||
|
Z3_get_num_probes @432
|
||||||
|
Z3_get_probe_name @433
|
||||||
|
Z3_tactic_get_help @434
|
||||||
|
Z3_tactic_get_param_descrs @435
|
||||||
|
Z3_tactic_get_descr @436
|
||||||
|
Z3_probe_get_descr @437
|
||||||
|
Z3_probe_apply @438
|
||||||
|
Z3_tactic_apply @439
|
||||||
|
Z3_tactic_apply_ex @440
|
||||||
|
Z3_apply_result_inc_ref @441
|
||||||
|
Z3_apply_result_dec_ref @442
|
||||||
|
Z3_apply_result_to_string @443
|
||||||
|
Z3_apply_result_get_num_subgoals @444
|
||||||
|
Z3_apply_result_get_subgoal @445
|
||||||
|
Z3_apply_result_convert_model @446
|
||||||
|
Z3_mk_solver @447
|
||||||
|
Z3_mk_simple_solver @448
|
||||||
|
Z3_mk_solver_for_logic @449
|
||||||
|
Z3_mk_solver_from_tactic @450
|
||||||
|
Z3_solver_get_help @451
|
||||||
|
Z3_solver_get_param_descrs @452
|
||||||
|
Z3_solver_set_params @453
|
||||||
|
Z3_solver_inc_ref @454
|
||||||
|
Z3_solver_dec_ref @455
|
||||||
|
Z3_solver_push @456
|
||||||
|
Z3_solver_pop @457
|
||||||
|
Z3_solver_reset @458
|
||||||
|
Z3_solver_get_num_scopes @459
|
||||||
|
Z3_solver_assert @460
|
||||||
|
Z3_solver_get_assertions @461
|
||||||
|
Z3_solver_check @462
|
||||||
|
Z3_solver_check_assumptions @463
|
||||||
|
Z3_solver_get_model @464
|
||||||
|
Z3_solver_get_proof @465
|
||||||
|
Z3_solver_get_unsat_core @466
|
||||||
|
Z3_solver_get_reason_unknown @467
|
||||||
|
Z3_solver_get_statistics @468
|
||||||
|
Z3_solver_to_string @469
|
||||||
|
Z3_stats_to_string @470
|
||||||
|
Z3_stats_inc_ref @471
|
||||||
|
Z3_stats_dec_ref @472
|
||||||
|
Z3_stats_size @473
|
||||||
|
Z3_stats_get_key @474
|
||||||
|
Z3_stats_is_uint @475
|
||||||
|
Z3_stats_is_double @476
|
||||||
|
Z3_stats_get_uint_value @477
|
||||||
|
Z3_stats_get_double_value @478
|
||||||
|
Z3_mk_injective_function @479
|
||||||
|
Z3_set_logic @480
|
||||||
|
Z3_push @481
|
||||||
|
Z3_pop @482
|
||||||
|
Z3_get_num_scopes @483
|
||||||
|
Z3_persist_ast @484
|
||||||
|
Z3_assert_cnstr @485
|
||||||
|
Z3_check_and_get_model @486
|
||||||
|
Z3_check @487
|
||||||
|
Z3_check_assumptions @488
|
||||||
|
Z3_get_implied_equalities @489
|
||||||
|
Z3_del_model @490
|
||||||
|
Z3_soft_check_cancel @491
|
||||||
|
Z3_get_search_failure @492
|
||||||
|
Z3_mk_label @493
|
||||||
|
Z3_get_relevant_labels @494
|
||||||
|
Z3_get_relevant_literals @495
|
||||||
|
Z3_get_guessed_literals @496
|
||||||
|
Z3_del_literals @497
|
||||||
|
Z3_get_num_literals @498
|
||||||
|
Z3_get_label_symbol @499
|
||||||
|
Z3_get_literal @500
|
||||||
|
Z3_disable_literal @501
|
||||||
|
Z3_block_literals @502
|
||||||
|
Z3_get_model_num_constants @503
|
||||||
|
Z3_get_model_constant @504
|
||||||
|
Z3_get_model_num_funcs @505
|
||||||
|
Z3_get_model_func_decl @506
|
||||||
|
Z3_eval_func_decl @507
|
||||||
|
Z3_is_array_value @508
|
||||||
|
Z3_get_array_value @509
|
||||||
|
Z3_get_model_func_else @510
|
||||||
|
Z3_get_model_func_num_entries @511
|
||||||
|
Z3_get_model_func_entry_num_args @512
|
||||||
|
Z3_get_model_func_entry_arg @513
|
||||||
|
Z3_get_model_func_entry_value @514
|
||||||
|
Z3_eval @515
|
||||||
|
Z3_eval_decl @516
|
||||||
|
Z3_context_to_string @517
|
||||||
|
Z3_statistics_to_string @518
|
||||||
|
Z3_get_context_assignment @519
|
521
dll/z3_dbg.def
Normal file
521
dll/z3_dbg.def
Normal file
|
@ -0,0 +1,521 @@
|
||||||
|
LIBRARY "Z3_DBG"
|
||||||
|
EXPORTS
|
||||||
|
Z3_mk_config @1
|
||||||
|
Z3_del_config @2
|
||||||
|
Z3_set_param_value @3
|
||||||
|
Z3_mk_context @4
|
||||||
|
Z3_mk_context_rc @5
|
||||||
|
Z3_del_context @6
|
||||||
|
Z3_inc_ref @7
|
||||||
|
Z3_dec_ref @8
|
||||||
|
Z3_update_param_value @9
|
||||||
|
Z3_get_param_value @10
|
||||||
|
Z3_interrupt @11
|
||||||
|
Z3_mk_params @12
|
||||||
|
Z3_params_inc_ref @13
|
||||||
|
Z3_params_dec_ref @14
|
||||||
|
Z3_params_set_bool @15
|
||||||
|
Z3_params_set_uint @16
|
||||||
|
Z3_params_set_double @17
|
||||||
|
Z3_params_set_symbol @18
|
||||||
|
Z3_params_to_string @19
|
||||||
|
Z3_params_validate @20
|
||||||
|
Z3_param_descrs_inc_ref @21
|
||||||
|
Z3_param_descrs_dec_ref @22
|
||||||
|
Z3_param_descrs_get_kind @23
|
||||||
|
Z3_param_descrs_size @24
|
||||||
|
Z3_param_descrs_get_name @25
|
||||||
|
Z3_mk_int_symbol @26
|
||||||
|
Z3_mk_string_symbol @27
|
||||||
|
Z3_mk_uninterpreted_sort @28
|
||||||
|
Z3_mk_bool_sort @29
|
||||||
|
Z3_mk_int_sort @30
|
||||||
|
Z3_mk_real_sort @31
|
||||||
|
Z3_mk_bv_sort @32
|
||||||
|
Z3_mk_finite_domain_sort @33
|
||||||
|
Z3_mk_array_sort @34
|
||||||
|
Z3_mk_tuple_sort @35
|
||||||
|
Z3_mk_enumeration_sort @36
|
||||||
|
Z3_mk_list_sort @37
|
||||||
|
Z3_mk_constructor @38
|
||||||
|
Z3_del_constructor @39
|
||||||
|
Z3_mk_datatype @40
|
||||||
|
Z3_mk_constructor_list @41
|
||||||
|
Z3_del_constructor_list @42
|
||||||
|
Z3_mk_datatypes @43
|
||||||
|
Z3_query_constructor @44
|
||||||
|
Z3_mk_func_decl @45
|
||||||
|
Z3_mk_app @46
|
||||||
|
Z3_mk_const @47
|
||||||
|
Z3_mk_fresh_func_decl @48
|
||||||
|
Z3_mk_fresh_const @49
|
||||||
|
Z3_mk_true @50
|
||||||
|
Z3_mk_false @51
|
||||||
|
Z3_mk_eq @52
|
||||||
|
Z3_mk_distinct @53
|
||||||
|
Z3_mk_not @54
|
||||||
|
Z3_mk_ite @55
|
||||||
|
Z3_mk_iff @56
|
||||||
|
Z3_mk_implies @57
|
||||||
|
Z3_mk_xor @58
|
||||||
|
Z3_mk_and @59
|
||||||
|
Z3_mk_or @60
|
||||||
|
Z3_mk_add @61
|
||||||
|
Z3_mk_mul @62
|
||||||
|
Z3_mk_sub @63
|
||||||
|
Z3_mk_unary_minus @64
|
||||||
|
Z3_mk_div @65
|
||||||
|
Z3_mk_mod @66
|
||||||
|
Z3_mk_rem @67
|
||||||
|
Z3_mk_power @68
|
||||||
|
Z3_mk_lt @69
|
||||||
|
Z3_mk_le @70
|
||||||
|
Z3_mk_gt @71
|
||||||
|
Z3_mk_ge @72
|
||||||
|
Z3_mk_int2real @73
|
||||||
|
Z3_mk_real2int @74
|
||||||
|
Z3_mk_is_int @75
|
||||||
|
Z3_mk_bvnot @76
|
||||||
|
Z3_mk_bvredand @77
|
||||||
|
Z3_mk_bvredor @78
|
||||||
|
Z3_mk_bvand @79
|
||||||
|
Z3_mk_bvor @80
|
||||||
|
Z3_mk_bvxor @81
|
||||||
|
Z3_mk_bvnand @82
|
||||||
|
Z3_mk_bvnor @83
|
||||||
|
Z3_mk_bvxnor @84
|
||||||
|
Z3_mk_bvneg @85
|
||||||
|
Z3_mk_bvadd @86
|
||||||
|
Z3_mk_bvsub @87
|
||||||
|
Z3_mk_bvmul @88
|
||||||
|
Z3_mk_bvudiv @89
|
||||||
|
Z3_mk_bvsdiv @90
|
||||||
|
Z3_mk_bvurem @91
|
||||||
|
Z3_mk_bvsrem @92
|
||||||
|
Z3_mk_bvsmod @93
|
||||||
|
Z3_mk_bvult @94
|
||||||
|
Z3_mk_bvslt @95
|
||||||
|
Z3_mk_bvule @96
|
||||||
|
Z3_mk_bvsle @97
|
||||||
|
Z3_mk_bvuge @98
|
||||||
|
Z3_mk_bvsge @99
|
||||||
|
Z3_mk_bvugt @100
|
||||||
|
Z3_mk_bvsgt @101
|
||||||
|
Z3_mk_concat @102
|
||||||
|
Z3_mk_extract @103
|
||||||
|
Z3_mk_sign_ext @104
|
||||||
|
Z3_mk_zero_ext @105
|
||||||
|
Z3_mk_repeat @106
|
||||||
|
Z3_mk_bvshl @107
|
||||||
|
Z3_mk_bvlshr @108
|
||||||
|
Z3_mk_bvashr @109
|
||||||
|
Z3_mk_rotate_left @110
|
||||||
|
Z3_mk_rotate_right @111
|
||||||
|
Z3_mk_ext_rotate_left @112
|
||||||
|
Z3_mk_ext_rotate_right @113
|
||||||
|
Z3_mk_int2bv @114
|
||||||
|
Z3_mk_bv2int @115
|
||||||
|
Z3_mk_bvadd_no_overflow @116
|
||||||
|
Z3_mk_bvadd_no_underflow @117
|
||||||
|
Z3_mk_bvsub_no_overflow @118
|
||||||
|
Z3_mk_bvsub_no_underflow @119
|
||||||
|
Z3_mk_bvsdiv_no_overflow @120
|
||||||
|
Z3_mk_bvneg_no_overflow @121
|
||||||
|
Z3_mk_bvmul_no_overflow @122
|
||||||
|
Z3_mk_bvmul_no_underflow @123
|
||||||
|
Z3_mk_select @124
|
||||||
|
Z3_mk_store @125
|
||||||
|
Z3_mk_const_array @126
|
||||||
|
Z3_mk_map @127
|
||||||
|
Z3_mk_array_default @128
|
||||||
|
Z3_mk_set_sort @129
|
||||||
|
Z3_mk_empty_set @130
|
||||||
|
Z3_mk_full_set @131
|
||||||
|
Z3_mk_set_add @132
|
||||||
|
Z3_mk_set_del @133
|
||||||
|
Z3_mk_set_union @134
|
||||||
|
Z3_mk_set_intersect @135
|
||||||
|
Z3_mk_set_difference @136
|
||||||
|
Z3_mk_set_complement @137
|
||||||
|
Z3_mk_set_member @138
|
||||||
|
Z3_mk_set_subset @139
|
||||||
|
Z3_mk_numeral @140
|
||||||
|
Z3_mk_real @141
|
||||||
|
Z3_mk_int @142
|
||||||
|
Z3_mk_unsigned_int @143
|
||||||
|
Z3_mk_int64 @144
|
||||||
|
Z3_mk_unsigned_int64 @145
|
||||||
|
Z3_mk_pattern @146
|
||||||
|
Z3_mk_bound @147
|
||||||
|
Z3_mk_forall @148
|
||||||
|
Z3_mk_exists @149
|
||||||
|
Z3_mk_quantifier @150
|
||||||
|
Z3_mk_quantifier_ex @151
|
||||||
|
Z3_mk_forall_const @152
|
||||||
|
Z3_mk_exists_const @153
|
||||||
|
Z3_mk_quantifier_const @154
|
||||||
|
Z3_mk_quantifier_const_ex @155
|
||||||
|
Z3_get_symbol_kind @156
|
||||||
|
Z3_get_symbol_int @157
|
||||||
|
Z3_get_symbol_string @158
|
||||||
|
Z3_get_sort_name @159
|
||||||
|
Z3_get_sort_id @160
|
||||||
|
Z3_sort_to_ast @161
|
||||||
|
Z3_is_eq_sort @162
|
||||||
|
Z3_get_sort_kind @163
|
||||||
|
Z3_get_bv_sort_size @164
|
||||||
|
Z3_get_finite_domain_sort_size @165
|
||||||
|
Z3_get_array_sort_domain @166
|
||||||
|
Z3_get_array_sort_range @167
|
||||||
|
Z3_get_tuple_sort_mk_decl @168
|
||||||
|
Z3_get_tuple_sort_num_fields @169
|
||||||
|
Z3_get_tuple_sort_field_decl @170
|
||||||
|
Z3_get_datatype_sort_num_constructors @171
|
||||||
|
Z3_get_datatype_sort_constructor @172
|
||||||
|
Z3_get_datatype_sort_recognizer @173
|
||||||
|
Z3_get_datatype_sort_constructor_accessor @174
|
||||||
|
Z3_get_relation_arity @175
|
||||||
|
Z3_get_relation_column @176
|
||||||
|
Z3_func_decl_to_ast @177
|
||||||
|
Z3_is_eq_func_decl @178
|
||||||
|
Z3_get_func_decl_id @179
|
||||||
|
Z3_get_decl_name @180
|
||||||
|
Z3_get_decl_kind @181
|
||||||
|
Z3_get_domain_size @182
|
||||||
|
Z3_get_arity @183
|
||||||
|
Z3_get_domain @184
|
||||||
|
Z3_get_range @185
|
||||||
|
Z3_get_decl_num_parameters @186
|
||||||
|
Z3_get_decl_parameter_kind @187
|
||||||
|
Z3_get_decl_int_parameter @188
|
||||||
|
Z3_get_decl_double_parameter @189
|
||||||
|
Z3_get_decl_symbol_parameter @190
|
||||||
|
Z3_get_decl_sort_parameter @191
|
||||||
|
Z3_get_decl_ast_parameter @192
|
||||||
|
Z3_get_decl_func_decl_parameter @193
|
||||||
|
Z3_get_decl_rational_parameter @194
|
||||||
|
Z3_app_to_ast @195
|
||||||
|
Z3_get_app_decl @196
|
||||||
|
Z3_get_app_num_args @197
|
||||||
|
Z3_get_app_arg @198
|
||||||
|
Z3_is_eq_ast @199
|
||||||
|
Z3_get_ast_id @200
|
||||||
|
Z3_get_ast_hash @201
|
||||||
|
Z3_get_sort @202
|
||||||
|
Z3_is_well_sorted @203
|
||||||
|
Z3_get_bool_value @204
|
||||||
|
Z3_get_ast_kind @205
|
||||||
|
Z3_is_app @206
|
||||||
|
Z3_is_numeral_ast @207
|
||||||
|
Z3_is_algebraic_number @208
|
||||||
|
Z3_to_app @209
|
||||||
|
Z3_to_func_decl @210
|
||||||
|
Z3_get_numeral_string @211
|
||||||
|
Z3_get_numeral_decimal_string @212
|
||||||
|
Z3_get_numerator @213
|
||||||
|
Z3_get_denominator @214
|
||||||
|
Z3_get_numeral_small @215
|
||||||
|
Z3_get_numeral_int @216
|
||||||
|
Z3_get_numeral_uint @217
|
||||||
|
Z3_get_numeral_uint64 @218
|
||||||
|
Z3_get_numeral_int64 @219
|
||||||
|
Z3_get_numeral_rational_int64 @220
|
||||||
|
Z3_get_algebraic_number_lower @221
|
||||||
|
Z3_get_algebraic_number_upper @222
|
||||||
|
Z3_pattern_to_ast @223
|
||||||
|
Z3_get_pattern_num_terms @224
|
||||||
|
Z3_get_pattern @225
|
||||||
|
Z3_get_index_value @226
|
||||||
|
Z3_is_quantifier_forall @227
|
||||||
|
Z3_get_quantifier_weight @228
|
||||||
|
Z3_get_quantifier_num_patterns @229
|
||||||
|
Z3_get_quantifier_pattern_ast @230
|
||||||
|
Z3_get_quantifier_num_no_patterns @231
|
||||||
|
Z3_get_quantifier_no_pattern_ast @232
|
||||||
|
Z3_get_quantifier_bound_name @233
|
||||||
|
Z3_get_quantifier_bound_sort @234
|
||||||
|
Z3_get_quantifier_body @235
|
||||||
|
Z3_get_quantifier_num_bound @236
|
||||||
|
Z3_simplify @237
|
||||||
|
Z3_simplify_ex @238
|
||||||
|
Z3_simplify_get_help @239
|
||||||
|
Z3_simplify_get_param_descrs @240
|
||||||
|
Z3_update_term @241
|
||||||
|
Z3_substitute @242
|
||||||
|
Z3_substitute_vars @243
|
||||||
|
Z3_translate @244
|
||||||
|
Z3_model_inc_ref @245
|
||||||
|
Z3_model_dec_ref @246
|
||||||
|
Z3_model_eval @247
|
||||||
|
Z3_model_get_const_interp @248
|
||||||
|
Z3_model_get_func_interp @249
|
||||||
|
Z3_model_get_num_consts @250
|
||||||
|
Z3_model_get_const_decl @251
|
||||||
|
Z3_model_get_num_funcs @252
|
||||||
|
Z3_model_get_func_decl @253
|
||||||
|
Z3_model_get_num_sorts @254
|
||||||
|
Z3_model_get_sort @255
|
||||||
|
Z3_model_get_sort_universe @256
|
||||||
|
Z3_is_as_array @257
|
||||||
|
Z3_get_as_array_func_decl @258
|
||||||
|
Z3_func_interp_inc_ref @259
|
||||||
|
Z3_func_interp_dec_ref @260
|
||||||
|
Z3_func_interp_get_num_entries @261
|
||||||
|
Z3_func_interp_get_entry @262
|
||||||
|
Z3_func_interp_get_else @263
|
||||||
|
Z3_func_interp_get_arity @264
|
||||||
|
Z3_func_entry_inc_ref @265
|
||||||
|
Z3_func_entry_dec_ref @266
|
||||||
|
Z3_func_entry_get_value @267
|
||||||
|
Z3_func_entry_get_num_args @268
|
||||||
|
Z3_func_entry_get_arg @269
|
||||||
|
Z3_open_log @270
|
||||||
|
Z3_append_log @271
|
||||||
|
Z3_close_log @272
|
||||||
|
Z3_toggle_warning_messages @273
|
||||||
|
Z3_set_ast_print_mode @274
|
||||||
|
Z3_ast_to_string @275
|
||||||
|
Z3_pattern_to_string @276
|
||||||
|
Z3_sort_to_string @277
|
||||||
|
Z3_func_decl_to_string @278
|
||||||
|
Z3_model_to_string @279
|
||||||
|
Z3_benchmark_to_smtlib_string @280
|
||||||
|
Z3_parse_smtlib2_string @281
|
||||||
|
Z3_parse_smtlib2_file @282
|
||||||
|
Z3_parse_smtlib_string @283
|
||||||
|
Z3_parse_smtlib_file @284
|
||||||
|
Z3_get_smtlib_num_formulas @285
|
||||||
|
Z3_get_smtlib_formula @286
|
||||||
|
Z3_get_smtlib_num_assumptions @287
|
||||||
|
Z3_get_smtlib_assumption @288
|
||||||
|
Z3_get_smtlib_num_decls @289
|
||||||
|
Z3_get_smtlib_decl @290
|
||||||
|
Z3_get_smtlib_num_sorts @291
|
||||||
|
Z3_get_smtlib_sort @292
|
||||||
|
Z3_get_smtlib_error @293
|
||||||
|
Z3_parse_z3_string @294
|
||||||
|
Z3_parse_z3_file @295
|
||||||
|
Z3_get_error_code @296
|
||||||
|
Z3_set_error_handler @297
|
||||||
|
Z3_set_error @298
|
||||||
|
Z3_get_error_msg @299
|
||||||
|
Z3_get_error_msg_ex @300
|
||||||
|
Z3_get_version @301
|
||||||
|
Z3_reset_memory @302
|
||||||
|
Z3_mk_theory @303
|
||||||
|
Z3_theory_get_ext_data @304
|
||||||
|
Z3_theory_mk_sort @305
|
||||||
|
Z3_theory_mk_value @306
|
||||||
|
Z3_theory_mk_constant @307
|
||||||
|
Z3_theory_mk_func_decl @308
|
||||||
|
Z3_theory_get_context @309
|
||||||
|
Z3_set_delete_callback @310
|
||||||
|
Z3_set_reduce_app_callback @311
|
||||||
|
Z3_set_reduce_eq_callback @312
|
||||||
|
Z3_set_reduce_distinct_callback @313
|
||||||
|
Z3_set_new_app_callback @314
|
||||||
|
Z3_set_new_elem_callback @315
|
||||||
|
Z3_set_init_search_callback @316
|
||||||
|
Z3_set_push_callback @317
|
||||||
|
Z3_set_pop_callback @318
|
||||||
|
Z3_set_restart_callback @319
|
||||||
|
Z3_set_reset_callback @320
|
||||||
|
Z3_set_final_check_callback @321
|
||||||
|
Z3_set_new_eq_callback @322
|
||||||
|
Z3_set_new_diseq_callback @323
|
||||||
|
Z3_set_new_assignment_callback @324
|
||||||
|
Z3_set_new_relevant_callback @325
|
||||||
|
Z3_theory_assert_axiom @326
|
||||||
|
Z3_theory_assume_eq @327
|
||||||
|
Z3_theory_enable_axiom_simplification @328
|
||||||
|
Z3_theory_get_eqc_root @329
|
||||||
|
Z3_theory_get_eqc_next @330
|
||||||
|
Z3_theory_get_num_parents @331
|
||||||
|
Z3_theory_get_parent @332
|
||||||
|
Z3_theory_is_value @333
|
||||||
|
Z3_theory_is_decl @334
|
||||||
|
Z3_theory_get_num_elems @335
|
||||||
|
Z3_theory_get_elem @336
|
||||||
|
Z3_theory_get_num_apps @337
|
||||||
|
Z3_theory_get_app @338
|
||||||
|
Z3_mk_fixedpoint @339
|
||||||
|
Z3_fixedpoint_inc_ref @340
|
||||||
|
Z3_fixedpoint_dec_ref @341
|
||||||
|
Z3_fixedpoint_add_rule @342
|
||||||
|
Z3_fixedpoint_add_fact @343
|
||||||
|
Z3_fixedpoint_assert @344
|
||||||
|
Z3_fixedpoint_query @345
|
||||||
|
Z3_fixedpoint_query_relations @346
|
||||||
|
Z3_fixedpoint_get_answer @347
|
||||||
|
Z3_fixedpoint_get_reason_unknown @348
|
||||||
|
Z3_fixedpoint_update_rule @349
|
||||||
|
Z3_fixedpoint_get_num_levels @350
|
||||||
|
Z3_fixedpoint_get_cover_delta @351
|
||||||
|
Z3_fixedpoint_add_cover @352
|
||||||
|
Z3_fixedpoint_get_statistics @353
|
||||||
|
Z3_fixedpoint_register_relation @354
|
||||||
|
Z3_fixedpoint_set_predicate_representation @355
|
||||||
|
Z3_fixedpoint_simplify_rules @356
|
||||||
|
Z3_fixedpoint_set_params @357
|
||||||
|
Z3_fixedpoint_get_help @358
|
||||||
|
Z3_fixedpoint_get_param_descrs @359
|
||||||
|
Z3_fixedpoint_to_string @360
|
||||||
|
Z3_fixedpoint_push @361
|
||||||
|
Z3_fixedpoint_pop @362
|
||||||
|
Z3_fixedpoint_init @363
|
||||||
|
Z3_fixedpoint_set_reduce_assign_callback @364
|
||||||
|
Z3_fixedpoint_set_reduce_app_callback @365
|
||||||
|
Z3_mk_ast_vector @366
|
||||||
|
Z3_ast_vector_inc_ref @367
|
||||||
|
Z3_ast_vector_dec_ref @368
|
||||||
|
Z3_ast_vector_size @369
|
||||||
|
Z3_ast_vector_get @370
|
||||||
|
Z3_ast_vector_set @371
|
||||||
|
Z3_ast_vector_resize @372
|
||||||
|
Z3_ast_vector_push @373
|
||||||
|
Z3_ast_vector_translate @374
|
||||||
|
Z3_ast_vector_to_string @375
|
||||||
|
Z3_mk_ast_map @376
|
||||||
|
Z3_ast_map_inc_ref @377
|
||||||
|
Z3_ast_map_dec_ref @378
|
||||||
|
Z3_ast_map_contains @379
|
||||||
|
Z3_ast_map_find @380
|
||||||
|
Z3_ast_map_insert @381
|
||||||
|
Z3_ast_map_erase @382
|
||||||
|
Z3_ast_map_reset @383
|
||||||
|
Z3_ast_map_size @384
|
||||||
|
Z3_ast_map_keys @385
|
||||||
|
Z3_ast_map_to_string @386
|
||||||
|
Z3_mk_goal @387
|
||||||
|
Z3_goal_inc_ref @388
|
||||||
|
Z3_goal_dec_ref @389
|
||||||
|
Z3_goal_precision @390
|
||||||
|
Z3_goal_assert @391
|
||||||
|
Z3_goal_inconsistent @392
|
||||||
|
Z3_goal_depth @393
|
||||||
|
Z3_goal_reset @394
|
||||||
|
Z3_goal_size @395
|
||||||
|
Z3_goal_formula @396
|
||||||
|
Z3_goal_num_exprs @397
|
||||||
|
Z3_goal_is_decided_sat @398
|
||||||
|
Z3_goal_is_decided_unsat @399
|
||||||
|
Z3_goal_translate @400
|
||||||
|
Z3_goal_to_string @401
|
||||||
|
Z3_mk_tactic @402
|
||||||
|
Z3_tactic_inc_ref @403
|
||||||
|
Z3_tactic_dec_ref @404
|
||||||
|
Z3_mk_probe @405
|
||||||
|
Z3_probe_inc_ref @406
|
||||||
|
Z3_probe_dec_ref @407
|
||||||
|
Z3_tactic_and_then @408
|
||||||
|
Z3_tactic_or_else @409
|
||||||
|
Z3_tactic_par_or @410
|
||||||
|
Z3_tactic_par_and_then @411
|
||||||
|
Z3_tactic_try_for @412
|
||||||
|
Z3_tactic_when @413
|
||||||
|
Z3_tactic_cond @414
|
||||||
|
Z3_tactic_repeat @415
|
||||||
|
Z3_tactic_skip @416
|
||||||
|
Z3_tactic_fail @417
|
||||||
|
Z3_tactic_fail_if @418
|
||||||
|
Z3_tactic_fail_if_not_decided @419
|
||||||
|
Z3_tactic_using_params @420
|
||||||
|
Z3_probe_const @421
|
||||||
|
Z3_probe_lt @422
|
||||||
|
Z3_probe_gt @423
|
||||||
|
Z3_probe_le @424
|
||||||
|
Z3_probe_ge @425
|
||||||
|
Z3_probe_eq @426
|
||||||
|
Z3_probe_and @427
|
||||||
|
Z3_probe_or @428
|
||||||
|
Z3_probe_not @429
|
||||||
|
Z3_get_num_tactics @430
|
||||||
|
Z3_get_tactic_name @431
|
||||||
|
Z3_get_num_probes @432
|
||||||
|
Z3_get_probe_name @433
|
||||||
|
Z3_tactic_get_help @434
|
||||||
|
Z3_tactic_get_param_descrs @435
|
||||||
|
Z3_tactic_get_descr @436
|
||||||
|
Z3_probe_get_descr @437
|
||||||
|
Z3_probe_apply @438
|
||||||
|
Z3_tactic_apply @439
|
||||||
|
Z3_tactic_apply_ex @440
|
||||||
|
Z3_apply_result_inc_ref @441
|
||||||
|
Z3_apply_result_dec_ref @442
|
||||||
|
Z3_apply_result_to_string @443
|
||||||
|
Z3_apply_result_get_num_subgoals @444
|
||||||
|
Z3_apply_result_get_subgoal @445
|
||||||
|
Z3_apply_result_convert_model @446
|
||||||
|
Z3_mk_solver @447
|
||||||
|
Z3_mk_simple_solver @448
|
||||||
|
Z3_mk_solver_for_logic @449
|
||||||
|
Z3_mk_solver_from_tactic @450
|
||||||
|
Z3_solver_get_help @451
|
||||||
|
Z3_solver_get_param_descrs @452
|
||||||
|
Z3_solver_set_params @453
|
||||||
|
Z3_solver_inc_ref @454
|
||||||
|
Z3_solver_dec_ref @455
|
||||||
|
Z3_solver_push @456
|
||||||
|
Z3_solver_pop @457
|
||||||
|
Z3_solver_reset @458
|
||||||
|
Z3_solver_get_num_scopes @459
|
||||||
|
Z3_solver_assert @460
|
||||||
|
Z3_solver_get_assertions @461
|
||||||
|
Z3_solver_check @462
|
||||||
|
Z3_solver_check_assumptions @463
|
||||||
|
Z3_solver_get_model @464
|
||||||
|
Z3_solver_get_proof @465
|
||||||
|
Z3_solver_get_unsat_core @466
|
||||||
|
Z3_solver_get_reason_unknown @467
|
||||||
|
Z3_solver_get_statistics @468
|
||||||
|
Z3_solver_to_string @469
|
||||||
|
Z3_stats_to_string @470
|
||||||
|
Z3_stats_inc_ref @471
|
||||||
|
Z3_stats_dec_ref @472
|
||||||
|
Z3_stats_size @473
|
||||||
|
Z3_stats_get_key @474
|
||||||
|
Z3_stats_is_uint @475
|
||||||
|
Z3_stats_is_double @476
|
||||||
|
Z3_stats_get_uint_value @477
|
||||||
|
Z3_stats_get_double_value @478
|
||||||
|
Z3_mk_injective_function @479
|
||||||
|
Z3_set_logic @480
|
||||||
|
Z3_push @481
|
||||||
|
Z3_pop @482
|
||||||
|
Z3_get_num_scopes @483
|
||||||
|
Z3_persist_ast @484
|
||||||
|
Z3_assert_cnstr @485
|
||||||
|
Z3_check_and_get_model @486
|
||||||
|
Z3_check @487
|
||||||
|
Z3_check_assumptions @488
|
||||||
|
Z3_get_implied_equalities @489
|
||||||
|
Z3_del_model @490
|
||||||
|
Z3_soft_check_cancel @491
|
||||||
|
Z3_get_search_failure @492
|
||||||
|
Z3_mk_label @493
|
||||||
|
Z3_get_relevant_labels @494
|
||||||
|
Z3_get_relevant_literals @495
|
||||||
|
Z3_get_guessed_literals @496
|
||||||
|
Z3_del_literals @497
|
||||||
|
Z3_get_num_literals @498
|
||||||
|
Z3_get_label_symbol @499
|
||||||
|
Z3_get_literal @500
|
||||||
|
Z3_disable_literal @501
|
||||||
|
Z3_block_literals @502
|
||||||
|
Z3_get_model_num_constants @503
|
||||||
|
Z3_get_model_constant @504
|
||||||
|
Z3_get_model_num_funcs @505
|
||||||
|
Z3_get_model_func_decl @506
|
||||||
|
Z3_eval_func_decl @507
|
||||||
|
Z3_is_array_value @508
|
||||||
|
Z3_get_array_value @509
|
||||||
|
Z3_get_model_func_else @510
|
||||||
|
Z3_get_model_func_num_entries @511
|
||||||
|
Z3_get_model_func_entry_num_args @512
|
||||||
|
Z3_get_model_func_entry_arg @513
|
||||||
|
Z3_get_model_func_entry_value @514
|
||||||
|
Z3_eval @515
|
||||||
|
Z3_eval_decl @516
|
||||||
|
Z3_context_to_string @517
|
||||||
|
Z3_statistics_to_string @518
|
||||||
|
Z3_get_context_assignment @519
|
25
maxsat/README-external.txt
Normal file
25
maxsat/README-external.txt
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
WARNING: this example still uses the old Z3 (version 3.x) C API. The current version is backward compatible.
|
||||||
|
|
||||||
|
This directory contains scripts to build the MaxSAT application using
|
||||||
|
Microsoft C compiler, or gcc.
|
||||||
|
|
||||||
|
1) Using Microsoft C compiler
|
||||||
|
|
||||||
|
Use 'build.cmd' to build the MaxSAT application using Microsoft C
|
||||||
|
compiler.
|
||||||
|
|
||||||
|
Remark: The Microsoft C compiler (cl) must be in your path,
|
||||||
|
or you can use the Visual Studio Command Prompt.
|
||||||
|
|
||||||
|
The script 'exec.cmd' adds the bin directory to the path. So,
|
||||||
|
maxsat.exe can find z3.dll.
|
||||||
|
|
||||||
|
|
||||||
|
2) Using gcc
|
||||||
|
|
||||||
|
Use 'build.sh' to build the MaxSAT application using gcc.
|
||||||
|
The script 'exec.sh' adds the bin directory to the path. So,
|
||||||
|
maxsat.exe can find z3.dll.
|
||||||
|
|
||||||
|
Remark: the scripts 'build.sh' and 'exec.sh' assumes you are in a
|
||||||
|
Cygwin or Mingw shell.
|
8
maxsat/README-linux.txt
Normal file
8
maxsat/README-linux.txt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
WARNING: this example still uses the old Z3 (version 3.x) C API. The current version is backward compatible.
|
||||||
|
|
||||||
|
This directory contains scripts to build the MaxSAT application using gcc.
|
||||||
|
|
||||||
|
Use 'build.sh' to build the MaxSAT application using gcc.
|
||||||
|
The script 'exec.sh' adds the lib directory to the path. So,
|
||||||
|
maxsat can find libz3.so.
|
||||||
|
|
8
maxsat/README-osx.txt
Normal file
8
maxsat/README-osx.txt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
WARNING: this example still uses the old Z3 (version 3.x) C API. The current version is backward compatible.
|
||||||
|
|
||||||
|
This directory contains scripts to build the MaxSAT application using gcc.
|
||||||
|
|
||||||
|
Use 'build.sh' to build the MaxSAT application using gcc.
|
||||||
|
The script 'exec.sh' adds the lib directory to the path. So,
|
||||||
|
maxsat can find libz3.dylib.
|
||||||
|
|
1
maxsat/build-external-linux.sh
Normal file
1
maxsat/build-external-linux.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
gcc -fopenmp -o maxsat maxsat.c -I ../../include -L ../../lib -lz3
|
1
maxsat/build-external-osx.sh
Normal file
1
maxsat/build-external-osx.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
gcc -fopenmp -o maxsat maxsat.c -I ../../include -L ../../lib -lz3
|
1
maxsat/build-external.cmd
Normal file
1
maxsat/build-external.cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
cl /I ..\..\include ..\..\bin\z3.lib maxsat.c
|
1
maxsat/build-external.sh
Normal file
1
maxsat/build-external.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
gcc -o maxsat.exe -I ../../include ../../bin/z3.dll maxsat.c
|
4
maxsat/build-static-linux.sh
Normal file
4
maxsat/build-static-linux.sh
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Note: Z3 was built using C++, so libz3.a has C++ dependencies.
|
||||||
|
# You can use gcc to link the program, but you need tell it
|
||||||
|
# to link the C++ libraries
|
||||||
|
g++ -fopenmp -static -I../../include -L../../lib maxsat.c -lz3 -o maxsat
|
4
maxsat/build-static-osx.sh
Normal file
4
maxsat/build-static-osx.sh
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Note: Z3 was built using C++, so libz3.a has C++ dependencies.
|
||||||
|
# You can use gcc to link the program, but you need tell it
|
||||||
|
# to link the C++ libraries
|
||||||
|
g++ -fopenmp -I../../include maxsat.c ../../lib/libz3.a -o maxsat
|
11
maxsat/ex.smt
Normal file
11
maxsat/ex.smt
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
(benchmark ex
|
||||||
|
:logic AUFLIA
|
||||||
|
:extrafuns ((x Int) (y Int) (z Int))
|
||||||
|
:assumption (> x 0)
|
||||||
|
:assumption (<= x -1)
|
||||||
|
:assumption (or (> x 0) (< y 1))
|
||||||
|
:assumption (> y 2)
|
||||||
|
:assumption (> y 3)
|
||||||
|
:assumption (<= y -1)
|
||||||
|
:formula (= z (+ x y)))
|
||||||
|
|
2
maxsat/exec-external-linux.sh
Normal file
2
maxsat/exec-external-linux.sh
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export LD_LIBRARY_PATH=../../lib:$LD_LIBRARY_PATH
|
||||||
|
./maxsat $1
|
2
maxsat/exec-external-osx.sh
Normal file
2
maxsat/exec-external-osx.sh
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export DYLD_LIBRARY_PATH=../../lib:$DYLD_LIBRARY_PATH
|
||||||
|
./maxsat $1
|
5
maxsat/exec-external.cmd
Normal file
5
maxsat/exec-external.cmd
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
@echo off
|
||||||
|
SETLOCAL
|
||||||
|
set PATH=..\..\bin;%PATH%
|
||||||
|
maxsat.exe %1
|
||||||
|
ENDLOCAL
|
2
maxsat/exec-external.sh
Normal file
2
maxsat/exec-external.sh
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export PATH=../../bin:$PATH
|
||||||
|
./maxsat.exe $1
|
632
maxsat/maxsat.c
Normal file
632
maxsat/maxsat.c
Normal file
|
@ -0,0 +1,632 @@
|
||||||
|
/*
|
||||||
|
Simple MAXSAT solver on top of the Z3 API.
|
||||||
|
*/
|
||||||
|
#include<stdio.h>
|
||||||
|
#include<stdlib.h>
|
||||||
|
#include<memory.h>
|
||||||
|
#include<z3.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
\defgroup maxsat_ex MaxSAT/MaxSMT examples
|
||||||
|
*/
|
||||||
|
/*@{*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Exit gracefully in case of error.
|
||||||
|
*/
|
||||||
|
void error(char * msg)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s\n", msg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create a logical context.
|
||||||
|
Enable model construction only.
|
||||||
|
*/
|
||||||
|
Z3_context mk_context()
|
||||||
|
{
|
||||||
|
Z3_config cfg;
|
||||||
|
Z3_context ctx;
|
||||||
|
cfg = Z3_mk_config();
|
||||||
|
Z3_set_param_value(cfg, "MODEL", "true");
|
||||||
|
ctx = Z3_mk_context(cfg);
|
||||||
|
Z3_del_config(cfg);
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create a variable using the given name and type.
|
||||||
|
*/
|
||||||
|
Z3_ast mk_var(Z3_context ctx, const char * name, Z3_sort ty)
|
||||||
|
{
|
||||||
|
Z3_symbol s = Z3_mk_string_symbol(ctx, name);
|
||||||
|
return Z3_mk_const(ctx, s, ty);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create a boolean variable using the given name.
|
||||||
|
*/
|
||||||
|
Z3_ast mk_bool_var(Z3_context ctx, const char * name)
|
||||||
|
{
|
||||||
|
Z3_sort ty = Z3_mk_bool_sort(ctx);
|
||||||
|
return mk_var(ctx, name, ty);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create a fresh boolean variable.
|
||||||
|
*/
|
||||||
|
Z3_ast mk_fresh_bool_var(Z3_context ctx)
|
||||||
|
{
|
||||||
|
return Z3_mk_fresh_const(ctx, "k", Z3_mk_bool_sort(ctx));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create an array with \c num_vars fresh boolean variables.
|
||||||
|
*/
|
||||||
|
Z3_ast * mk_fresh_bool_var_array(Z3_context ctx, unsigned num_vars)
|
||||||
|
{
|
||||||
|
Z3_ast * result = (Z3_ast *) malloc(sizeof(Z3_ast) * num_vars);
|
||||||
|
unsigned i;
|
||||||
|
for (i = 0; i < num_vars; i++) {
|
||||||
|
result[i] = mk_fresh_bool_var(ctx);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Delete array of boolean variables.
|
||||||
|
*/
|
||||||
|
void del_bool_var_array(Z3_ast * arr)
|
||||||
|
{
|
||||||
|
free(arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create a binary OR.
|
||||||
|
*/
|
||||||
|
Z3_ast mk_binary_or(Z3_context ctx, Z3_ast in_1, Z3_ast in_2)
|
||||||
|
{
|
||||||
|
Z3_ast args[2] = { in_1, in_2 };
|
||||||
|
return Z3_mk_or(ctx, 2, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create a ternary OR.
|
||||||
|
*/
|
||||||
|
Z3_ast mk_ternary_or(Z3_context ctx, Z3_ast in_1, Z3_ast in_2, Z3_ast in_3)
|
||||||
|
{
|
||||||
|
Z3_ast args[3] = { in_1, in_2, in_3 };
|
||||||
|
return Z3_mk_or(ctx, 3, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create a binary AND.
|
||||||
|
*/
|
||||||
|
Z3_ast mk_binary_and(Z3_context ctx, Z3_ast in_1, Z3_ast in_2)
|
||||||
|
{
|
||||||
|
Z3_ast args[2] = { in_1, in_2 };
|
||||||
|
return Z3_mk_and(ctx, 2, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get hard constraints from a SMT-LIB file. We assume hard constraints
|
||||||
|
are formulas preceeded with the keyword :formula.
|
||||||
|
Return an array containing all formulas read by the last Z3_parse_smtlib_file invocation.
|
||||||
|
It will store the number of formulas in num_cnstrs.
|
||||||
|
*/
|
||||||
|
Z3_ast * get_hard_constraints(Z3_context ctx, unsigned * num_cnstrs)
|
||||||
|
{
|
||||||
|
Z3_ast * result;
|
||||||
|
unsigned i;
|
||||||
|
*num_cnstrs = Z3_get_smtlib_num_formulas(ctx);
|
||||||
|
result = (Z3_ast *) malloc(sizeof(Z3_ast) * (*num_cnstrs));
|
||||||
|
for (i = 0; i < *num_cnstrs; i++) {
|
||||||
|
result[i] = Z3_get_smtlib_formula(ctx, i);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get soft constraints from a SMT-LIB file. We assume soft constraints
|
||||||
|
are formulas preceeded with the keyword :assumption.
|
||||||
|
Return an array containing all assumptions read by the last Z3_parse_smtlib_file invocation.
|
||||||
|
It will store the number of formulas in num_cnstrs.
|
||||||
|
*/
|
||||||
|
Z3_ast * get_soft_constraints(Z3_context ctx, unsigned * num_cnstrs)
|
||||||
|
{
|
||||||
|
Z3_ast * result;
|
||||||
|
unsigned i;
|
||||||
|
*num_cnstrs = Z3_get_smtlib_num_assumptions(ctx);
|
||||||
|
result = (Z3_ast *) malloc(sizeof(Z3_ast) * (*num_cnstrs));
|
||||||
|
for (i = 0; i < *num_cnstrs; i++) {
|
||||||
|
result[i] = Z3_get_smtlib_assumption(ctx, i);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Free the given array of cnstrs that was allocated using get_hard_constraints or get_soft_constraints.
|
||||||
|
*/
|
||||||
|
void free_cnstr_array(Z3_ast * cnstrs)
|
||||||
|
{
|
||||||
|
free(cnstrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Assert hard constraints stored in the given array.
|
||||||
|
*/
|
||||||
|
void assert_hard_constraints(Z3_context ctx, unsigned num_cnstrs, Z3_ast * cnstrs)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
for (i = 0; i < num_cnstrs; i++) {
|
||||||
|
Z3_assert_cnstr(ctx, cnstrs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Assert soft constraints stored in the given array.
|
||||||
|
This funtion will assert each soft-constraint C_i as (C_i or k_i) where k_i is a fresh boolean variable.
|
||||||
|
It will also return an array containing these fresh variables.
|
||||||
|
*/
|
||||||
|
Z3_ast * assert_soft_constraints(Z3_context ctx, unsigned num_cnstrs, Z3_ast * cnstrs)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
Z3_ast * aux_vars;
|
||||||
|
aux_vars = mk_fresh_bool_var_array(ctx, num_cnstrs);
|
||||||
|
for (i = 0; i < num_cnstrs; i++) {
|
||||||
|
Z3_ast assumption = cnstrs[i];
|
||||||
|
Z3_assert_cnstr(ctx, mk_binary_or(ctx, assumption, aux_vars[i]));
|
||||||
|
}
|
||||||
|
return aux_vars;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create a full adder with inputs \c in_1, \c in_2 and \c cin.
|
||||||
|
The output of the full adder is stored in \c out, and the carry in \c c_out.
|
||||||
|
*/
|
||||||
|
void mk_full_adder(Z3_context ctx, Z3_ast in_1, Z3_ast in_2, Z3_ast cin, Z3_ast * out, Z3_ast * cout)
|
||||||
|
{
|
||||||
|
*cout = mk_ternary_or(ctx, mk_binary_and(ctx, in_1, in_2), mk_binary_and(ctx, in_1, cin), mk_binary_and(ctx, in_2, cin));
|
||||||
|
*out = Z3_mk_xor(ctx, Z3_mk_xor(ctx, in_1, in_2), cin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create an adder for inputs of size \c num_bits.
|
||||||
|
The arguments \c in1 and \c in2 are arrays of bits of size \c num_bits.
|
||||||
|
|
||||||
|
\remark \c result must be an array of size \c num_bits + 1.
|
||||||
|
*/
|
||||||
|
void mk_adder(Z3_context ctx, unsigned num_bits, Z3_ast * in_1, Z3_ast * in_2, Z3_ast * result)
|
||||||
|
{
|
||||||
|
Z3_ast cin, cout, out;
|
||||||
|
unsigned i;
|
||||||
|
cin = Z3_mk_false(ctx);
|
||||||
|
for (i = 0; i < num_bits; i++) {
|
||||||
|
mk_full_adder(ctx, in_1[i], in_2[i], cin, &out, &cout);
|
||||||
|
result[i] = out;
|
||||||
|
cin = cout;
|
||||||
|
}
|
||||||
|
result[num_bits] = cout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Given \c num_ins "numbers" of size \c num_bits stored in \c in.
|
||||||
|
Create floor(num_ins/2) adder circuits. Each circuit is adding two consecutive "numbers".
|
||||||
|
The numbers are stored one after the next in the array \c in.
|
||||||
|
That is, the array \c in has size num_bits * num_ins.
|
||||||
|
Return an array of bits containing \c ceil(num_ins/2) numbers of size \c (num_bits + 1).
|
||||||
|
If num_ins/2 is not an integer, then the last "number" in the output, is the last "number" in \c in with an appended "zero".
|
||||||
|
*/
|
||||||
|
void mk_adder_pairs(Z3_context ctx, unsigned num_bits, unsigned num_ins, Z3_ast * in, unsigned * out_num_ins, Z3_ast * out)
|
||||||
|
{
|
||||||
|
unsigned out_num_bits = num_bits + 1;
|
||||||
|
unsigned i = 0;
|
||||||
|
Z3_ast * _in = in;
|
||||||
|
Z3_ast * _out = out;
|
||||||
|
*out_num_ins = (num_ins % 2 == 0) ? (num_ins / 2) : (num_ins / 2) + 1;
|
||||||
|
for (i = 0; i < num_ins / 2; i++) {
|
||||||
|
mk_adder(ctx, num_bits, _in, _in + num_bits, _out);
|
||||||
|
_in += num_bits;
|
||||||
|
_in += num_bits;
|
||||||
|
_out += out_num_bits;
|
||||||
|
}
|
||||||
|
if (num_ins % 2 != 0) {
|
||||||
|
for (i = 0; i < num_bits; i++) {
|
||||||
|
_out[i] = _in[i];
|
||||||
|
}
|
||||||
|
_out[num_bits] = Z3_mk_false(ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create a counter circuit to count the number of "ones" in lits.
|
||||||
|
The function returns an array of bits (i.e. boolean expressions) containing the output of the circuit.
|
||||||
|
The size of the array is stored in out_sz.
|
||||||
|
*/
|
||||||
|
Z3_ast * mk_counter_circuit(Z3_context ctx, unsigned n, Z3_ast * lits, unsigned * out_sz)
|
||||||
|
{
|
||||||
|
unsigned num_ins = n;
|
||||||
|
unsigned num_bits = 1;
|
||||||
|
Z3_ast * aux_1;
|
||||||
|
Z3_ast * aux_2;
|
||||||
|
if (n == 0)
|
||||||
|
return 0;
|
||||||
|
aux_1 = (Z3_ast *) malloc(sizeof(Z3_ast) * (n + 1));
|
||||||
|
aux_2 = (Z3_ast *) malloc(sizeof(Z3_ast) * (n + 1));
|
||||||
|
memcpy(aux_1, lits, sizeof(Z3_ast) * n);
|
||||||
|
while (num_ins > 1) {
|
||||||
|
unsigned new_num_ins;
|
||||||
|
Z3_ast * tmp;
|
||||||
|
mk_adder_pairs(ctx, num_bits, num_ins, aux_1, &new_num_ins, aux_2);
|
||||||
|
num_ins = new_num_ins;
|
||||||
|
num_bits++;
|
||||||
|
#ifdef MAXSAT_DEBUG
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
printf("num_bits: %d, num_ins: %d \n", num_bits, num_ins);
|
||||||
|
for (i = 0; i < num_ins * num_bits; i++) {
|
||||||
|
printf("bit %d:\n%s\n", i, Z3_ast_to_string(ctx, aux_2[i]));
|
||||||
|
}
|
||||||
|
printf("-----------\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
tmp = aux_1;
|
||||||
|
aux_1 = aux_2;
|
||||||
|
aux_2 = tmp;
|
||||||
|
}
|
||||||
|
*out_sz = num_bits;
|
||||||
|
free(aux_2);
|
||||||
|
return aux_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Return the \c idx bit of \c val.
|
||||||
|
*/
|
||||||
|
int get_bit(unsigned val, unsigned idx)
|
||||||
|
{
|
||||||
|
unsigned mask = 1 << (idx & 31);
|
||||||
|
return (val & mask) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Given an integer val encoded in n bits (boolean variables), assert the constraint that val <= k.
|
||||||
|
*/
|
||||||
|
void assert_le_k(Z3_context ctx, unsigned n, Z3_ast * val, unsigned k)
|
||||||
|
{
|
||||||
|
Z3_ast i1, i2, not_val, out;
|
||||||
|
unsigned idx;
|
||||||
|
not_val = Z3_mk_not(ctx, val[0]);
|
||||||
|
if (get_bit(k, 0))
|
||||||
|
out = Z3_mk_true(ctx);
|
||||||
|
else
|
||||||
|
out = not_val;
|
||||||
|
for (idx = 1; idx < n; idx++) {
|
||||||
|
not_val = Z3_mk_not(ctx, val[idx]);
|
||||||
|
if (get_bit(k, idx)) {
|
||||||
|
i1 = not_val;
|
||||||
|
i2 = out;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
i1 = Z3_mk_false(ctx);
|
||||||
|
i2 = Z3_mk_false(ctx);
|
||||||
|
}
|
||||||
|
out = mk_ternary_or(ctx, i1, i2, mk_binary_and(ctx, not_val, out));
|
||||||
|
}
|
||||||
|
// printf("at-most-k:\n%s\n", Z3_ast_to_string(ctx, out));
|
||||||
|
Z3_assert_cnstr(ctx, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Assert that at most \c k literals in \c lits can be true,
|
||||||
|
where \c n is the number of literals in lits.
|
||||||
|
|
||||||
|
We use a simple encoding using an adder (counter).
|
||||||
|
An interesting exercise consists in implementing more sophisticated encodings.
|
||||||
|
*/
|
||||||
|
void assert_at_most_k(Z3_context ctx, unsigned n, Z3_ast * lits, unsigned k)
|
||||||
|
{
|
||||||
|
Z3_ast * counter_bits;
|
||||||
|
unsigned counter_bits_sz;
|
||||||
|
if (k >= n || n <= 1)
|
||||||
|
return; /* nothing to be done */
|
||||||
|
counter_bits = mk_counter_circuit(ctx, n, lits, &counter_bits_sz);
|
||||||
|
assert_le_k(ctx, counter_bits_sz, counter_bits, k);
|
||||||
|
del_bool_var_array(counter_bits);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Assert that at most one literal in \c lits can be true,
|
||||||
|
where \c n is the number of literals in lits.
|
||||||
|
*/
|
||||||
|
void assert_at_most_one(Z3_context ctx, unsigned n, Z3_ast * lits)
|
||||||
|
{
|
||||||
|
assert_at_most_k(ctx, n, lits, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Small test for the at-most-one constraint.
|
||||||
|
*/
|
||||||
|
void tst_at_most_one()
|
||||||
|
{
|
||||||
|
Z3_context ctx = mk_context();
|
||||||
|
Z3_ast k1 = mk_bool_var(ctx, "k1");
|
||||||
|
Z3_ast k2 = mk_bool_var(ctx, "k2");
|
||||||
|
Z3_ast k3 = mk_bool_var(ctx, "k3");
|
||||||
|
Z3_ast k4 = mk_bool_var(ctx, "k4");
|
||||||
|
Z3_ast k5 = mk_bool_var(ctx, "k5");
|
||||||
|
Z3_ast k6 = mk_bool_var(ctx, "k6");
|
||||||
|
Z3_ast args1[5] = { k1, k2, k3, k4, k5 };
|
||||||
|
Z3_ast args2[3] = { k4, k5, k6 };
|
||||||
|
Z3_model m = 0;
|
||||||
|
Z3_lbool result;
|
||||||
|
printf("testing at-most-one constraint\n");
|
||||||
|
assert_at_most_one(ctx, 5, args1);
|
||||||
|
assert_at_most_one(ctx, 3, args2);
|
||||||
|
printf("it must be sat...\n");
|
||||||
|
result = Z3_check_and_get_model(ctx, &m);
|
||||||
|
if (result != Z3_L_TRUE)
|
||||||
|
error("BUG");
|
||||||
|
printf("model:\n%s\n", Z3_model_to_string(ctx, m));
|
||||||
|
if (m) {
|
||||||
|
Z3_del_model(ctx, m);
|
||||||
|
}
|
||||||
|
Z3_assert_cnstr(ctx, mk_binary_or(ctx, k2, k3));
|
||||||
|
Z3_assert_cnstr(ctx, mk_binary_or(ctx, k1, k6));
|
||||||
|
printf("it must be sat...\n");
|
||||||
|
result = Z3_check_and_get_model(ctx, &m);
|
||||||
|
if (result != Z3_L_TRUE)
|
||||||
|
error("BUG");
|
||||||
|
printf("model:\n%s\n", Z3_model_to_string(ctx, m));
|
||||||
|
if (m) {
|
||||||
|
Z3_del_model(ctx, m);
|
||||||
|
}
|
||||||
|
Z3_assert_cnstr(ctx, mk_binary_or(ctx, k4, k5));
|
||||||
|
printf("it must be unsat...\n");
|
||||||
|
result = Z3_check_and_get_model(ctx, &m);
|
||||||
|
if (result != Z3_L_FALSE)
|
||||||
|
error("BUG");
|
||||||
|
Z3_del_context(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Return the number of soft-constraints that were disable by the given model.
|
||||||
|
A soft-constraint was disabled if the associated auxiliary variable was assigned to true.
|
||||||
|
*/
|
||||||
|
unsigned get_num_disabled_soft_constraints(Z3_context ctx, Z3_model m, unsigned num_soft_cnstrs, Z3_ast * aux_vars)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
unsigned num_disabled = 0;
|
||||||
|
Z3_ast t = Z3_mk_true(ctx);
|
||||||
|
for (i = 0; i < num_soft_cnstrs; i++) {
|
||||||
|
Z3_ast val;
|
||||||
|
if (Z3_eval(ctx, m, aux_vars[i], &val) == Z3_TRUE) {
|
||||||
|
// printf("%s", Z3_ast_to_string(ctx, aux_vars[i]));
|
||||||
|
// printf(" -> %s\n", Z3_ast_to_string(ctx, val));
|
||||||
|
if (Z3_is_eq_ast(ctx, val, t)) {
|
||||||
|
num_disabled++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return num_disabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Naive maxsat procedure based on linear search and at-most-k
|
||||||
|
constraint. Return the number of soft-constraints that can be
|
||||||
|
satisfied. Return -1 if the hard-constraints cannot be
|
||||||
|
satisfied. That is, the formula cannot be satisfied even if all
|
||||||
|
soft-constraints are ignored.
|
||||||
|
|
||||||
|
Exercise: use binary search to implement MaxSAT.
|
||||||
|
Hint: you will need to use an answer literal to retract the at-most-k constraint.
|
||||||
|
*/
|
||||||
|
int naive_maxsat(Z3_context ctx, unsigned num_hard_cnstrs, Z3_ast * hard_cnstrs, unsigned num_soft_cnstrs, Z3_ast * soft_cnstrs)
|
||||||
|
{
|
||||||
|
Z3_ast * aux_vars;
|
||||||
|
Z3_lbool is_sat;
|
||||||
|
unsigned r, k;
|
||||||
|
assert_hard_constraints(ctx, num_hard_cnstrs, hard_cnstrs);
|
||||||
|
printf("checking whether hard constraints are satisfiable...\n");
|
||||||
|
is_sat = Z3_check(ctx);
|
||||||
|
if (is_sat == Z3_L_FALSE) {
|
||||||
|
// It is not possible to make the formula satisfiable even when ignoring all soft constraints.
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (num_soft_cnstrs == 0)
|
||||||
|
return 0; // nothing to be done...
|
||||||
|
aux_vars = assert_soft_constraints(ctx, num_soft_cnstrs, soft_cnstrs);
|
||||||
|
// Perform linear search.
|
||||||
|
r = 0;
|
||||||
|
k = num_soft_cnstrs - 1;
|
||||||
|
for (;;) {
|
||||||
|
Z3_model m;
|
||||||
|
unsigned num_disabled;
|
||||||
|
// at most k soft-constraints can be ignored.
|
||||||
|
printf("checking whether at-most %d soft-constraints can be ignored.\n", k);
|
||||||
|
assert_at_most_k(ctx, num_soft_cnstrs, aux_vars, k);
|
||||||
|
is_sat = Z3_check_and_get_model(ctx, &m);
|
||||||
|
if (is_sat == Z3_L_FALSE) {
|
||||||
|
printf("unsat\n");
|
||||||
|
return num_soft_cnstrs - k - 1;
|
||||||
|
}
|
||||||
|
num_disabled = get_num_disabled_soft_constraints(ctx, m, num_soft_cnstrs, aux_vars);
|
||||||
|
if (num_disabled > k) {
|
||||||
|
error("BUG");
|
||||||
|
}
|
||||||
|
if (m) {
|
||||||
|
Z3_del_model(ctx, m);
|
||||||
|
}
|
||||||
|
printf("sat\n");
|
||||||
|
k = num_disabled;
|
||||||
|
if (k == 0) {
|
||||||
|
// it was possible to satisfy all soft-constraints.
|
||||||
|
return num_soft_cnstrs;
|
||||||
|
}
|
||||||
|
k--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Implement one step of the Fu&Malik algorithm.
|
||||||
|
See fu_malik_maxsat function for more details.
|
||||||
|
|
||||||
|
Input: soft constraints + aux-vars (aka answer literals)
|
||||||
|
Output: done/not-done when not done return updated set of soft-constraints and aux-vars.
|
||||||
|
- if SAT --> terminates
|
||||||
|
- if UNSAT
|
||||||
|
* compute unsat core
|
||||||
|
* add blocking variable to soft-constraints in the core
|
||||||
|
- replace soft-constraint with the one with the blocking variable
|
||||||
|
- we should also add an aux-var
|
||||||
|
- replace aux-var with a new one
|
||||||
|
* add at-most-one constraint with blocking
|
||||||
|
*/
|
||||||
|
int fu_malik_maxsat_step(Z3_context ctx, unsigned num_soft_cnstrs, Z3_ast * soft_cnstrs, Z3_ast * aux_vars)
|
||||||
|
{
|
||||||
|
// create assumptions
|
||||||
|
Z3_ast * assumptions = (Z3_ast*) malloc(sizeof(Z3_ast) * num_soft_cnstrs);
|
||||||
|
Z3_ast * core = (Z3_ast*) malloc(sizeof(Z3_ast) * num_soft_cnstrs);
|
||||||
|
unsigned core_size;
|
||||||
|
Z3_ast dummy_proof; // we don't care about proofs in this example
|
||||||
|
Z3_model m;
|
||||||
|
Z3_lbool is_sat;
|
||||||
|
unsigned i = 0;
|
||||||
|
for (i = 0; i < num_soft_cnstrs; i++) {
|
||||||
|
// Recall that we asserted (soft_cnstrs[i] \/ aux_vars[i])
|
||||||
|
// So using (NOT aux_vars[i]) as an assumption we are actually forcing the soft_cnstrs[i] to be considered.
|
||||||
|
assumptions[i] = Z3_mk_not(ctx, aux_vars[i]);
|
||||||
|
core[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
is_sat = Z3_check_assumptions(ctx, num_soft_cnstrs, assumptions, &m, &dummy_proof, &core_size, core);
|
||||||
|
if (is_sat != Z3_L_FALSE) {
|
||||||
|
return 1; // done
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Z3_ast * block_vars = (Z3_ast*) malloc(sizeof(Z3_ast) * core_size);
|
||||||
|
unsigned k = 0;
|
||||||
|
// update soft-constraints and aux_vars
|
||||||
|
for (i = 0; i < num_soft_cnstrs; i++) {
|
||||||
|
unsigned j;
|
||||||
|
// check whether assumption[i] is in the core or not
|
||||||
|
for (j = 0; j < core_size; j++) {
|
||||||
|
if (assumptions[i] == core[j])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (j < core_size) {
|
||||||
|
// assumption[i] is in the unsat core... so soft_cnstrs[i] is in the unsat core
|
||||||
|
Z3_ast block_var = mk_fresh_bool_var(ctx);
|
||||||
|
Z3_ast new_aux_var = mk_fresh_bool_var(ctx);
|
||||||
|
soft_cnstrs[i] = mk_binary_or(ctx, soft_cnstrs[i], block_var);
|
||||||
|
aux_vars[i] = new_aux_var;
|
||||||
|
block_vars[k] = block_var;
|
||||||
|
k++;
|
||||||
|
// Add new constraint containing the block variable.
|
||||||
|
// Note that we are using the new auxiliary variable to be able to use it as an assumption.
|
||||||
|
Z3_assert_cnstr(ctx, mk_binary_or(ctx, soft_cnstrs[i], new_aux_var));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert_at_most_one(ctx, k, block_vars);
|
||||||
|
return 0; // not done.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Fu & Malik procedure for MaxSAT. This procedure is based on
|
||||||
|
unsat core extraction and the at-most-one constraint.
|
||||||
|
|
||||||
|
Return the number of soft-constraints that can be
|
||||||
|
satisfied. Return -1 if the hard-constraints cannot be
|
||||||
|
satisfied. That is, the formula cannot be satisfied even if all
|
||||||
|
soft-constraints are ignored.
|
||||||
|
|
||||||
|
For more information on the Fu & Malik procedure:
|
||||||
|
|
||||||
|
Z. Fu and S. Malik, On solving the partial MAX-SAT problem, in International
|
||||||
|
Conference on Theory and Applications of Satisfiability Testing, 2006.
|
||||||
|
*/
|
||||||
|
int fu_malik_maxsat(Z3_context ctx, unsigned num_hard_cnstrs, Z3_ast * hard_cnstrs, unsigned num_soft_cnstrs, Z3_ast * soft_cnstrs)
|
||||||
|
{
|
||||||
|
Z3_ast * aux_vars;
|
||||||
|
Z3_lbool is_sat;
|
||||||
|
unsigned k;
|
||||||
|
assert_hard_constraints(ctx, num_hard_cnstrs, hard_cnstrs);
|
||||||
|
printf("checking whether hard constraints are satisfiable...\n");
|
||||||
|
is_sat = Z3_check(ctx);
|
||||||
|
if (is_sat == Z3_L_FALSE) {
|
||||||
|
// It is not possible to make the formula satisfiable even when ignoring all soft constraints.
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (num_soft_cnstrs == 0)
|
||||||
|
return 0; // nothing to be done...
|
||||||
|
/*
|
||||||
|
Fu&Malik algorithm is based on UNSAT-core extraction.
|
||||||
|
We accomplish that using auxiliary variables (aka answer literals).
|
||||||
|
*/
|
||||||
|
aux_vars = assert_soft_constraints(ctx, num_soft_cnstrs, soft_cnstrs);
|
||||||
|
k = 0;
|
||||||
|
for (;;) {
|
||||||
|
printf("iteration %d\n", k);
|
||||||
|
if (fu_malik_maxsat_step(ctx, num_soft_cnstrs, soft_cnstrs, aux_vars)) {
|
||||||
|
return num_soft_cnstrs - k;
|
||||||
|
}
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define NAIVE_MAXSAT 0
|
||||||
|
#define FU_MALIK_MAXSAT 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Finds the maximal number of assumptions that can be satisfied.
|
||||||
|
An assumption is any formula preceeded with the :assumption keyword.
|
||||||
|
"Hard" constraints can be supported by using the :formula keyword.
|
||||||
|
|
||||||
|
Input: file in SMT-LIB format, and MaxSAT algorithm to be used: 0 - Naive, 1 - Fu&Malik's algo.
|
||||||
|
Output: the maximum number of assumptions that can be satisfied.
|
||||||
|
*/
|
||||||
|
int smtlib_maxsat(char * file_name, int approach)
|
||||||
|
{
|
||||||
|
Z3_context ctx;
|
||||||
|
unsigned num_hard_cnstrs, num_soft_cnstrs;
|
||||||
|
Z3_ast * hard_cnstrs, * soft_cnstrs;
|
||||||
|
unsigned result;
|
||||||
|
ctx = mk_context();
|
||||||
|
Z3_parse_smtlib_file(ctx, file_name, 0, 0, 0, 0, 0, 0);
|
||||||
|
hard_cnstrs = get_hard_constraints(ctx, &num_hard_cnstrs);
|
||||||
|
soft_cnstrs = get_soft_constraints(ctx, &num_soft_cnstrs);
|
||||||
|
switch (approach) {
|
||||||
|
case NAIVE_MAXSAT:
|
||||||
|
result = naive_maxsat(ctx, num_hard_cnstrs, hard_cnstrs, num_soft_cnstrs, soft_cnstrs);
|
||||||
|
break;
|
||||||
|
case FU_MALIK_MAXSAT:
|
||||||
|
result = fu_malik_maxsat(ctx, num_hard_cnstrs, hard_cnstrs, num_soft_cnstrs, soft_cnstrs);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* Exercise: implement your own MaxSAT algorithm.*/
|
||||||
|
error("Not implemented yet.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free_cnstr_array(hard_cnstrs);
|
||||||
|
free_cnstr_array(soft_cnstrs);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char * argv[]) {
|
||||||
|
#if 1
|
||||||
|
int r;
|
||||||
|
if (argc != 2) {
|
||||||
|
error("usage: maxsat [filename.smt].");
|
||||||
|
}
|
||||||
|
r = smtlib_maxsat(argv[1], FU_MALIK_MAXSAT);
|
||||||
|
printf("result: %d\n", r);
|
||||||
|
#else
|
||||||
|
tst_at_most_one();
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@}*/
|
||||||
|
|
163
maxsat/maxsat.vcxproj
Normal file
163
maxsat/maxsat.vcxproj
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="commercial_64|Win32">
|
||||||
|
<Configuration>commercial_64</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="commercial|Win32">
|
||||||
|
<Configuration>commercial</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{7C154132-AAAB-4F60-B652-F8C51A63D244}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>maxsat</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='commercial_64|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='commercial|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='commercial_64|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='commercial|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='commercial_64|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='commercial|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>..\lib</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>..\lib</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='commercial_64|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>..\lib</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='commercial|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>..\lib</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="maxsat.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\lib\lib.vcxproj">
|
||||||
|
<Project>{4a7e5a93-19d8-4382-8950-fb2edec7a76e}</Project>
|
||||||
|
<Private>true</Private>
|
||||||
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
|
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||||
|
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||||
|
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
3
maxsat/maxsat.vcxproj.user
Normal file
3
maxsat/maxsat.vcxproj.user
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
278
shell/datalog_frontend.cpp
Normal file
278
shell/datalog_frontend.cpp
Normal file
|
@ -0,0 +1,278 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2006 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
datalog_frontend.cpp
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
<abstract>
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2010-05-18.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
|
||||||
|
#include<iostream>
|
||||||
|
#include<time.h>
|
||||||
|
#include<signal.h>
|
||||||
|
#include"stopwatch.h"
|
||||||
|
#include"front_end_params.h"
|
||||||
|
#include"datalog_parser.h"
|
||||||
|
#include"arith_decl_plugin.h"
|
||||||
|
#include"dl_compiler.h"
|
||||||
|
#include"dl_context.h"
|
||||||
|
#include"dl_mk_filter_rules.h"
|
||||||
|
#include"dl_finite_product_relation.h"
|
||||||
|
#include"datalog_frontend.h"
|
||||||
|
#include"timeout.h"
|
||||||
|
|
||||||
|
static stopwatch g_overall_time;
|
||||||
|
static stopwatch g_piece_timer;
|
||||||
|
static unsigned t_parsing = 0;
|
||||||
|
|
||||||
|
static datalog::context * g_ctx = 0;
|
||||||
|
static datalog::rule_set * g_orig_rules;
|
||||||
|
static datalog::instruction_block * g_code;
|
||||||
|
static datalog::execution_context * g_ectx;
|
||||||
|
static front_end_params * g_params;
|
||||||
|
|
||||||
|
datalog_params::datalog_params():
|
||||||
|
m_default_table("sparse")
|
||||||
|
{}
|
||||||
|
|
||||||
|
void datalog_params::register_params(ini_params& p) {
|
||||||
|
p.register_symbol_param("DEFAULT_TABLE", m_default_table, "Datalog engine: default table (sparse)");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void display_statistics(
|
||||||
|
std::ostream& out,
|
||||||
|
datalog::context& ctx,
|
||||||
|
datalog::rule_set& orig_rules,
|
||||||
|
datalog::instruction_block& code,
|
||||||
|
datalog::execution_context& ex_ctx,
|
||||||
|
front_end_params& params,
|
||||||
|
bool verbose
|
||||||
|
)
|
||||||
|
{
|
||||||
|
g_piece_timer.stop();
|
||||||
|
unsigned t_other = static_cast<int>(g_piece_timer.get_seconds()*1000);
|
||||||
|
g_overall_time.stop();
|
||||||
|
|
||||||
|
code.process_all_costs();
|
||||||
|
{
|
||||||
|
params_ref p(ctx.get_params());
|
||||||
|
p.set_bool(":output-profile", true);
|
||||||
|
p.set_uint(":profile-milliseconds-threshold", 100);
|
||||||
|
ctx.updt_params(p);
|
||||||
|
|
||||||
|
out << "--------------\n";
|
||||||
|
out << "original rules\n";
|
||||||
|
orig_rules.display(out);
|
||||||
|
|
||||||
|
out << "---------------\n";
|
||||||
|
out << "generated rules\n";
|
||||||
|
ctx.display_rules(out);
|
||||||
|
|
||||||
|
out << "--------------\n";
|
||||||
|
out << "instructions \n";
|
||||||
|
code.display(ctx, out);
|
||||||
|
|
||||||
|
out << "--------------\n";
|
||||||
|
out << "big relations \n";
|
||||||
|
ex_ctx.report_big_relations(1000, out);
|
||||||
|
}
|
||||||
|
out << "--------------\n";
|
||||||
|
out << "relation sizes\n";
|
||||||
|
ctx.get_rmanager().display_relation_sizes(out);
|
||||||
|
|
||||||
|
if (verbose) {
|
||||||
|
out << "--------------\n";
|
||||||
|
out << "rules\n";
|
||||||
|
ctx.display_rules(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
out << "Time: " << static_cast<int>(g_overall_time.get_seconds()*1000) << "ms\n";
|
||||||
|
out << "Parsing: " << t_parsing << "ms, other: " << t_other << "ms\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void display_statistics() {
|
||||||
|
if (g_ctx) {
|
||||||
|
display_statistics(std::cout, *g_ctx, *g_orig_rules, *g_code, *g_ectx, *g_params, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void on_timeout() {
|
||||||
|
display_statistics();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void on_ctrl_c(int) {
|
||||||
|
signal (SIGINT, SIG_DFL);
|
||||||
|
display_statistics();
|
||||||
|
raise(SIGINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned read_datalog(char const * file, datalog_params const& dl_params, front_end_params & front_end_params) {
|
||||||
|
IF_VERBOSE(1, verbose_stream() << "Z3 Datalog Engine\n";);
|
||||||
|
ast_manager m;
|
||||||
|
g_overall_time.start();
|
||||||
|
register_on_timeout_proc(on_timeout);
|
||||||
|
signal(SIGINT, on_ctrl_c);
|
||||||
|
params_ref params;
|
||||||
|
params.set_sym(":engine", symbol("datalog"));
|
||||||
|
params.set_sym(":default-table", dl_params.m_default_table);
|
||||||
|
|
||||||
|
datalog::context ctx(m, front_end_params, params);
|
||||||
|
size_t watermark = front_end_params.m_memory_high_watermark;
|
||||||
|
if (watermark == 0) {
|
||||||
|
memory::set_high_watermark(static_cast<size_t>(UINT_MAX));
|
||||||
|
}
|
||||||
|
datalog::relation_manager & rmgr = ctx.get_rmanager();
|
||||||
|
datalog::relation_plugin & inner_plg = *rmgr.get_relation_plugin(symbol("tr_hashtable"));
|
||||||
|
SASSERT(&inner_plg);
|
||||||
|
rmgr.register_plugin(alloc(datalog::finite_product_relation_plugin, inner_plg, rmgr));
|
||||||
|
|
||||||
|
g_piece_timer.reset();
|
||||||
|
g_piece_timer.start();
|
||||||
|
|
||||||
|
bool wpa_benchmark = datalog::is_directory(std::string(file));
|
||||||
|
if (wpa_benchmark) {
|
||||||
|
scoped_ptr<datalog::wpa_parser> parser = datalog::wpa_parser::create(ctx, m);
|
||||||
|
if (!parser->parse_directory(file)) {
|
||||||
|
std::cerr << "ERROR: failed to parse file\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
scoped_ptr<datalog::parser> parser = datalog::parser::create(ctx, m);
|
||||||
|
if (!parser->parse_file(file)) {
|
||||||
|
std::cerr << "ERROR: failed to parse file\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_piece_timer.stop();
|
||||||
|
t_parsing = static_cast<int>(g_piece_timer.get_seconds()*1000);
|
||||||
|
IF_VERBOSE(1, verbose_stream() << "parsing finished\n";);
|
||||||
|
IF_VERBOSE(1, verbose_stream() << "running saturation...\n";);
|
||||||
|
g_piece_timer.reset();
|
||||||
|
g_piece_timer.start();
|
||||||
|
//all rules were added
|
||||||
|
ctx.close();
|
||||||
|
|
||||||
|
TRACE("dl_compiler", ctx.display(tout););
|
||||||
|
|
||||||
|
datalog::rule_set original_rules(ctx.get_rules());
|
||||||
|
datalog::decl_set original_predicates;
|
||||||
|
ctx.collect_predicates(original_predicates);
|
||||||
|
|
||||||
|
datalog::instruction_block rules_code;
|
||||||
|
datalog::instruction_block termination_code;
|
||||||
|
datalog::execution_context ex_ctx(ctx);
|
||||||
|
|
||||||
|
IF_VERBOSE(10, original_rules.display_deps(verbose_stream()););
|
||||||
|
|
||||||
|
g_ctx = &ctx;
|
||||||
|
g_orig_rules = &original_rules;
|
||||||
|
g_code = &rules_code;
|
||||||
|
g_ectx = &ex_ctx;
|
||||||
|
g_params = &front_end_params;
|
||||||
|
|
||||||
|
try {
|
||||||
|
g_piece_timer.reset();
|
||||||
|
g_piece_timer.start();
|
||||||
|
|
||||||
|
bool early_termination;
|
||||||
|
unsigned timeout = ctx.initial_restart_timeout();
|
||||||
|
if(timeout == 0) {
|
||||||
|
timeout = UINT_MAX;
|
||||||
|
}
|
||||||
|
do {
|
||||||
|
model_converter_ref mc; // ignored
|
||||||
|
proof_converter_ref pc; // ignored
|
||||||
|
ctx.transform_rules(mc, pc);
|
||||||
|
|
||||||
|
datalog::compiler::compile(ctx, ctx.get_rules(), rules_code, termination_code);
|
||||||
|
|
||||||
|
TRACE("dl_compiler", rules_code.display(ctx, tout););
|
||||||
|
|
||||||
|
rules_code.make_annotations(ex_ctx);
|
||||||
|
|
||||||
|
ex_ctx.set_timelimit(timeout);
|
||||||
|
SASSERT(!ex_ctx.should_terminate());
|
||||||
|
|
||||||
|
early_termination = !rules_code.perform(ex_ctx);
|
||||||
|
if(early_termination) {
|
||||||
|
IF_VERBOSE(10, ex_ctx.report_big_relations(1000, verbose_stream()););
|
||||||
|
if (memory::above_high_watermark()) {
|
||||||
|
throw out_of_memory_error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ex_ctx.reset_timelimit();
|
||||||
|
TRUSTME( termination_code.perform(ex_ctx) );
|
||||||
|
ctx.saturation_was_run();
|
||||||
|
|
||||||
|
if (early_termination) {
|
||||||
|
IF_VERBOSE(1, verbose_stream() << "restarting saturation\n";);
|
||||||
|
|
||||||
|
uint64 new_timeout = static_cast<uint64>(timeout)*ctx.initial_restart_timeout();
|
||||||
|
if(new_timeout>UINT_MAX) {
|
||||||
|
timeout=UINT_MAX;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
timeout=static_cast<unsigned>(new_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
rules_code.process_all_costs();
|
||||||
|
rules_code.reset();
|
||||||
|
termination_code.reset();
|
||||||
|
ex_ctx.reset();
|
||||||
|
ctx.reopen();
|
||||||
|
ctx.restrict_predicates(original_predicates);
|
||||||
|
ctx.replace_rules(original_rules);
|
||||||
|
ctx.close();
|
||||||
|
}
|
||||||
|
} while (early_termination);
|
||||||
|
|
||||||
|
|
||||||
|
TRACE("dl_compiler", ctx.display(tout);
|
||||||
|
rules_code.display(ctx, tout););
|
||||||
|
|
||||||
|
if (ctx.get_params().get_bool(":output-tuples", true)) {
|
||||||
|
ctx.display_output_facts(std::cout);
|
||||||
|
}
|
||||||
|
|
||||||
|
display_statistics(
|
||||||
|
std::cout,
|
||||||
|
ctx,
|
||||||
|
original_rules,
|
||||||
|
rules_code,
|
||||||
|
ex_ctx,
|
||||||
|
front_end_params,
|
||||||
|
false);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (out_of_memory_error) {
|
||||||
|
std::cout << "\n\nOUT OF MEMORY!\n\n";
|
||||||
|
display_statistics(
|
||||||
|
std::cout,
|
||||||
|
ctx,
|
||||||
|
original_rules,
|
||||||
|
rules_code,
|
||||||
|
ex_ctx,
|
||||||
|
front_end_params,
|
||||||
|
true);
|
||||||
|
return ERR_MEMOUT;
|
||||||
|
}
|
||||||
|
register_on_timeout_proc(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
32
shell/datalog_frontend.h
Normal file
32
shell/datalog_frontend.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2006 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
datalog_frontend.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
<abstract>
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2010-05-18.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _DATALOG_FRONTEND_H_
|
||||||
|
#define _DATALOG_FRONTEND_H_
|
||||||
|
|
||||||
|
struct datalog_params {
|
||||||
|
symbol m_default_table;
|
||||||
|
datalog_params();
|
||||||
|
virtual void register_params(ini_params& p);
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned read_datalog(char const * file, datalog_params const& dl_params, front_end_params & front_end_params);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _DATALOG_FRONTEND_H_ */
|
||||||
|
|
106
shell/dimacs_frontend.cpp
Normal file
106
shell/dimacs_frontend.cpp
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2011 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
dimacs_frontend.cpp
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Frontend for reading dimacs input files
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2011-07-26.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#include<iostream>
|
||||||
|
#include<time.h>
|
||||||
|
#include<signal.h>
|
||||||
|
#include"timeout.h"
|
||||||
|
#include"dimacs.h"
|
||||||
|
#include"sat_solver.h"
|
||||||
|
#include"front_end_params.h"
|
||||||
|
|
||||||
|
extern bool g_display_statistics;
|
||||||
|
static sat::solver * g_solver = 0;
|
||||||
|
static clock_t g_start_time;
|
||||||
|
|
||||||
|
static void display_statistics() {
|
||||||
|
clock_t end_time = clock();
|
||||||
|
if (g_solver && g_display_statistics) {
|
||||||
|
std::cout.flush();
|
||||||
|
std::cerr.flush();
|
||||||
|
|
||||||
|
statistics st;
|
||||||
|
g_solver->collect_statistics(st);
|
||||||
|
st.update("total time", ((static_cast<double>(end_time) - static_cast<double>(g_start_time)) / CLOCKS_PER_SEC));
|
||||||
|
st.display_smt2(std::cout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void on_timeout() {
|
||||||
|
display_statistics();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void on_ctrl_c(int) {
|
||||||
|
signal (SIGINT, SIG_DFL);
|
||||||
|
display_statistics();
|
||||||
|
raise(SIGINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void display_model(sat::solver const & s) {
|
||||||
|
sat::model const & m = s.get_model();
|
||||||
|
for (unsigned i = 1; i < m.size(); i++) {
|
||||||
|
switch (m[i]) {
|
||||||
|
case l_false: std::cout << "-" << i << " "; break;
|
||||||
|
case l_undef: break;
|
||||||
|
case l_true: std::cout << i << " "; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned read_dimacs(char const * file_name, front_end_params & front_end_params) {
|
||||||
|
g_start_time = clock();
|
||||||
|
register_on_timeout_proc(on_timeout);
|
||||||
|
signal(SIGINT, on_ctrl_c);
|
||||||
|
params_ref p;
|
||||||
|
p.set_bool(":produce-models", front_end_params.m_model);
|
||||||
|
sat::solver solver(p, 0);
|
||||||
|
g_solver = &solver;
|
||||||
|
|
||||||
|
if (file_name) {
|
||||||
|
std::ifstream in(file_name);
|
||||||
|
if (in.bad() || in.fail()) {
|
||||||
|
std::cerr << "(error \"failed to open file '" << file_name << "'\")" << std::endl;
|
||||||
|
exit(ERR_OPEN_FILE);
|
||||||
|
}
|
||||||
|
parse_dimacs(in, solver);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
parse_dimacs(std::cin, solver);
|
||||||
|
}
|
||||||
|
IF_VERBOSE(20, solver.display_status(verbose_stream()););
|
||||||
|
|
||||||
|
lbool r = solver.check();
|
||||||
|
switch (r) {
|
||||||
|
case l_true:
|
||||||
|
std::cout << "sat\n";
|
||||||
|
if (front_end_params.m_model)
|
||||||
|
display_model(solver);
|
||||||
|
break;
|
||||||
|
case l_undef:
|
||||||
|
std::cout << "unknown\n";
|
||||||
|
break;
|
||||||
|
case l_false:
|
||||||
|
std::cout << "unsat\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (g_display_statistics)
|
||||||
|
display_statistics();
|
||||||
|
return 0;
|
||||||
|
}
|
25
shell/dimacs_frontend.h
Normal file
25
shell/dimacs_frontend.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2011 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
dimacs_frontend.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
<abstract>
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2011-07-26.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _DIMACS_FRONTEND_H_
|
||||||
|
#define _DIMACS_FRONTEND_H_
|
||||||
|
|
||||||
|
unsigned read_dimacs(char const * benchmark_file, front_end_params & front_end_params);
|
||||||
|
|
||||||
|
#endif /* _DATALOG_FRONTEND_H_ */
|
||||||
|
|
459
shell/main.cpp
Normal file
459
shell/main.cpp
Normal file
|
@ -0,0 +1,459 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2006 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
main.cpp
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Z3 command line tool.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2006-10-10.
|
||||||
|
Nikolaj Bjorner (nbjorner)
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#include<iostream>
|
||||||
|
#include"memory_manager.h"
|
||||||
|
#include"trace.h"
|
||||||
|
#include"debug.h"
|
||||||
|
#include"util.h"
|
||||||
|
#include"pp.h"
|
||||||
|
#include"smtlib_frontend.h"
|
||||||
|
#include"z3_log_frontend.h"
|
||||||
|
#include"warning.h"
|
||||||
|
#include"version.h"
|
||||||
|
#include"datalog_frontend.h"
|
||||||
|
#include"dimacs_frontend.h"
|
||||||
|
#include"timeout.h"
|
||||||
|
#include"z3_exception.h"
|
||||||
|
#include"error_codes.h"
|
||||||
|
|
||||||
|
typedef enum { IN_UNSPECIFIED, IN_SMTLIB, IN_SMTLIB_2, IN_DATALOG, IN_DIMACS, IN_Z3_LOG } input_kind;
|
||||||
|
|
||||||
|
std::string g_aux_input_file;
|
||||||
|
char const * g_input_file = 0;
|
||||||
|
bool g_standard_input = false;
|
||||||
|
input_kind g_input_kind = IN_UNSPECIFIED;
|
||||||
|
front_end_params * g_front_end_params = 0;
|
||||||
|
bool g_display_statistics = false;
|
||||||
|
bool g_display_istatistics = false;
|
||||||
|
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
#define OPT "/"
|
||||||
|
#else
|
||||||
|
#define OPT "-"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void error(const char * msg) {
|
||||||
|
std::cerr << "Error: " << msg << "\n";
|
||||||
|
std::cerr << "For usage information: z3 " << OPT << "h\n";
|
||||||
|
exit(ERR_CMD_LINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void display_usage() {
|
||||||
|
std::cout << "Z3 [version " << Z3_MAJOR_VERSION << "." << Z3_MINOR_VERSION << "]. (C) Copyright 2006 Microsoft Corp.\n";
|
||||||
|
std::cout << "Usage: z3 [options] [" << OPT << "file:]file\n";
|
||||||
|
std::cout << "\nInput format:\n";
|
||||||
|
std::cout << " " << OPT << "smt use parser for SMT input format.\n";
|
||||||
|
std::cout << " " << OPT << "smt2 use parser for SMT 2 input format.\n";
|
||||||
|
std::cout << " " << OPT << "dl use parser for Datalog input format.\n";
|
||||||
|
std::cout << " " << OPT << "dimacs use parser for DIMACS input format.\n";
|
||||||
|
std::cout << " " << OPT << "log use parser for Z3 log input format.\n";
|
||||||
|
std::cout << " " << OPT << "in read formula from standard input.\n";
|
||||||
|
std::cout << "\nMiscellaneous:\n";
|
||||||
|
std::cout << " " << OPT << "h, " << OPT << "? prints this message.\n";
|
||||||
|
std::cout << " " << OPT << "version prints version number of Z3.\n";
|
||||||
|
std::cout << " " << OPT << "v:level be verbose, where <level> is the verbosity level.\n";
|
||||||
|
std::cout << " " << OPT << "nw disable warning messages.\n";
|
||||||
|
std::cout << " " << OPT << "ini:file configuration file.\n";
|
||||||
|
std::cout << " " << OPT << "ini? display all available INI file parameters.\n";
|
||||||
|
std::cout << " --" << " all remaining arguments are assumed to be part of the input file name. This option allows Z3 to read files with strange names such as: -foo.smt2.\n";
|
||||||
|
std::cout << "\nResources:\n";
|
||||||
|
// timeout and memout are now available on Linux and OSX too.
|
||||||
|
std::cout << " " << OPT << "T:timeout set the timeout (in seconds).\n";
|
||||||
|
std::cout << " " << OPT << "t:timeout set the soft timeout (in seconds). It only kills the current query.\n";
|
||||||
|
std::cout << " " << OPT << "memory:Megabytes set a limit for virtual memory consumption.\n";
|
||||||
|
//
|
||||||
|
std::cout << "\nOutput:\n";
|
||||||
|
std::cout << " " << OPT << "st display statistics.\n";
|
||||||
|
std::cout << "\nSearch heuristics:\n";
|
||||||
|
std::cout << " " << OPT << "rs:num random seed.\n";
|
||||||
|
#if defined(Z3DEBUG) || defined(_TRACE)
|
||||||
|
std::cout << "\nDebugging support:\n";
|
||||||
|
#endif
|
||||||
|
#ifdef _TRACE
|
||||||
|
std::cout << " " << OPT << "tr:tag enable trace messages tagged with <tag>.\n";
|
||||||
|
#endif
|
||||||
|
#ifdef Z3DEBUG
|
||||||
|
std::cout << " " << OPT << "dbg:tag enable assertions tagged with <tag>.\n";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
class extra_params : public datalog_params {
|
||||||
|
bool & m_statistics;
|
||||||
|
public:
|
||||||
|
extra_params():
|
||||||
|
m_statistics(g_display_statistics) {
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void register_params(ini_params & p) {
|
||||||
|
datalog_params::register_params(p);
|
||||||
|
p.register_bool_param("STATISTICS", m_statistics, "display statistics");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ini_params* g_params = 0;
|
||||||
|
extra_params* g_extra_params = 0;
|
||||||
|
bool g_params_initialized = false;
|
||||||
|
|
||||||
|
void init_params() {
|
||||||
|
if (!g_params_initialized) {
|
||||||
|
z3_bound_num_procs();
|
||||||
|
g_front_end_params = new front_end_params();
|
||||||
|
g_params = new ini_params();
|
||||||
|
g_extra_params = new extra_params();
|
||||||
|
register_verbosity_level(*g_params);
|
||||||
|
register_warning(*g_params);
|
||||||
|
register_pp_params(*g_params);
|
||||||
|
g_front_end_params->register_params(*g_params);
|
||||||
|
g_extra_params->register_params(*g_params);
|
||||||
|
g_params_initialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void del_params() {
|
||||||
|
if (g_front_end_params != NULL)
|
||||||
|
g_front_end_params->close_trace_file();
|
||||||
|
delete g_extra_params;
|
||||||
|
delete g_params;
|
||||||
|
delete g_front_end_params;
|
||||||
|
g_extra_params = 0;
|
||||||
|
g_params = 0;
|
||||||
|
g_front_end_params = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void read_ini_file(const char * file_name) {
|
||||||
|
std::ifstream in(file_name);
|
||||||
|
if (in.bad() || in.fail()) {
|
||||||
|
std::cerr << "Error: failed to open init file \"" << file_name << "\".\n";
|
||||||
|
exit(ERR_INI_FILE);
|
||||||
|
}
|
||||||
|
g_params->read_ini_file(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
void display_ini_help() {
|
||||||
|
g_params->display_params(std::cout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void display_config() {
|
||||||
|
if (g_front_end_params->m_display_config) {
|
||||||
|
display_ini_help();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void display_ini_doc() {
|
||||||
|
g_params->display_params_documentation(std::cout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void parse_cmd_line_args(int argc, char ** argv) {
|
||||||
|
int i = 1;
|
||||||
|
char * eq_pos = 0;
|
||||||
|
while (i < argc) {
|
||||||
|
char * arg = argv[i];
|
||||||
|
|
||||||
|
if (arg[0] == '-' && arg[1] == '-' && arg[2] == 0) {
|
||||||
|
// Little hack used to read files with strange names such as -foo.smt2
|
||||||
|
// z3 -- -foo.smt2
|
||||||
|
i++;
|
||||||
|
g_aux_input_file = "";
|
||||||
|
for (; i < argc; i++) {
|
||||||
|
g_aux_input_file += argv[i];
|
||||||
|
if (i < argc - 1)
|
||||||
|
g_aux_input_file += " ";
|
||||||
|
}
|
||||||
|
if (g_front_end_params->m_interactive) {
|
||||||
|
warning_msg("ignoring input file in interactive mode.");
|
||||||
|
}
|
||||||
|
else if (g_input_file) {
|
||||||
|
warning_msg("input file was already specified.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
g_input_file = g_aux_input_file.c_str();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg[0] == '-'
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
|| arg[0] == '/'
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
char * opt_name = arg + 1;
|
||||||
|
char * opt_arg = 0;
|
||||||
|
char * colon = strchr(arg, ':');
|
||||||
|
if (colon) {
|
||||||
|
opt_arg = colon + 1;
|
||||||
|
*colon = 0;
|
||||||
|
}
|
||||||
|
if (strcmp(opt_name, "h") == 0 || strcmp(opt_name, "?") == 0 || strcmp(opt_name, "help") == 0) {
|
||||||
|
display_usage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
if (strcmp(opt_name, "version") == 0) {
|
||||||
|
#ifdef _EXTERNAL_RELEASE
|
||||||
|
std::cout << "Z3 version " << Z3_MAJOR_VERSION << "." << Z3_MINOR_VERSION << "\n";
|
||||||
|
#else
|
||||||
|
std::cout
|
||||||
|
<< "Z3 version (major minor build revision): "
|
||||||
|
<< Z3_MAJOR_VERSION << " "
|
||||||
|
<< Z3_MINOR_VERSION << " "
|
||||||
|
<< Z3_BUILD_NUMBER << " "
|
||||||
|
<< Z3_REVISION_NUMBER << "\n";
|
||||||
|
#endif
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "smt") == 0) {
|
||||||
|
g_input_kind = IN_SMTLIB;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "smt2") == 0) {
|
||||||
|
g_input_kind = IN_SMTLIB_2;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "in") == 0) {
|
||||||
|
g_standard_input = true;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "dimacs") == 0) {
|
||||||
|
g_input_kind = IN_DIMACS;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "log") == 0) {
|
||||||
|
g_input_kind = IN_Z3_LOG;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "st") == 0) {
|
||||||
|
g_display_statistics = true;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "ist") == 0) {
|
||||||
|
g_display_istatistics = true;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "v") == 0) {
|
||||||
|
if (!opt_arg)
|
||||||
|
error("option argument (/v:level) is missing.");
|
||||||
|
long lvl = strtol(opt_arg, 0, 10);
|
||||||
|
set_verbosity_level(lvl);
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "vldt") == 0) {
|
||||||
|
g_front_end_params->m_model_validate = true;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "file") == 0) {
|
||||||
|
g_input_file = opt_arg;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "r") == 0) {
|
||||||
|
if (!opt_arg) {
|
||||||
|
error("optional argument (/r:level) is missing.");
|
||||||
|
}
|
||||||
|
g_front_end_params->m_relevancy_lvl = strtol(opt_arg, 0, 10);
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "rd") == 0) {
|
||||||
|
if (!opt_arg) {
|
||||||
|
error("optional argument (/rd:num) is missing.");
|
||||||
|
}
|
||||||
|
g_front_end_params->m_random_var_freq = static_cast<double>(strtol(opt_arg, 0, 10)) / 100.0;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "rs") == 0) {
|
||||||
|
if (!opt_arg) {
|
||||||
|
error("optional argument (/rs:num) is missing.");
|
||||||
|
}
|
||||||
|
long seed = strtol(opt_arg, 0, 10);
|
||||||
|
g_front_end_params->m_random_seed = seed;
|
||||||
|
g_front_end_params->m_arith_random_seed = seed;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "T") == 0) {
|
||||||
|
if (!opt_arg)
|
||||||
|
error("option argument (/T:timeout) is missing.");
|
||||||
|
long tm = strtol(opt_arg, 0, 10);
|
||||||
|
set_timeout(tm * 1000);
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "t") == 0) {
|
||||||
|
if (!opt_arg)
|
||||||
|
error("option argument (/t:timeout) is missing.");
|
||||||
|
long tm = strtol(opt_arg, 0, 10);
|
||||||
|
g_front_end_params->m_soft_timeout = tm*1000;
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "nw") == 0) {
|
||||||
|
enable_warning_messages(false);
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "ini") == 0) {
|
||||||
|
if (!opt_arg)
|
||||||
|
error("option argument (/ini:file) is missing.");
|
||||||
|
read_ini_file(opt_arg);
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "ini?") == 0) {
|
||||||
|
display_ini_help();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else if (strcmp(opt_name, "geninidoc") == 0) {
|
||||||
|
display_ini_doc();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
#ifdef _TRACE
|
||||||
|
else if (strcmp(opt_name, "tr") == 0) {
|
||||||
|
if (!opt_arg)
|
||||||
|
error("option argument (/tr:tag) is missing.");
|
||||||
|
enable_trace(opt_arg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef Z3DEBUG
|
||||||
|
else if (strcmp(opt_name, "dbg") == 0) {
|
||||||
|
if (!opt_arg)
|
||||||
|
error("option argument (/dbg:tag) is missing.");
|
||||||
|
enable_debug(opt_arg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else if (strcmp(opt_name, "memory") == 0) {
|
||||||
|
if (!opt_arg)
|
||||||
|
error("option argument (/memory:val) is missing.");
|
||||||
|
g_front_end_params->m_memory_high_watermark = strtoul(opt_arg, 0, 10);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cerr << "Error: invalid command line option: " << arg << "\n";
|
||||||
|
std::cerr << "For usage information: z3 " << OPT << "h\n";
|
||||||
|
exit(ERR_CMD_LINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (argv[i][0] != '"' && (eq_pos = strchr(argv[i], '='))) {
|
||||||
|
char * key = argv[i];
|
||||||
|
*eq_pos = 0;
|
||||||
|
char * value = eq_pos+1;
|
||||||
|
g_params->set_param_value(key, value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (g_front_end_params->m_interactive) {
|
||||||
|
warning_msg("ignoring input file in interactive mode.");
|
||||||
|
}
|
||||||
|
else if (g_input_file) {
|
||||||
|
warning_msg("input file was already specified.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
g_input_file = arg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char const * get_extension(char const * file_name) {
|
||||||
|
if (file_name == 0)
|
||||||
|
return 0;
|
||||||
|
char const * last_dot = 0;
|
||||||
|
for (;;) {
|
||||||
|
char const * tmp = strchr(file_name, '.');
|
||||||
|
if (tmp == 0) {
|
||||||
|
return last_dot;
|
||||||
|
}
|
||||||
|
last_dot = tmp + 1;
|
||||||
|
file_name = last_dot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class global_state_initialiser {
|
||||||
|
public:
|
||||||
|
global_state_initialiser() {
|
||||||
|
memory::initialize(0);
|
||||||
|
#if defined(_WINDOWS) && defined(_Z3_BUILD_PARALLEL_SMT)
|
||||||
|
memory::mem->set_threaded_mode(true);
|
||||||
|
#endif
|
||||||
|
init_params();
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
del_params();
|
||||||
|
memory::finalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
~global_state_initialiser() {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(int argc, char ** argv) {
|
||||||
|
try{
|
||||||
|
unsigned return_value = 0;
|
||||||
|
global_state_initialiser global_state;
|
||||||
|
memory::exit_when_out_of_memory(true, "ERROR: out of memory");
|
||||||
|
parse_cmd_line_args(argc, argv);
|
||||||
|
memory::set_high_watermark(static_cast<size_t>(g_front_end_params->m_memory_high_watermark) * 1024 * 1024);
|
||||||
|
memory::set_max_size(static_cast<size_t>(g_front_end_params->m_memory_max_size) * 1024 * 1024);
|
||||||
|
g_front_end_params->open_trace_file();
|
||||||
|
DEBUG_CODE(
|
||||||
|
if (g_front_end_params->m_copy_params != -1) {
|
||||||
|
g_front_end_params->copy_params(g_front_end_params->m_copy_params);
|
||||||
|
TRACE("copy_params", g_params->display_params(tout););
|
||||||
|
});
|
||||||
|
if (g_input_file && g_standard_input) {
|
||||||
|
error("using standard input to read formula.");
|
||||||
|
}
|
||||||
|
if (!g_input_file && !g_front_end_params->m_interactive && !g_standard_input) {
|
||||||
|
error("input file was not specified.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_input_kind == IN_UNSPECIFIED) {
|
||||||
|
g_input_kind = IN_SMTLIB;
|
||||||
|
char const * ext = get_extension(g_input_file);
|
||||||
|
if (ext) {
|
||||||
|
if (strcmp(ext, "datalog") == 0 || strcmp(ext, "dl") == 0) {
|
||||||
|
g_input_kind = IN_DATALOG;
|
||||||
|
}
|
||||||
|
else if (strcmp(ext, "dimacs") == 0 || strcmp(ext, "cnf") == 0) {
|
||||||
|
g_input_kind = IN_DIMACS;
|
||||||
|
}
|
||||||
|
else if (strcmp(ext, "log") == 0) {
|
||||||
|
g_input_kind = IN_Z3_LOG;
|
||||||
|
}
|
||||||
|
else if (strcmp(ext, "smt2") == 0) {
|
||||||
|
g_input_kind = IN_SMTLIB_2;
|
||||||
|
}
|
||||||
|
else if (strcmp(ext, "smt") == 0) {
|
||||||
|
g_input_kind = IN_SMTLIB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (g_input_kind) {
|
||||||
|
case IN_SMTLIB:
|
||||||
|
return_value = read_smtlib_file(g_input_file, *g_front_end_params);
|
||||||
|
break;
|
||||||
|
case IN_SMTLIB_2:
|
||||||
|
memory::exit_when_out_of_memory(true, "(error \"out of memory\")");
|
||||||
|
return_value = read_smtlib2_commands(g_input_file, *g_front_end_params);
|
||||||
|
break;
|
||||||
|
case IN_DIMACS:
|
||||||
|
return_value = read_dimacs(g_input_file, *g_front_end_params);
|
||||||
|
break;
|
||||||
|
case IN_DATALOG:
|
||||||
|
read_datalog(g_input_file, *g_extra_params, *g_front_end_params);
|
||||||
|
break;
|
||||||
|
case IN_Z3_LOG:
|
||||||
|
replay_z3_log(g_input_file);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
|
global_state.reset();
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
_CrtDumpMemoryLeaks();
|
||||||
|
#endif
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
catch (z3_exception & ex) {
|
||||||
|
// unhandled exception
|
||||||
|
std::cerr << "ERROR: " << ex.msg() << "\n";
|
||||||
|
if (ex.has_error_code())
|
||||||
|
return ex.error_code();
|
||||||
|
else
|
||||||
|
return ERR_INTERNAL_FATAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
67
shell/options.h
Normal file
67
shell/options.h
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
\page cmdline Command line options
|
||||||
|
|
||||||
|
\section informat Input format
|
||||||
|
|
||||||
|
Z3 understands a set of default file extensions, and will invoke a parser based on the extension.
|
||||||
|
|
||||||
|
- \ext{smt2} - <a href="http://www.smtlib.org">SMT-LIB 2</a> format, this is the preferred input format.
|
||||||
|
|
||||||
|
- \ext{dimacs}, \ext{cnf} - DIMACS format used by regular SAT solvers.
|
||||||
|
|
||||||
|
- \ext{dl} - Datalog input format.
|
||||||
|
|
||||||
|
- \ext{smt} - (deprecated) <a href="http://www.smtlib.org">SMT-LIB 1</a> format.
|
||||||
|
|
||||||
|
You can tell Z3 explicitly which grammar the input belongs to by using the following options:
|
||||||
|
|
||||||
|
\cmdopt{smt2} use parser for SMT-LIB 2.0 input format.
|
||||||
|
|
||||||
|
\cmdopt{dimacs} use dimacs parser to read the input file.
|
||||||
|
|
||||||
|
\section cmdlinemis Miscellaneous
|
||||||
|
|
||||||
|
\cmdopt{h\, ?} prints the help message.
|
||||||
|
|
||||||
|
\cmdopt{version} prints version number of Z3.
|
||||||
|
|
||||||
|
\cmdopt{v:level} be verbose, where <level> is the verbosity level.
|
||||||
|
|
||||||
|
\cmdopt{nw} disable warning messages.
|
||||||
|
|
||||||
|
\cmdopt{ini:file} configuration file.
|
||||||
|
Several parameters are available besides the ones listed by \ty{/h}.
|
||||||
|
These parameters can be loaded from an initialization file by using
|
||||||
|
this option.
|
||||||
|
|
||||||
|
\cmdopt{ini?} display all available INI file parameters.
|
||||||
|
|
||||||
|
The available \ref config can also be supplied on the command
|
||||||
|
line as a pair parameter-name=parameter-value.
|
||||||
|
|
||||||
|
\section cmdlineres Resources
|
||||||
|
|
||||||
|
\cmdopt{T:timeout} set the timeout (in seconds).
|
||||||
|
Setting this option causes the entire process to exit.
|
||||||
|
It is a reliable way to kill Z3.
|
||||||
|
|
||||||
|
\cmdopt{t:timeout} set the soft timeout (in seconds).
|
||||||
|
It only kills the current query.
|
||||||
|
|
||||||
|
\cmdopt{memory:Megabytes} set a limit for virtual memory consumption.
|
||||||
|
This limit for virtual memory consumption is approximate, but in
|
||||||
|
general a good guideline for controlling the memory consumption of Z3. If the
|
||||||
|
memory consumption exceeds the specified number of Megabytes, Z3 exits with a warning
|
||||||
|
message.
|
||||||
|
|
||||||
|
\section cmdlineout Output
|
||||||
|
|
||||||
|
\cmdopt{st} display statistics.
|
||||||
|
This option can be used to dump various statistics about the search,
|
||||||
|
such as number of splits, conflict clauses, and quantifier instantiations.
|
||||||
|
|
||||||
|
\section cmdlinesearch Search heuristics
|
||||||
|
|
||||||
|
\cmdopt{rs:num} random seed.
|
||||||
|
*/
|
14
shell/resource.h
Normal file
14
shell/resource.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by shell.rc
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
102
shell/shell.rc
Normal file
102
shell/shell.rc
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "afxres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (U.S.) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"#include ""afxres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION 4,2,0,0
|
||||||
|
PRODUCTVERSION 4,2,0,0
|
||||||
|
FILEFLAGSMASK 0x17L
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x4L
|
||||||
|
FILETYPE 0x1L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "Microsoft"
|
||||||
|
VALUE "FileDescription", "Z3 shell"
|
||||||
|
VALUE "FileVersion" "4,2,0,0"
|
||||||
|
VALUE "InternalName", "Z3 shell"
|
||||||
|
VALUE "LegalCopyright", "(c) Microsoft Corporation. All rights reserved."
|
||||||
|
VALUE "OriginalFilename", "z3.exe"
|
||||||
|
VALUE "ProductName", "Z3"
|
||||||
|
VALUE "ProductVersion", "4,2,0,0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // English (U.S.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
1630
shell/shell.vcxproj
Normal file
1630
shell/shell.vcxproj
Normal file
File diff suppressed because it is too large
Load diff
3
shell/shell.vcxproj.user
Normal file
3
shell/shell.vcxproj.user
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
118
shell/simple_sat.cpp
Normal file
118
shell/simple_sat.cpp
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2006 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
simple_sat.cpp
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
<abstract>
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2006-10-10.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#include<fstream>
|
||||||
|
#include<time.h>
|
||||||
|
#include"front_end_params.h"
|
||||||
|
#include"sat_def.h"
|
||||||
|
#include"dimacs_parser.h"
|
||||||
|
#include"timeit.h"
|
||||||
|
#include"mem_stat.h"
|
||||||
|
|
||||||
|
class simple_sat_solver : public no_extension {
|
||||||
|
const front_end_params & m_params;
|
||||||
|
sat_solver<simple_sat_solver> * m_sat;
|
||||||
|
unsigned m_num_vars;
|
||||||
|
svector<lbool> m_model;
|
||||||
|
public:
|
||||||
|
simple_sat_solver(const front_end_params & p):
|
||||||
|
m_params(p),
|
||||||
|
m_sat(new sat_solver<simple_sat_solver>(*this, p)),
|
||||||
|
m_num_vars(0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
~simple_sat_solver() {
|
||||||
|
delete m_sat;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool enable_ref_counters() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mk_var() {
|
||||||
|
m_sat->mk_var();
|
||||||
|
m_num_vars++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mk_clause(const literal_vector & lits) {
|
||||||
|
m_sat->mk_main_clause(lits);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned get_num_vars() const {
|
||||||
|
return m_num_vars;
|
||||||
|
}
|
||||||
|
|
||||||
|
lbool check() {
|
||||||
|
return m_sat->check();
|
||||||
|
}
|
||||||
|
|
||||||
|
void mk_model() {
|
||||||
|
if (m_params.m_build_model) {
|
||||||
|
m_sat->save_assignment(m_model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void display_model(std::ostream & out) const {
|
||||||
|
int sz = m_model.size();
|
||||||
|
for (int i = 1; i < sz; i++) {
|
||||||
|
if (m_model[i] == l_true) {
|
||||||
|
out << i << " ";
|
||||||
|
}
|
||||||
|
else if (m_model[i] == l_false) {
|
||||||
|
out << -i << " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void display_statistics(std::ostream & out) const {
|
||||||
|
m_sat->display_statistics(out);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
extern bool g_display_statistics;
|
||||||
|
extern front_end_params g_front_end_params;
|
||||||
|
|
||||||
|
void solve_cnf(const char * file) {
|
||||||
|
clock_t start_time = clock();
|
||||||
|
simple_sat_solver solver(g_front_end_params);
|
||||||
|
std::ifstream in(file);
|
||||||
|
parse_dimacs(in, solver);
|
||||||
|
lbool r = solver.check();
|
||||||
|
clock_t end_time = clock();
|
||||||
|
switch(r) {
|
||||||
|
case l_false:
|
||||||
|
std::cout << "unsat\n";
|
||||||
|
break;
|
||||||
|
case l_undef:
|
||||||
|
std::cout << "unknown\n";
|
||||||
|
break;
|
||||||
|
case l_true:
|
||||||
|
std::cout << "sat\n";
|
||||||
|
if (g_front_end_params.m_build_model) {
|
||||||
|
solver.display_model(std::cout);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (g_display_statistics) {
|
||||||
|
solver.display_statistics(std::cerr);
|
||||||
|
memory::display_max_usage(std::cerr);
|
||||||
|
std::cerr << "time: " << ((static_cast<double>(end_time) - static_cast<double>(start_time)) / CLOCKS_PER_SEC) << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
26
shell/simple_sat.h
Normal file
26
shell/simple_sat.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2006 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
simple_sat.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Simple SAT solver using the Z3 SAT template.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2006-10-10.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#ifndef _SIMPLE_SAT_H_
|
||||||
|
#define _SIMPLE_SAT_H_
|
||||||
|
|
||||||
|
void solve_cnf(const char * file);
|
||||||
|
|
||||||
|
#endif /* _SIMPLE_SAT_H_ */
|
||||||
|
|
138
shell/smtlib_frontend.cpp
Normal file
138
shell/smtlib_frontend.cpp
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2006 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
smtlib_frontend.cpp
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Frontend for reading Smtlib input files
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Nikolaj Bjorner (nbjorner) 2006-11-3.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
Leonardo de Moura: new SMT 2.0 front-end, removed support for .smtc files and smtcmd_solver object.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#include<iostream>
|
||||||
|
#include<time.h>
|
||||||
|
#include<signal.h>
|
||||||
|
#include"smtlib_solver.h"
|
||||||
|
#include"timeout.h"
|
||||||
|
#include"smt2parser.h"
|
||||||
|
#include"dl_cmds.h"
|
||||||
|
#include"dbg_cmds.h"
|
||||||
|
#include"polynomial_cmds.h"
|
||||||
|
#include"subpaving_cmds.h"
|
||||||
|
#include"smt_strategic_solver.h"
|
||||||
|
|
||||||
|
#include"tactic2solver.h"
|
||||||
|
#include"qfnra_nlsat_tactic.h"
|
||||||
|
|
||||||
|
extern bool g_display_statistics;
|
||||||
|
extern void display_config();
|
||||||
|
static clock_t g_start_time;
|
||||||
|
static smtlib::solver* g_solver = 0;
|
||||||
|
static cmd_context * g_cmd_context = 0;
|
||||||
|
|
||||||
|
static void display_statistics() {
|
||||||
|
display_config();
|
||||||
|
clock_t end_time = clock();
|
||||||
|
if ((g_solver || g_cmd_context) && g_display_statistics) {
|
||||||
|
std::cout.flush();
|
||||||
|
std::cerr.flush();
|
||||||
|
if (g_solver) {
|
||||||
|
g_solver->display_statistics();
|
||||||
|
memory::display_max_usage(std::cout);
|
||||||
|
std::cout << "time: " << ((static_cast<double>(end_time) - static_cast<double>(g_start_time)) / CLOCKS_PER_SEC) << " secs\n";
|
||||||
|
}
|
||||||
|
else if (g_cmd_context) {
|
||||||
|
g_cmd_context->set_regular_stream("stdout");
|
||||||
|
g_cmd_context->display_statistics(true, ((static_cast<double>(end_time) - static_cast<double>(g_start_time)) / CLOCKS_PER_SEC));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void on_timeout() {
|
||||||
|
display_statistics();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void on_ctrl_c(int) {
|
||||||
|
signal (SIGINT, SIG_DFL);
|
||||||
|
display_statistics();
|
||||||
|
raise(SIGINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned read_smtlib_file(char const * benchmark_file, front_end_params & front_end_params) {
|
||||||
|
g_start_time = clock();
|
||||||
|
register_on_timeout_proc(on_timeout);
|
||||||
|
signal(SIGINT, on_ctrl_c);
|
||||||
|
smtlib::solver solver(front_end_params);
|
||||||
|
g_solver = &solver;
|
||||||
|
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
ok = solver.solve_smt(benchmark_file);
|
||||||
|
if (!ok) {
|
||||||
|
if (benchmark_file) {
|
||||||
|
std::cerr << "ERROR: solving '" << benchmark_file << "'.\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cerr << "ERROR: solving input stream.\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
display_statistics();
|
||||||
|
register_on_timeout_proc(0);
|
||||||
|
g_solver = 0;
|
||||||
|
return solver.get_error_code();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned read_smtlib2_commands(char const* file_name, front_end_params& front_end_params) {
|
||||||
|
g_start_time = clock();
|
||||||
|
register_on_timeout_proc(on_timeout);
|
||||||
|
signal(SIGINT, on_ctrl_c);
|
||||||
|
cmd_context ctx(front_end_params);
|
||||||
|
|
||||||
|
// temporary hack until strategic_solver is ported to new tactic framework
|
||||||
|
if (front_end_params.m_nlsat) {
|
||||||
|
tactic2solver_cmd * s = alloc(tactic2solver_cmd);
|
||||||
|
s->set_tactic(alloc(qfnra_nlsat_fct));
|
||||||
|
ctx.set_solver(s);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
solver * s = mk_smt_strategic_solver(ctx);
|
||||||
|
ctx.set_solver(s);
|
||||||
|
}
|
||||||
|
install_dl_cmds(ctx);
|
||||||
|
install_dbg_cmds(ctx);
|
||||||
|
install_polynomial_cmds(ctx);
|
||||||
|
install_subpaving_cmds(ctx);
|
||||||
|
|
||||||
|
g_cmd_context = &ctx;
|
||||||
|
register_on_timeout_proc(on_timeout);
|
||||||
|
signal(SIGINT, on_ctrl_c);
|
||||||
|
|
||||||
|
bool result = true;
|
||||||
|
if (file_name) {
|
||||||
|
std::ifstream in(file_name);
|
||||||
|
if (in.bad() || in.fail()) {
|
||||||
|
std::cerr << "(error \"failed to open file '" << file_name << "'\")" << std::endl;
|
||||||
|
exit(ERR_OPEN_FILE);
|
||||||
|
}
|
||||||
|
result = parse_smt2_commands(ctx, in);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = parse_smt2_commands(ctx, std::cin, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
display_statistics();
|
||||||
|
g_cmd_context = 0;
|
||||||
|
return result ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
35
shell/smtlib_frontend.h
Normal file
35
shell/smtlib_frontend.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2006 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
smtlib_frontend.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Smtlib frontend.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Leonardo de Moura (leonardo) 2006-11-2.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _SMTLIB_FRONTEND_H_
|
||||||
|
#define _SMTLIB_FRONTEND_H_
|
||||||
|
|
||||||
|
#include"front_end_params.h"
|
||||||
|
|
||||||
|
unsigned read_smtlib_file(char const * benchmark_file, front_end_params & front_end_params);
|
||||||
|
|
||||||
|
unsigned read_smtlib_commands(char const* command_file, front_end_params& front_end_params);
|
||||||
|
unsigned read_smtlib2_commands(char const* command_file, front_end_params& front_end_params);
|
||||||
|
|
||||||
|
#ifdef _Z3_BUILD_PARALLEL_MPI
|
||||||
|
unsigned start_mpi_subordinate(front_end_params& front_end_params);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _SMTLIB_FRONTEND_H_ */
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue