Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finite Field support #513

Merged
merged 162 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 151 commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
8c41f5f
Symbols created, eval_ff_* to be done
Nov 20, 2023
d8aab36
Added ff_plugin stub
Nov 20, 2023
383e87d
Registered ff plugin to mcsat
Nov 20, 2023
d8eea38
Added further type support for FF type
Nov 21, 2023
b257789
Added printing support for the ff type
Nov 21, 2023
c1cb009
fixed warning
Nov 21, 2023
aed17f3
actual missing error strings
Nov 22, 2023
17b8ef6
Parsing of (as (_ ff3 13) FF0) done
Nov 23, 2023
aecf376
reformat indentions
Nov 28, 2023
3a4932d
reformat indentions
Nov 29, 2023
283aa8b
Front-end parsing done
Nov 29, 2023
2035c47
mod_rba_buffer_t and TAG_ARITH_FF_BUFFER
Nov 30, 2023
a10d403
Code Formatting
Dec 1, 2023
7a4ef2d
Finite Field term generation done
Dec 2, 2023
cf60337
Fixed print_elem in term_stack2.c
Dec 4, 2023
65a9c3a
Code Formatting
Dec 4, 2023
211d1f1
Removed unnecessary todos
Dec 4, 2023
9a03d90
Support arbitrary finite field size
Dec 4, 2023
36e83f9
Some optimization for ff eq term generation
Dec 5, 2023
ba8887f
Code Formatting and Warning fixes
Dec 5, 2023
ae3399b
Added exceptions when ff is solved with non-mcsat context.
Dec 5, 2023
46d8907
fixed model_eval to handle finite field terms (and return unknown).
Dec 5, 2023
b4387c8
Term manager update (added further ff code to term_manager)
Dec 5, 2023
085b9be
Added FF support to MCSAT preprocessor
Dec 5, 2023
816b525
Added FF support to model printing
Dec 5, 2023
e849bd2
fix
Dec 7, 2023
92f8e37
Fixed printing and added value_ff_t.
Dec 7, 2023
088783e
WIP: ff_plugin_new_term_notify
Dec 8, 2023
35afa14
Code Formatting fixes
Dec 8, 2023
c93e4bd
extracted lp_data handling from NRA plugin
Dec 11, 2023
16cc9b1
moved trail_variable_compare to trail and added lp_data in ff_plugin
Dec 11, 2023
ecb37b0
extracted poly_constraint from nra to lp_constraint_db
Dec 12, 2023
92d6d54
fixed bug in non mcsat part
Dec 12, 2023
b66a2ec
using lp_data in explanation
Dec 13, 2023
aaaf162
store term_t in lp_data instead of variable_t
Dec 13, 2023
e63c2cc
Consolidated libpoly_utils.c
Dec 13, 2023
348fefc
update nra_plugin_explain to support lp_data
Dec 14, 2023
f9636cc
fixed context_config bug
Dec 15, 2023
a4d8fab
added mcsat only checks to makefile
Dec 15, 2023
1cc4a46
rework done: extracted lib_poly code from nra.
Dec 15, 2023
35d4b90
rework done: extracted unit_info from nra and bv
Dec 15, 2023
e263fc0
implementation of term_notify in ff done
Dec 15, 2023
984c2a1
fixed Makefile whitespaces
Dec 15, 2023
f4634de
ff_poly_constraint_create implemented and minor improvements in the n…
Dec 15, 2023
ca54e9b
Build system update to use static libpoly for all builds when configured
Dec 19, 2023
2652dfd
fixed term printing issue
Dec 19, 2023
b56a9e5
make lp_data_t finite field order aware
Jan 17, 2024
de85b45
throw exception on multiple ff orders
Jan 17, 2024
da27533
extracted constraint_unit_info_demote
Jan 17, 2024
5884c47
Fixed typos
Jan 17, 2024
3834ef3
minor code rework to enable the compiler to remove nra_plugin_check_a…
Jan 17, 2024
2822709
implemented pop/push and parts of propagate
Jan 18, 2024
b0a7bc5
Typos and minor code fixes
Jan 18, 2024
79ad351
Added feasible_int_set_db files
Jan 18, 2024
3a66453
value_version_set done
Jan 22, 2024
6989c20
Renamed to ff_feasible_set_db
Jan 22, 2024
8c94793
Attach/Detach lp_int_ring_t in ff_feasible_set
Jan 22, 2024
482a4b3
added ff_feasible_set_db to ff_plugin
Jan 22, 2024
3d100ea
Typos and minor code fixes
Jan 23, 2024
54d2e9b
ffsat propagation done
Jan 23, 2024
9aa2cea
fixed two assertions
Jan 23, 2024
fd2eceb
value_hash_map made first and next record operate on const value.
Jan 23, 2024
9cdb119
value_version_set fixed bugs
Jan 23, 2024
2fc4168
Implemented ff_plugin_decide and some minor fixes
Jan 23, 2024
927bed7
Added calls to ff_feasible_set_db_pop/_push
Jan 23, 2024
4bcac43
Using new libpoly features
Jan 24, 2024
a92ce4f
Fixed zero finding and some printing issues
Jan 24, 2024
67e1eaa
Typos and minor code fixes
Jan 24, 2024
4e00cbe
Implemented ff_plugin_explain_propagation and ff_plugin_explain_evalu…
Jan 24, 2024
dc24552
Created functions for ff explain
Jan 25, 2024
3009617
Typos and minor code fixes
Jan 25, 2024
34c2b41
Prepared to plug explanation in
Jan 25, 2024
34348b5
Added explanation procedure
Jan 25, 2024
064d291
Update ff_plugin_explain.c to avoid polynomial copying.
Jan 26, 2024
4b6f177
Added plugin_ctx to lp_data
Jan 26, 2024
e930613
fixed trace printing in ff_plugin_explain
Jan 26, 2024
a69a38b
Fixed some stuff
Jan 26, 2024
dce78c0
Fixed bugs in testing
Jan 28, 2024
cec9f44
Moved some code, addes some asserts
Jan 30, 2024
882f3d0
Some optimizations
Jan 30, 2024
6852cfe
fixup
Jan 30, 2024
62565b6
fixed some bugs
Jan 31, 2024
be48c3a
added last_reason_unsat conflict core minimization
Jan 31, 2024
02ead6c
added gc sweep in lp_data.c
Feb 1, 2024
aea2a94
added irreducible factor calculation to ff_plugin_explain.c
Feb 1, 2024
3ea2a09
added common factor removal
Feb 2, 2024
9e90c2a
added :dump-model option
Feb 4, 2024
bf2a43b
fixed ff model printing
Feb 4, 2024
d0afd14
Typos and minor code fixes
Feb 4, 2024
0629069
allowed ff-1
Feb 4, 2024
a4f01ee
Merge branch 'master' into ffsat
Feb 4, 2024
12ada59
added todos/comments/ideas
Feb 7, 2024
668193b
Fixed warnings in release build
Feb 7, 2024
d6f94b4
added libpoly root finding
Feb 9, 2024
4371fe1
fixed duplicated function
Feb 10, 2024
8f5688e
fixed missing case in mcsat solver.c
Feb 10, 2024
b3b1d3e
code format
Feb 10, 2024
db5dfe8
Fixed todos in explain
Feb 10, 2024
e76b7f3
added debugging code
Feb 11, 2024
d54e6cf
report out of memory if rb and lp don't agree
Feb 11, 2024
48682f3
Update Readme with special build steps
Feb 11, 2024
e4f1f1a
Update readme
Feb 11, 2024
1e57cad
Update readme
Feb 11, 2024
af688f9
Fixed compile warnings
Feb 12, 2024
18fa128
Fixed compile warnings in release build.
Feb 13, 2024
93d223d
Fixed typos
Feb 13, 2024
b9ee6e1
rename int_queue_t size with capacity
Feb 14, 2024
472deca
enhanced int_queue
Feb 14, 2024
ef12e80
added queue for next decision
Feb 14, 2024
d786129
Clear hint queue on conflict
Feb 16, 2024
5de62d2
Added two queues (top and hint)
Feb 17, 2024
83bfa01
fixed bug
Feb 17, 2024
6262396
added solver hints in NRA
Feb 17, 2024
36df734
model_interpolation questions
Feb 19, 2024
8c32738
model_interpolation does not perform request_top_decision
Feb 22, 2024
da32bd4
Remove shortcut variables from the queue
Feb 22, 2024
aec6c21
regression prints execution time
Feb 22, 2024
c0b0036
nra_plugin.c hint only on real solution
Feb 22, 2024
c429759
variable selection forces decision on hint
Feb 22, 2024
7fcca51
fix random decision
Feb 22, 2024
20deb56
trace printing
Feb 23, 2024
f4f6e58
changed the gold of a model interpolant
Feb 23, 2024
fdced2c
added option for test issue204.smt2
Feb 26, 2024
81d1697
Merge branch 'decision-hint-queue' into ffsat-prop
Feb 28, 2024
8e4e98b
Added ff regression tests
Feb 29, 2024
ace68f5
Added hint queue in ff
Feb 29, 2024
ce43ad3
Added fintie field cases in substitution.c
Feb 29, 2024
bfb7c4b
Added const to rational functions
Mar 1, 2024
f10ecd9
Made ff order (rational_t *mod) const
Mar 1, 2024
dbd7e5f
Some code rework and fixed missing mod calculation in arith_ff_buffer…
Mar 2, 2024
87eb50d
renamed srs to lp_polynomial_subres in libpoly
Mar 8, 2024
f4506d2
Merge branch 'master' into ffsat
Mar 8, 2024
e67c3bb
removed changes to build system (align with master)
Mar 8, 2024
9ac1cb9
minor reworks in feasible_set_db and nra_plugin
Mar 9, 2024
a197571
Integrated lp_feasibility_set_int in ff_plugin
Mar 9, 2024
1c031dc
Added quickxplain to ff_feasible_set_db
Mar 11, 2024
50b7543
Added pointer to nra_plugin in feasible_set_db
Mar 11, 2024
dfd99e1
Merge branch 'master' into ffsat
May 23, 2024
9e52562
Changed the finite field logic from FF to FFA
May 23, 2024
967f979
Code Formatting fixes
May 24, 2024
ee37100
Minor code cleanup
May 24, 2024
d644070
Added comment
May 24, 2024
bf39b5d
Reverted README.md
May 24, 2024
fc2bcc0
Merge branch 'ffsat-prop' into ffsat
May 24, 2024
7f54071
Removed broken runtime estimate from check.sh
May 24, 2024
d87ddf6
added more const
May 24, 2024
da66d3d
Fixed false-positive warning in gcc
May 24, 2024
83baf76
Merge branch 'ccm' into ffsat
May 29, 2024
76e0a5d
Removed non-passing test
May 29, 2024
853ba28
Merge branch 'master' into ffsat
Jun 20, 2024
97b6c2e
Removed additional check code, since issue 520 is fixed
Jun 20, 2024
bf87888
Fixed typos
Jun 25, 2024
ab931a6
Added missing FFA in arith framgemt_names
Jun 25, 2024
c22826a
Merge branch 'master' into ffsat
Ovascos Jun 25, 2024
a9cbc58
run_test.sh: removed tailing } in filenames
Jun 25, 2024
6878c3d
Adaptions to feedback, part 1
Jun 26, 2024
5f680ad
Minor rework
Jun 28, 2024
cb7ba67
Adaptions to feedback, part 2
Jul 1, 2024
79e60b6
Removed unused value_version_set
Jul 1, 2024
a362b79
Updated FFA error printing
Jul 2, 2024
df03f4f
Update comments
Jul 2, 2024
c7ddc21
fixed test gold file
Jul 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.build
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ srcsubdirs = mt io terms utils solvers solvers/floyd_warshall \
solvers/funs solvers/bv solvers/egraph solvers/cdcl solvers/simplex solvers/quant \
parser_utils model api frontend frontend/common \
frontend/smt1 frontend/yices frontend/smt2 context exists_forall \
mcsat mcsat/eq mcsat/weq mcsat/uf mcsat/bool mcsat/ite mcsat/nra mcsat/bv \
mcsat mcsat/eq mcsat/weq mcsat/uf mcsat/bool mcsat/ite mcsat/nra mcsat/ff mcsat/bv \
mcsat/bv/explain mcsat/utils

