3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

Merge branch 'master' into polysat

This commit is contained in:
Jakob Rath 2023-05-26 15:58:09 +02:00
commit f54f33551e
308 changed files with 6606 additions and 18485 deletions

View file

@ -29,6 +29,7 @@ add_executable(test-z3
datalog_parser.cpp
ddnf.cpp
diff_logic.cpp
distribution.cpp
dl_context.cpp
dl_product_relation.cpp
dl_query.cpp

View file

@ -88,7 +88,7 @@ void test_bvneg() {
static bool cb_called = false;
static void my_cb(Z3_context, Z3_error_code) {
cb_called = true;
cb_called = true;
}
static void test_mk_distinct() {
@ -101,6 +101,7 @@ static void test_mk_distinct() {
Z3_ast args[] = { Z3_mk_int64(ctx, 0, bv8), Z3_mk_int64(ctx, 0, bv32) };
Z3_ast d = Z3_mk_distinct(ctx, 2, args);
ENSURE(cb_called);
VERIFY(!d);
Z3_del_config(cfg);
Z3_del_context(ctx);

View file

@ -28,13 +28,9 @@ void mk_bits(ast_manager & m, char const * prefix, unsigned sz, expr_ref_vector
sort_ref b(m);
b = m.mk_bool_sort();
for (unsigned i = 0; i < sz; ++i) {
char buffer[128];
#ifdef _WINDOWS
sprintf_s(buffer, Z3_ARRAYSIZE(buffer), "%s%d.smt", prefix, i);
#else
sprintf(buffer, "%s%d.smt", prefix, i);
#endif
r.push_back(m.mk_const(symbol(buffer), b));
std::stringstream ous;
ous << prefix << i << ".smt2";
r.push_back(m.mk_const(symbol(ous.str()), b));
}
}

45
src/test/distribution.cpp Normal file
View file

@ -0,0 +1,45 @@
/*++
Copyright (c) 2023 Microsoft Corporation
Module Name:
distribution.cpp
Abstract:
Test distribution
Author:
Nikolaj Bjorner (nbjorner) 2023-04-13
--*/
#include "util/distribution.h"
#include <iostream>
static void tst1() {
distribution dist(1);
dist.push(1, 3);
dist.push(2, 1);
dist.push(3, 1);
dist.push(4, 1);
unsigned counts[4] = { 0, 0, 0, 0 };
for (unsigned i = 0; i < 1000; ++i)
counts[dist.choose()-1]++;
for (unsigned i = 1; i <= 4; ++i)
std::cout << "count " << i << ": " << counts[i-1] << "\n";
for (unsigned i = 0; i < 5; ++i) {
std::cout << "enum ";
for (auto j : dist)
std::cout << j << " ";
std::cout << "\n";
}
}
void tst_distribution() {
tst1();
}

View file

@ -24,6 +24,7 @@ Revision History:
#include "util/debug.h"
#include "util/rlimit.h"
#include <iostream>
#include <sstream>
template class interval_manager<im_default_config>;
typedef im_default_config::interval interval;
@ -199,16 +200,12 @@ static void mk_random_interval(T & cfg, interval & a, unsigned magnitude) {
#define BUFFER_SZ 256
static int g_problem_id = 0;
static char g_buffer[BUFFER_SZ];
char const * get_next_file_name() {
#ifdef _WINDOWS
sprintf_s(g_buffer, BUFFER_SZ, "interval_lemma_%d.smt2", g_problem_id);
#else
sprintf(g_buffer, "interval_lemma_%d.smt2", g_problem_id);
#endif
std::string get_next_file_name() {
std::stringstream ous;
ous << "interval_lemma_" << g_problem_id << ".smt2";
g_problem_id++;
return g_buffer;
return ous.str();
}
static void display_lemmas(unsynch_mpq_manager & nm, char const * result_term,

View file

@ -130,7 +130,7 @@ struct gomory_test {
void report_conflict_from_gomory_cut(mpq &k) {
lp_assert(false);
UNREACHABLE();
}
void adjust_term_and_k_for_some_ints_case_gomory(lar_term& t, mpq& k, mpq &lcm_den) {

File diff suppressed because it is too large Load diff

View file

@ -20,18 +20,14 @@ Revision History:
#pragma once
// reads an MPS file representing a Mixed Integer Program
#include <string>
#include <vector>
#include <unordered_map>
#include "math/lp/lp_primal_simplex.h"
#include "math/lp/lp_dual_simplex.h"
#include "math/lp/lar_solver.h"
#include <iostream>
#include <fstream>
#include <functional>
#include <algorithm>
#include "math/lp/mps_reader.h"
#include "math/lp/ul_pair.h"
#include "math/lp/lar_constraints.h"
#include <sstream>
@ -276,7 +272,7 @@ namespace lp {
} else if (el.m_head == "+") {
add_sum(c, el.m_elems);
} else {
lp_assert(false); // unexpected input
UNREACHABLE(); // unexpected input
}
}

View file

@ -27,7 +27,6 @@ Revision History:
#include <iostream>
#include <fstream>
#include "math/lp/lp_utils.h"
#include "math/lp/lp_solver.h"
namespace lp {

View file

@ -268,4 +268,5 @@ int main(int argc, char ** argv) {
TST(mod_interval);
TST(viable);
TST(totalizer);
TST(distribution);
}

View file

@ -529,8 +529,8 @@ void test_div(unsigned bvsize) {
Z3_del_context(ctx);
}
typedef Z3_ast (Z3_API *NO_OVFL_ARITH_FUNC)(Z3_context ctx, Z3_ast t1, Z3_ast t2, bool is_signed);
typedef Z3_ast (Z3_API *ARITH_FUNC)(Z3_context ctx, Z3_ast t1, Z3_ast t2);
typedef Z3_ast (*NO_OVFL_ARITH_FUNC)(Z3_context ctx, Z3_ast t1, Z3_ast t2, bool is_signed);
typedef Z3_ast (*ARITH_FUNC)(Z3_context ctx, Z3_ast t1, Z3_ast t2);
typedef enum { OVFL_FUNC, UDFL_FUNC } overflow_type;

View file

@ -377,6 +377,9 @@ static void add_random_ineq(
case opt::t_mod:
NOT_IMPLEMENTED_YET();
break;
default:
NOT_IMPLEMENTED_YET();
break;
}
fmls.push_back(fml);
mbo.add_constraint(vars, rational(coeff), rel);