mirror of
https://github.com/Z3Prover/z3
synced 2025-07-23 12:48:53 +00:00
missing new files
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
c0de1e34ac
commit
a0d52e835b
2 changed files with 452 additions and 0 deletions
96
src/smt/smt_farkas_util.h
Normal file
96
src/smt/smt_farkas_util.h
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*++
|
||||
Copyright (c) 2013 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
smt_farkas_util.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Utility for combining inequalities using coefficients obtained from Farkas lemmas.
|
||||
|
||||
Author:
|
||||
|
||||
Nikolaj Bjorner (nbjorne) 2013-11-2.
|
||||
|
||||
Revision History:
|
||||
|
||||
NB. This utility is specialized to proofs generated by the arithmetic solvers.
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef __FARKAS_UTIL_H_
|
||||
#define __FARKAS_UTIL_H_
|
||||
|
||||
#include "arith_decl_plugin.h"
|
||||
|
||||
namespace smt {
|
||||
|
||||
class farkas_util {
|
||||
ast_manager& m;
|
||||
arith_util a;
|
||||
app_ref_vector m_ineqs;
|
||||
vector<rational> m_coeffs;
|
||||
rational m_normalize_factor;
|
||||
// utilities for separating coefficients
|
||||
bool m_split_literals;
|
||||
unsigned m_time;
|
||||
unsigned_vector m_roots, m_size, m_his, m_reps, m_ts;
|
||||
|
||||
void mk_coerce(expr*& e1, expr*& e2);
|
||||
app* mk_add(expr* e1, expr* e2);
|
||||
app* mk_mul(expr* e1, expr* e2);
|
||||
app* mk_le(expr* e1, expr* e2);
|
||||
app* mk_ge(expr* e1, expr* e2);
|
||||
app* mk_gt(expr* e1, expr* e2);
|
||||
app* mk_lt(expr* e1, expr* e2);
|
||||
void mul(rational const& c, expr* e, expr_ref& res);
|
||||
bool is_int_sort(app* c);
|
||||
bool is_int_sort();
|
||||
void normalize_coeffs();
|
||||
app* mk_one();
|
||||
app* fix_sign(bool is_pos, app* c);
|
||||
void partition_ineqs();
|
||||
unsigned find(unsigned idx);
|
||||
void merge(unsigned i, unsigned j);
|
||||
unsigned process_term(expr* e);
|
||||
expr_ref extract_consequence(unsigned lo, unsigned hi);
|
||||
void fix_dl(expr_ref& r);
|
||||
|
||||
public:
|
||||
farkas_util(ast_manager& m);
|
||||
|
||||
/**
|
||||
\brief Reset state
|
||||
*/
|
||||
void reset();
|
||||
|
||||
/**
|
||||
\brief add a multiple of constraint c to the current state
|
||||
*/
|
||||
void add(rational const & coef, app * c);
|
||||
|
||||
/**
|
||||
\brief Extract the complement of premises multiplied by Farkas coefficients.
|
||||
*/
|
||||
expr_ref get();
|
||||
|
||||
/**
|
||||
\brief Coefficients are normalized for integer problems.
|
||||
Retrieve multiplicant for normalization.
|
||||
*/
|
||||
rational const& get_normalize_factor() const { return m_normalize_factor; }
|
||||
|
||||
/**
|
||||
\brief extract one or multiple consequences based on literal partition.
|
||||
Multiple consequences are strongst modulo a partition of variables.
|
||||
Consequence generation under literal partitioning maintains difference logic constraints.
|
||||
That is, if the original constraints are difference logic, then the consequent
|
||||
produced by literal partitioning is also difference logic.
|
||||
*/
|
||||
void set_split_literals(bool f) { m_split_literals = f; }
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue