Skip to content

Commit

Permalink
support qf-bvlra
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed-irfan committed Jun 2, 2024
1 parent f067614 commit adc8e22
Show file tree
Hide file tree
Showing 18 changed files with 1,173 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/api/context_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ static const int32_t logic2arch[NUM_SMT_LOGICS] = {
-1, // ANRA
-1, // ANIRA
-1, // AUF
-1, // BVLRA
-1, // UFBV
-1, // UFBVLIA
-1, // UFIDL
Expand Down Expand Up @@ -196,6 +197,7 @@ static const int32_t logic2arch[NUM_SMT_LOGICS] = {
CTX_ARCH_MCSAT, // QF_ANRA
CTX_ARCH_MCSAT, // QF_ANIRA
CTX_ARCH_EGFUN, // QF_AUF
CTX_ARCH_EGSPLXBV, // QF_BVLRA
CTX_ARCH_EGBV, // QF_UFBV
CTX_ARCH_EGSPLXBV, // QF_UFBVLIA

Expand Down Expand Up @@ -469,6 +471,10 @@ static int32_t arch_add_bv(int32_t a) {
a = CTX_ARCH_EGFUNBV;
break;

case CTX_ARCH_SPLX:
a = CTX_ARCH_EGSPLXBV;
break;

default:
a = -1;
break;
Expand All @@ -484,6 +490,10 @@ static int32_t arch_add_simplex(int32_t a) {
a = CTX_ARCH_SPLX;
break;

case CTX_ARCH_BV:
a = CTX_ARCH_EGSPLXBV;
break;

case CTX_ARCH_EG:
a = CTX_ARCH_EGSPLX;
break;
Expand Down
18 changes: 18 additions & 0 deletions src/api/smt_logic_codes.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ static const char * const smt_logic_names[NUM_SMT_LOGIC_NAMES] = {
"AUFNRA",
"AX",
"BV",
"BVLRA",
"IDL",
"LIA",
"LIRA",
Expand Down Expand Up @@ -80,6 +81,7 @@ static const char * const smt_logic_names[NUM_SMT_LOGIC_NAMES] = {
"QF_AUFNRA",
"QF_AX",
"QF_BV",
"QF_BVLRA",
"QF_IDL",
"QF_LIA",
"QF_LIRA",
Expand Down Expand Up @@ -140,6 +142,7 @@ static const smt_logic_t smt_code[NUM_SMT_LOGIC_NAMES] = {
AUFNRA,
AX,
BV,
BVLRA,
IDL,
LIA,
LIRA,
Expand Down Expand Up @@ -167,6 +170,7 @@ static const smt_logic_t smt_code[NUM_SMT_LOGIC_NAMES] = {
QF_AUFNRA,
QF_AX,
QF_BV,
QF_BVLRA,
QF_IDL,
QF_LIA,
QF_LIRA,
Expand Down Expand Up @@ -303,6 +307,7 @@ static const uint8_t has_arrays[NUM_SMT_LOGICS] = {
true, // ANRA
true, // ANIRA
true, // AUF
false, // BVLRA
false, // UFBV
false, // UFBVLIA
false, // UFIDL
Expand Down Expand Up @@ -342,6 +347,7 @@ static const uint8_t has_arrays[NUM_SMT_LOGICS] = {
true, // QF_ANRA
true, // QF_ANIRA
true, // QF_AUF
false, // QF_BVLRA
false, // QF_UFBV
false, // QF_UFBVLIA
false, // QF_UFIDL
Expand Down Expand Up @@ -387,6 +393,7 @@ static const uint8_t has_bv[NUM_SMT_LOGICS] = {
false, // ANRA
false, // ANIRA
false, // AUF
true, // BVLRA
true, // UFBV
true, // UFBVLIA
false, // UFIDL
Expand Down Expand Up @@ -426,6 +433,7 @@ static const uint8_t has_bv[NUM_SMT_LOGICS] = {
false, // QF_ANRA
false, // QF_ANIRA
false, // QF_AUF
true, // QF_BVLRA
true, // QF_UFBV
true, // QF_UFBVLIA
false, // QF_UFIDL
Expand Down Expand Up @@ -471,6 +479,7 @@ static const uint8_t has_quantifiers[NUM_SMT_LOGICS] = {
true, // ANRA
true, // ANIRA
true, // AUF
true, // BVLRA
true, // UFBV
true, // UFBVLIA
true, // UFIDL
Expand Down Expand Up @@ -510,6 +519,7 @@ static const uint8_t has_quantifiers[NUM_SMT_LOGICS] = {
false, // QF_ANRA
false, // QF_ANIRA
false, // QF_AUF
false, // QF_BVLRA
false, // QF_UFBV
false, // QF_UFBVLIA
false, // QF_UFIDL
Expand Down Expand Up @@ -555,6 +565,7 @@ static const uint8_t has_uf[NUM_SMT_LOGICS] = {
false, // ANRA
false, // ANIRA
true, // AUF
false, // BVLRA
true, // UFBV
true, // UFBVLIA
true, // UFIDL
Expand Down Expand Up @@ -594,6 +605,7 @@ static const uint8_t has_uf[NUM_SMT_LOGICS] = {
false, // QF_ANRA
false, // QF_ANIRA
true, // QF_AUF
false, // QF_BVLRA
true, // QF_UFBV
true, // QF_UFBVLIA
true, // QF_UFIDL
Expand Down Expand Up @@ -639,6 +651,7 @@ static const uint8_t arith_frag[NUM_SMT_LOGICS] = {
ARITH_NRA, // ANRA
ARITH_NIRA, // ANIRA
ARITH_NONE, // AUF
ARITH_LRA, // BVLRA
ARITH_NONE, // UFBV
ARITH_LIA, // UFBVLIA
ARITH_IDL, // UFIDL
Expand Down Expand Up @@ -678,6 +691,7 @@ static const uint8_t arith_frag[NUM_SMT_LOGICS] = {
ARITH_NRA, // QF_ANRA
ARITH_NIRA, // QF_ANIRA
ARITH_NONE, // QF_AUF
ARITH_LRA, // QF_BVLRA
ARITH_NONE, // QF_UFBV
ARITH_LIA, // QF_UFBVLIA
ARITH_IDL, // QF_UFIDL
Expand Down Expand Up @@ -764,6 +778,7 @@ static const smt_logic_t logic2qf[NUM_SMT_LOGICS] = {
QF_ANRA,
QF_ANIRA,
QF_AUF,
QF_BVLRA,
QF_UFBV,
QF_UFBVLIA,
QF_UFIDL,
Expand Down Expand Up @@ -806,6 +821,7 @@ static const smt_logic_t logic2qf[NUM_SMT_LOGICS] = {
QF_ANRA,
QF_ANIRA,
QF_AUF,
QF_BVLRA,
QF_UFBV,
QF_UFBVLIA,
QF_UFIDL,
Expand Down Expand Up @@ -864,6 +880,7 @@ static const bool is_official[NUM_SMT_LOGICS] = {
false, // ANRA
false, // ANIRA
false, // AUF
false, // BVLRA
true, // UFBV
true, // UFBVLIA
true, // UFIDL
Expand Down Expand Up @@ -903,6 +920,7 @@ static const bool is_official[NUM_SMT_LOGICS] = {
false, // QF_ANRA
false, // QF_ANIRA
false, // QF_AUF
false, // QF_BVLRA
true, // QF_UFBV
true, // QF_UFBVLIA
true, // QF_UFIDL
Expand Down
8 changes: 7 additions & 1 deletion src/api/smt_logic_codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ typedef enum smt_logic {
ANIRA, // arrays + mixed/non-linear arithmetic
AUF, // arrays + uninterpreted functions

// BV + another theory
BVLRA,

// Uninterpreted function + another theory
UFBV, // uninterpreted functions + bitvectors
UFBVLIA, // uninterpreted functions + bitvectors + linear integer arithmetic
Expand Down Expand Up @@ -135,6 +138,9 @@ typedef enum smt_logic {
QF_ANIRA, // arrays + mixed/non-linear arithmetic
QF_AUF, // arrays + uninterpreted functions

// BV + another theory
QF_BVLRA,

// Uninterpreted function + another theory
QF_UFBV, // uninterpreted functions + bitvectors
QF_UFBVLIA, // uninterpreted functions + bitvectors + linear integer arithmetic
Expand Down Expand Up @@ -163,7 +169,7 @@ typedef enum smt_logic {
* as in (set-logic ALL).
*
* We interpret this a QF_AUFLIRA + QF_BV unless MCSAT is
* enabled in which case it is QF_UFNIRA + QF_BV.
* enabled in which case it is QF_AUFNIRA + QF_BV.
*/
SMT_ALL,

Expand Down
7 changes: 7 additions & 0 deletions src/frontend/yices_smt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,13 @@ static int process_benchmark(char *filename) {
// arch = CTX_ARCH_EGBV;
break;

case QF_BVLRA:
/*
* bit-vector + linear real arithmetic
*/
arch = CTX_ARCH_EGSPLXBV;
break;

default:
/*
* Not supported or unknown logic
Expand Down
1 change: 1 addition & 0 deletions src/include/yices.h
Original file line number Diff line number Diff line change
Expand Up @@ -2839,6 +2839,7 @@ __YICES_DLLSPEC__ extern int32_t yices_set_config(ctx_config_t *config, const ch
* QF_ALIRA: arrays + mixed linear arithmetic
*
* QF_AUF: arrays + uninterpreted functions
* QF_BVLRA: bitvectors + linear real arithmetic
* QF_AUFBV: arrays, bitvectors, uninterpreted functions
* QF_AUFBVLIA: arrays, bitvectors, uninterpreted functions, and linear integer arithmetic
* QF_AUFBVNIA: arrays, bitvectors, uninterpreted functions, and nonlinear integer arithmetic
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
(set-info :smt-lib-version 2.6)
(set-logic QF_BVLRA)
(set-info :source |
Generated by: Tomas Kolarik
Generated on: 2024-04-14
Generator: gitlab.com/Tomaqa/mapf_r
Application: Multi-Agent Path-Finding with Continuous Time
Target solver: Z3, CVC4, MathSAT
Publications: Tomas Kolarik, Stefan Ratschan and Pavel Surynek: "Multi-Agent Path-Finding with Continuous Time Using SAT Modulo Linear Real Arithmetic" in ICAART, SCITEPRESS, 2024.
The benchmarks mimic MAPF problems with continuous time where the objective time must be sub-optimal, bounded by a user-specified coefficient. In the original solver, a simulator checks whether there are collisions between particular agents, according to the current model. This check is missing in the case of the final 'check-sat'. The benchmarks also lack commands for preferring certain variables during the search which is of huge importance when searching for short paths in a graph. However, the final plan must still avoid all collisions encountered by the original solver and the objective time must obey the sub-optimal coefficient. Producing models is crucial for the application since the intended solver communicates values of particular variables with the simulator. This communication is ommited though for simplicity. The final 'get-value' allows to compare with the original solver that the objective time indeed obeys the coefficient. Filenames without the extensions correspond to filenames of resulting plans of the original solver.
|)
(set-info :license "https://creativecommons.org/licenses/by/4.0/")
(set-info :category "industrial")
(declare-const objtime Real)
(declare-const oo Real)
(declare-const eps Real)
(declare-const A0.V<0> (_ BitVec 16))
(declare-const A0.atime<0> Real)
(assert (= A0.atime<0> 0))
(declare-const A0.rtime<0> Real)
(declare-const A0.wtime<0> Real)
(declare-const A0.mtime<0> Real)
(assert (= (+ A0.rtime<0> (+ (* (- 1) A0.wtime<0>) (* (- 1) A0.mtime<0>))) 0))
(assert (<= 0 A0.wtime<0>))
(assert (<= 0 A0.mtime<0>))
(declare-const wpref0 Bool)
(assert (or (= A0.wtime<0> 0) (not wpref0)))
(declare-const A0.ppref<0> Bool)
(declare-const A0.spref<0><1> Bool)
(declare-const A0.spref<0><2> Bool)
(declare-const A0.spref<0><3> Bool)
(declare-const A1.V<0> (_ BitVec 16))
(declare-const A1.atime<0> Real)
(assert (= A1.atime<0> 0))
(declare-const A1.rtime<0> Real)
(declare-const A1.wtime<0> Real)
(declare-const A1.mtime<0> Real)
(assert (= (+ A1.rtime<0> (+ (* (- 1) A1.wtime<0>) (* (- 1) A1.mtime<0>))) 0))
(assert (<= 0 A1.wtime<0>))
(assert (<= 0 A1.mtime<0>))
(declare-const wpref1 Bool)
(assert (or (= A1.wtime<0> 0) (not wpref1)))
(declare-const A1.ppref<0> Bool)
(declare-const A1.spref<0><1> Bool)
(declare-const A1.spref<0><2> Bool)
(declare-const A1.spref<0><3> Bool)
(assert (= A1.V<0> (_ bv3 16)))
(assert (= A0.V<0> (_ bv0 16)))
(assert (or (= A0.wtime<0> 0) (= A1.wtime<0> 0)))
(assert (or (= A0.V<0> (_ bv0 16)) (not A0.ppref<0>)))
(assert (or (= A1.V<0> (_ bv3 16)) (not A1.ppref<0>)))
(declare-const A0.V<1> (_ BitVec 16))
(declare-const A0.atime<1> Real)
(assert (= (+ A0.atime<0> (+ A0.rtime<0> (* (- 1) A0.atime<1>))) 0))
(declare-const A0.rtime<1> Real)
(declare-const A0.wtime<1> Real)
(declare-const A0.mtime<1> Real)
(assert (= (+ A0.rtime<1> (+ (* (- 1) A0.wtime<1>) (* (- 1) A0.mtime<1>))) 0))
(assert (<= 0 A0.wtime<1>))
(assert (<= 0 A0.mtime<1>))
(declare-const A0.ppref<1> Bool)
(declare-const A0.spref<1><1> Bool)
(declare-const A0.spref<1><2> Bool)
(declare-const A0.spref<1><3> Bool)
(declare-const A1.V<1> (_ BitVec 16))
(declare-const A1.atime<1> Real)
(assert (= (+ A1.atime<0> (+ A1.rtime<0> (* (- 1) A1.atime<1>))) 0))
(declare-const A1.rtime<1> Real)
(declare-const A1.wtime<1> Real)
(declare-const A1.mtime<1> Real)
(assert (= (+ A1.rtime<1> (+ (* (- 1) A1.wtime<1>) (* (- 1) A1.mtime<1>))) 0))
(assert (<= 0 A1.wtime<1>))
(assert (<= 0 A1.mtime<1>))
(declare-const A1.ppref<1> Bool)
(declare-const A1.spref<1><1> Bool)
(declare-const A1.spref<1><2> Bool)
(declare-const A1.spref<1><3> Bool)
(assert (or (= A0.V<1> (_ bv1 16)) (not A0.ppref<1>)))
(assert (or (= A0.mtime<0> 1) (not (and (= A0.V<0> (_ bv0 16)) (= A0.V<1> (_ bv1 16))))))
(assert (or (= A0.V<1> (_ bv1 16)) (not (= A0.V<0> (_ bv0 16)))))
(assert (or (= A0.V<1> (_ bv1 16)) (not (and A0.spref<0><1> (= A0.V<0> (_ bv0 16))))))
(assert (or (= A1.mtime<0> 1) (not (and (= A1.V<0> (_ bv3 16)) (= A1.V<1> (_ bv1 16))))))
(assert (or (and (= A1.wtime<0> 0) (= A1.mtime<0> 0)) (not (and (= A1.V<0> (_ bv3 16)) (= A1.V<1> (_ bv3 16))))))
(assert (or (or (= A1.V<1> (_ bv1 16)) (= A1.V<1> (_ bv3 16))) (not (= A1.V<0> (_ bv3 16)))))
(declare-const A0.V<2> (_ BitVec 16))
(declare-const A0.atime<2> Real)
(assert (= (+ A0.atime<1> (+ A0.rtime<1> (* (- 1) A0.atime<2>))) 0))
(declare-const A0.rtime<2> Real)
(declare-const A0.wtime<2> Real)
(declare-const A0.mtime<2> Real)
(assert (= (+ A0.rtime<2> (+ (* (- 1) A0.wtime<2>) (* (- 1) A0.mtime<2>))) 0))
(assert (<= 0 A0.wtime<2>))
(assert (<= 0 A0.mtime<2>))
(declare-const A0.ppref<2> Bool)
(declare-const A0.spref<2><1> Bool)
(declare-const A0.spref<2><2> Bool)
(declare-const A0.spref<2><3> Bool)
(declare-const A1.V<2> (_ BitVec 16))
(declare-const A1.atime<2> Real)
(assert (= (+ A1.atime<1> (+ A1.rtime<1> (* (- 1) A1.atime<2>))) 0))
(declare-const A1.rtime<2> Real)
(declare-const A1.wtime<2> Real)
(declare-const A1.mtime<2> Real)
(assert (= (+ A1.rtime<2> (+ (* (- 1) A1.wtime<2>) (* (- 1) A1.mtime<2>))) 0))
(assert (<= 0 A1.wtime<2>))
(assert (<= 0 A1.mtime<2>))
(declare-const A1.ppref<2> Bool)
(declare-const A1.spref<2><1> Bool)
(declare-const A1.spref<2><2> Bool)
(declare-const A1.spref<2><3> Bool)
(assert (or (= A0.V<2> (_ bv2 16)) (not A0.ppref<2>)))
(assert (or (= A0.mtime<1> 1) (not (and (= A0.V<1> (_ bv1 16)) (= A0.V<2> (_ bv3 16))))))
(assert (or (= A0.mtime<1> 1) (not (and (= A0.V<1> (_ bv1 16)) (= A0.V<2> (_ bv2 16))))))
(assert (or (= A0.mtime<1> 1) (not (and (= A0.V<1> (_ bv1 16)) (= A0.V<2> (_ bv0 16))))))
(assert (or (or (= A0.V<2> (_ bv0 16)) (or (= A0.V<2> (_ bv2 16)) (= A0.V<2> (_ bv3 16)))) (not (= A0.V<1> (_ bv1 16)))))
(assert (or (= A0.V<2> (_ bv2 16)) (not (and A0.spref<1><1> (= A0.V<1> (_ bv1 16))))))
(assert (or (= A0.V<2> (_ bv3 16)) (not (and A0.spref<1><2> (= A0.V<1> (_ bv1 16))))))
(assert (or (= A0.mtime<1> 1) (not (and (= A0.V<1> (_ bv0 16)) (= A0.V<2> (_ bv1 16))))))
(assert (or (= A0.V<2> (_ bv1 16)) (not (= A0.V<1> (_ bv0 16)))))
(assert (or (= A0.V<2> (_ bv1 16)) (not (and A0.spref<1><1> (= A0.V<1> (_ bv0 16))))))
(assert (or (= A1.mtime<1> 1) (not (and (= A1.V<1> (_ bv1 16)) (= A1.V<2> (_ bv3 16))))))
(assert (or (= A1.mtime<1> 1) (not (and (= A1.V<1> (_ bv1 16)) (= A1.V<2> (_ bv2 16))))))
(assert (or (= A1.mtime<1> 1) (not (and (= A1.V<1> (_ bv1 16)) (= A1.V<2> (_ bv0 16))))))
(assert (or (or (= A1.V<2> (_ bv0 16)) (or (= A1.V<2> (_ bv3 16)) (= A1.V<2> (_ bv2 16)))) (not (= A1.V<1> (_ bv1 16)))))
(assert (or (= A1.V<2> (_ bv3 16)) (not (and A1.spref<1><1> (= A1.V<1> (_ bv1 16))))))
(assert (or (= A1.V<2> (_ bv2 16)) (not (and A1.spref<1><2> (= A1.V<1> (_ bv1 16))))))
(assert (or (= A1.mtime<1> 1) (not (and (= A1.V<1> (_ bv3 16)) (= A1.V<2> (_ bv1 16))))))
(assert (or (and (= A1.mtime<1> 0) (= A1.wtime<1> 0)) (not (and (= A1.V<1> (_ bv3 16)) (= A1.V<2> (_ bv3 16))))))
(assert (or (not (and (= A1.V<0> (_ bv3 16)) (= A1.V<1> (_ bv3 16)))) (= A1.V<2> (_ bv3 16))))
(assert (or (or (= A1.V<2> (_ bv3 16)) (= A1.V<2> (_ bv1 16))) (not (= A1.V<1> (_ bv3 16)))))
(declare-const kass2 Bool)
(assert (or (= objtime A1.wtime<2>) (not kass2)))
(assert (or (not kass2) (= A1.mtime<2> 0)))
(assert (or (not kass2) (= objtime A0.wtime<2>)))
(assert (or (not kass2) (= A0.mtime<2> 0)))
(push 1)
(assert kass2)
(assert (= A1.V<2> (_ bv3 16)))
(assert (= A0.V<2> (_ bv2 16)))
(assert (let ((def_266 (ite (<= A1.atime<2> 0) 0 A1.atime<2>))) (= objtime (ite (<= A0.atime<2> def_266) def_266 A0.atime<2>))))
(set-info :status sat)
(check-sat)
(assert (<= 2 objtime))
(assert (<= objtime (/ 9 4)))
(set-info :status sat)
(check-sat)
(exit)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sat
sat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--incremental
Loading

0 comments on commit adc8e22

Please sign in to comment.