testdir = tests/unit
Expand Down
13 changes: 11 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,19 @@ mcsat_src_c := \
mcsat/model.c \
mcsat/trail.c \
mcsat/conflict.c \
mcsat/unit_info.c \
mcsat/gc.c \
mcsat/eq/equality_graph.c \
mcsat/eq/merge_queue.c \
mcsat/weq/weak_eq_graph.c \
mcsat/utils/int_mset.c \
mcsat/utils/int_lset.c \
mcsat/utils/lp_data.c \
mcsat/utils/lp_utils.c \
mcsat/utils/lp_constraint_db.c \
mcsat/utils/value_hash_map.c \
mcsat/utils/value_vector.c \
mcsat/utils/value_version_set.c \
mcsat/utils/scope_holder.c \
mcsat/utils/statistics.c \
mcsat/utils/substitution.c \
Expand All @@ -368,9 +373,13 @@ mcsat_src_c := \
mcsat/nra/nra_plugin.c \
mcsat/nra/nra_plugin_internal.c \
mcsat/nra/nra_plugin_explain.c \
mcsat/nra/libpoly_utils.c \
mcsat/nra/poly_constraint.c \
mcsat/nra/nra_libpoly.c \
mcsat/nra/feasible_set_db.c \
mcsat/ff/ff_plugin.c \
mcsat/ff/ff_plugin_internal.c \
mcsat/ff/ff_plugin_explain.c \
mcsat/ff/ff_libpoly.c \
mcsat/ff/ff_feasible_set_db.c \
mcsat/ite/ite_plugin.c \
mcsat/bv/bv_plugin.c \
mcsat/bv/bv_bdd_manager.c \
Expand Down
3 changes: 3 additions & 0 deletions src/api/context_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ static const int32_t logic2arch[NUM_SMT_LOGICS] = {

-1, // AX
-1, // BV (supported by EF)
-1, // FFA
-1, // IDL (supported by EF)
-1, // LIA (supported by EF)
-1, // LRA (supported by EF)
Expand Down Expand Up @@ -179,6 +180,7 @@ static const int32_t logic2arch[NUM_SMT_LOGICS] = {

CTX_ARCH_EGFUN, // QF_AX
CTX_ARCH_BV, // QF_BV
CTX_ARCH_MCSAT, // QF_FFA
CTX_ARCH_SPLX, // QF_IDL
CTX_ARCH_SPLX, // QF_LIA
CTX_ARCH_SPLX, // QF_LRA
Expand Down Expand Up @@ -234,6 +236,7 @@ static const bool fragment2iflag[NUM_ARITH_FRAGMENTS+1] = {
true, // NIA
false, // NRA
true, // NIRA
false, // NFFA
Ovascos marked this conversation as resolved.
Show resolved Hide resolved
false, // no arithmetic
};

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",
"FFA",
"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_FFA",
"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,
FFA,
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_FFA,
QF_IDL,
QF_LIA,
QF_LIRA,
Expand Down Expand Up @@ -286,6 +290,7 @@ static const uint8_t has_arrays[NUM_SMT_LOGICS] = {

true, // AX
false, // BV
false, // FFA
false, // IDL
false, // LIA
false, // LRA
Expand Down Expand Up @@ -325,6 +330,7 @@ static const uint8_t has_arrays[NUM_SMT_LOGICS] = {

true, // QF_AX
false, // QF_BV
false, // QF_FFA
false, // QF_IDL
false, // QF_LIA
false, // QF_LRA
Expand Down Expand Up @@ -370,6 +376,7 @@ static const uint8_t has_bv[NUM_SMT_LOGICS] = {

false, // AX
true, // BV
false, // FFA
false, // IDL
false, // LIA
false, // LRA
Expand Down Expand Up @@ -409,6 +416,7 @@ static const uint8_t has_bv[NUM_SMT_LOGICS] = {

false, // QF_AX
true, // QF_BV
false, // QF_FFA
false, // QF_IDL
false, // QF_LIA
false, // QF_LRA
Expand Down Expand Up @@ -454,6 +462,7 @@ static const uint8_t has_quantifiers[NUM_SMT_LOGICS] = {

true, // AX
true, // BV
true, // FFA
true, // IDL
true, // LIA
true, // LRA
Expand Down Expand Up @@ -493,6 +502,7 @@ static const uint8_t has_quantifiers[NUM_SMT_LOGICS] = {

false, // QF_AX
false, // QF_BV
false, // QF_FFA
false, // QF_IDL
false, // QF_LIA
false, // QF_LRA
Expand Down Expand Up @@ -538,6 +548,7 @@ static const uint8_t has_uf[NUM_SMT_LOGICS] = {

false, // AX
false, // BV
false, // FFA
false, // IDL
false, // LIA
false, // LRA
Expand Down Expand Up @@ -577,6 +588,7 @@ static const uint8_t has_uf[NUM_SMT_LOGICS] = {

false, // QF_AX
false, // QF_BV
false, // QF_FFA
false, // QF_IDL
false, // QF_LIA
false, // QF_LRA
Expand Down Expand Up @@ -622,6 +634,7 @@ static const uint8_t arith_frag[NUM_SMT_LOGICS] = {

ARITH_NONE, // AX
ARITH_NONE, // BV
ARITH_FFA, // FFA
ARITH_IDL, // IDL
ARITH_LIA, // LIA
ARITH_LRA, // LRA
Expand Down Expand Up @@ -661,6 +674,7 @@ static const uint8_t arith_frag[NUM_SMT_LOGICS] = {

ARITH_NONE, // QF_AX
ARITH_NONE, // QF_BV
ARITH_FFA, // QF_FFA
ARITH_IDL, // QF_IDL
ARITH_LIA, // QF_LIA
ARITH_LRA, // QF_LRA
Expand Down Expand Up @@ -747,6 +761,7 @@ static const smt_logic_t logic2qf[NUM_SMT_LOGICS] = {
*/
QF_AX,
QF_BV,
QF_FFA,
QF_IDL,
QF_LIA,
QF_LRA,
Expand Down Expand Up @@ -789,6 +804,7 @@ static const smt_logic_t logic2qf[NUM_SMT_LOGICS] = {
*/
QF_AX,
QF_BV,
QF_FFA,
QF_IDL,
QF_LIA,
QF_LRA,
Expand Down Expand Up @@ -847,6 +863,7 @@ static const bool is_official[NUM_SMT_LOGICS] = {

false, // AX
true, // BV
false, // FFA
false, // IDL
true, // LIA
true, // LRA
Expand Down Expand Up @@ -886,6 +903,7 @@ static const bool is_official[NUM_SMT_LOGICS] = {

true, // QF_AX
true, // QF_BV
false, // QF_FFA
true, // QF_IDL
true, // QF_LIA
true, // QF_LRA
Expand Down
3 changes: 3 additions & 0 deletions src/api/smt_logic_codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ typedef enum smt_logic {
*/
AX, // arrays
BV, // bitvectors
FFA, // finite fields
IDL, // integer difference logic
LIA, // linear integer arithmetic
LRA, // linear real arithmetic
Expand Down Expand Up @@ -115,6 +116,7 @@ typedef enum smt_logic {
*/
QF_AX, // arrays
QF_BV, // bitvectors
QF_FFA, // finite fields
QF_IDL, // integer difference logic
QF_LIA, // linear integer arithmetic
QF_LRA, // linear real arithmetic
Expand Down Expand Up @@ -189,6 +191,7 @@ typedef enum arith_fragment {
ARITH_NIA, // non-linear integer arithmetic
ARITH_NRA, // non-linear real arithmetic
ARITH_NIRA, // non-linear mixed arithmetic
ARITH_FFA, // finite field arithmetic
ARITH_NONE, // no arithmetic
} arith_fragment_t;

Expand Down
80 changes: 79 additions & 1 deletion src/api/yices_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,17 @@ static inline void type_vector_push(type_vector_t *v, type_t tau) {
* Otherwise they return false and set the error code and diagnostic data.
*/

// Check whether n (as mpz) is positive
static bool check_positive_mpz(mpz_t n) {
if (mpz_sgn(n) != 1) {
error_report_t *error = get_yices_error();
error->code = POS_INT_REQUIRED;
error->badval = mpz_fits_slong_p(n) ? mpz_get_si(n) : -1;
return false;
}
return true;
}

// Check whether n is positive
static bool check_positive(uint32_t n) {
if (n == 0) {
Expand Down Expand Up @@ -1912,6 +1923,21 @@ static bool check_integer_term(term_manager_t *mngr, term_t t) {
}
#endif

// Check whether t is a finitefield term, t must be valid.
static bool check_arith_ff_term(term_manager_t *mngr, term_t t) {
term_table_t *tbl;

tbl = term_manager_get_terms(mngr);

if (! is_finitefield_term(tbl, t)) {
error_report_t *error = get_yices_error();
error->code = ARITHTERM_REQUIRED;
error->term1 = t;
return false;
}
return true;
}

// Check whether t is a real term, t must be valid.
static bool check_real_term(term_manager_t *mngr, term_t t) {
term_table_t *tbl;
Expand Down Expand Up @@ -2740,6 +2766,7 @@ static bool check_elim_vars(term_manager_t *mngr, uint32_t n, const term_t *var)
case BOOL_TYPE:
case INT_TYPE:
case REAL_TYPE:
case FF_TYPE:
case BITVECTOR_TYPE:
case SCALAR_TYPE:
break;
Expand Down Expand Up @@ -2840,6 +2867,16 @@ type_t _o_yices_bv_type(uint32_t size) {
return bv_type(__yices_globals.types, size);
}

type_t _o_yices_ff_type(mpz_t order) {
if (! check_positive_mpz(order)) {
return NULL_TYPE;
}
if (! mpz_probab_prime_p(order, 18)) {
return NULL_TYPE;
}
return ff_type(__yices_globals.types, order);
}

EXPORTED type_t yices_new_uninterpreted_type(void) {
MT_PROTECT(type_t, __yices_globals.lock, _o_yices_new_uninterpreted_type());
}
Expand Down Expand Up @@ -7192,6 +7229,19 @@ int32_t _o_yices_rational_const_value(term_t t, mpq_t q) {
return 0;
}

EXPORTED int32_t yices_finitefield_const_value(term_t t, mpz_t z) {
MT_PROTECT(int32_t, __yices_globals.lock, _o_yices_finitefield_const_value(t, z));
}

int32_t _o_yices_finitefield_const_value(term_t t, mpz_t z) {
if (! check_good_term(__yices_globals.manager, t) ||
! check_constructor(__yices_globals.terms, t, YICES_ARITH_FF_CONSTANT)) {
return -1;
}
arith_ff_const_value(__yices_globals.terms, t, z);
return 0;
}


/*
* Components of a sum t
Expand All @@ -7207,6 +7257,7 @@ EXPORTED int32_t yices_sum_component(term_t t, int32_t i, mpq_t coeff, term_t *t
int32_t _o_yices_sum_component(term_t t, int32_t i, mpq_t coeff, term_t *term) {
if (! check_good_term(__yices_globals.manager, t) ||
! check_constructor(__yices_globals.terms, t, YICES_ARITH_SUM) ||
! check_constructor(__yices_globals.terms, t, YICES_ARITH_FF_SUM) ||
! check_child_idx(__yices_globals.terms, t, i)) {
return -1;
}
Expand Down Expand Up @@ -7283,6 +7334,14 @@ term_t arith_buffer_get_lt0_atom(rba_buffer_t *b) {
return mk_arith_lt0(__yices_globals.manager, b);
}

term_t arith_ff_buffer_get_term(rba_buffer_t *b, rational_t *mod) {
return mk_arith_ff_term(__yices_globals.manager, b, mod);
}

term_t arith_ff_buffer_get_eq0_atom(rba_buffer_t *b, rational_t *mod) {
return mk_arith_ff_eq0(__yices_globals.manager, b, mod);
}

term_t bvlogic_buffer_get_term(bvlogic_buffer_t *b) {
return mk_bvlogic_term(__yices_globals.manager, b);
}
Expand All @@ -7309,6 +7368,10 @@ term_t yices_bvconst64_term(uint32_t n, uint64_t c) {
return bv64_constant(__yices_globals.terms, n, c);
}

term_t yices_ffconst_term(rational_t *q, rational_t *mod) {
return arith_ff_constant(__yices_globals.terms, q, mod);
}

term_t yices_rational_term(rational_t *q) {
return arith_constant(__yices_globals.terms, q);
}
Expand Down Expand Up @@ -7351,6 +7414,21 @@ bool yices_check_arith_term(term_t t) {
return check_good_term(__yices_globals.manager, t) && check_arith_term(__yices_globals.manager, t);
}

/*
* Check whether t is a valid finite field arithmetic term
* - if not set the internal error report:
*
* If t is not a valid term:
* code = INVALID_TERM
* term1 = t
* index = -1
* If t is not an arithmetic term;
* code = ARITHTERM_REQUIRED
* term1 = t
*/
bool yices_check_arith_ff_term(term_t t) {
return check_good_term(__yices_globals.manager, t) && check_arith_ff_term(__yices_globals.manager, t);
}

/*
* Check for degree overflow in the product (b * t)
Expand All @@ -7369,7 +7447,7 @@ bool yices_check_mul_term(rba_buffer_t *b, term_t t) {

tbl = __yices_globals.terms;

assert(good_term(tbl, t) && is_arithmetic_term(tbl, t));
assert(good_term(tbl, t) && (is_arithmetic_term(tbl, t) || is_finitefield_term(tbl, t)));

d1 = rba_buffer_degree(b);
d2 = term_degree(tbl, t);
Expand Down
Loading