12 template<
typename Properties>
14 template<
typename Properties>
15 class DelineatedDerivation;
16 template<
typename Properties>
17 class SampledDerivation;
19 template<
typename Properties>
21 template<
typename Properties>
24 template<
typename Properties>
37 template<
typename Properties>
51 return std::get<BaseDerivationRef<Properties>>(
m_data) ==
nullptr;
53 return std::get<DelineatedDerivationRef<Properties>>(
m_data) ==
nullptr;
55 return std::get<SampledDerivationRef<Properties>>(
m_data) ==
nullptr;
59 return std::holds_alternative<SampledDerivationRef<Properties>>(
m_data);
64 return std::get<BaseDerivationRef<Properties>>(
m_data);
66 return std::get<DelineatedDerivationRef<Properties>>(
m_data)->
base();
69 return std::get<SampledDerivationRef<Properties>>(
m_data)->
base();
74 return std::get<DelineatedDerivationRef<Properties>>(
m_data);
82 return std::get<SampledDerivationRef<Properties>>(
m_data);
87 return std::get<BaseDerivationRef<Properties>>(
m_data);
89 return std::get<DelineatedDerivationRef<Properties>>(
m_data)->
base();
92 return std::get<SampledDerivationRef<Properties>>(
m_data)->
base();
97 return std::get<DelineatedDerivationRef<Properties>>(
m_data);
105 return std::get<SampledDerivationRef<Properties>>(
m_data);
146 template<
typename Properties>
170 if (
m_level == 0)
return carl::Variable::NO_VARIABLE;
178 assert(property.level() <=
m_level && property.level() >= 0);
180 if (property.level() ==
m_level) {
190 assert(property.level() <=
m_level && property.level() >= 0);
192 if (property.level() ==
m_level) {
218 template<
typename Properties>
227 assert(
base->level() == 0 ||
base->underlying().is_sampled());
231 assert(
base->level() == 0 ||
base->underlying().is_sampled());
245 if (
m_base->level() <= 1) {
253 return m_base->underlying();
256 return m_base->underlying();
265 return m_base->main_var();
276 return m_base->contains(property);
280 return m_base->template properties<P>();
298 template<
typename Properties>
301 std::optional<DelineationInterval>
m_cell;
360 template<
typename Properties>
362 const auto&
vars = proj.
polys().var_order();
365 auto zero_delineated = std::make_shared<DelineatedDerivation<Properties>>(zero_base);
368 for (
size_t i = 1; i <= level; i++) {
369 auto base = std::make_shared<BaseDerivation<Properties>>(proj, current, i);
370 auto delineated = std::make_shared<DelineatedDerivation<Properties>>(base);
371 if (assignment.find(
vars[i - 1]) != assignment.end()) {
372 current = std::make_shared<SampledDerivation<Properties>>(delineated, assignment.at(
vars[i - 1]));
374 current = delineated;
384 template<
typename Properties>
386 auto base_ref = std::make_shared<BaseDerivation<Properties>>(*delineated->base());
387 auto delineated_ref = std::make_shared<DelineatedDerivation<Properties>>(base_ref, delineated->delin());
388 auto sampled_ref = std::make_shared<SampledDerivation<Properties>>(delineated_ref, main_sample);
389 sampled_ref->delineate_cell();
396 template<
typename Properties>
398 auto base_ref = std::make_shared<BaseDerivation<Properties>>(underlying->proj(), underlying, underlying->level()+1);
399 auto delineated_ref = std::make_shared<DelineatedDerivation<Properties>>(base_ref);
400 auto sampled_ref = std::make_shared<SampledDerivation<Properties>>(delineated_ref, main_sample);
407 template<
typename Properties>
409 std::set<DerivationRef<Properties>> underlying;
410 for (
auto& deriv : derivations) {
411 underlying.insert(deriv->underlying());
413 assert(!underlying.empty());
414 auto first_underlying = *underlying.begin();
415 for (
auto iter = std::next(underlying.begin()); iter != underlying.end(); iter++) {
416 first_underlying.base().merge_with(iter->base());
418 for (
auto& deriv : derivations) {
419 deriv->base()->m_underlying = first_underlying;
426 template<
typename Properties>
428 auto first = *derivations.begin();
429 for (
auto iter = std::next(derivations.begin()); iter != derivations.end(); iter++) {
430 first->base()->merge_with(*((*iter)->base()));
A BaseDerivation has a level and a set of properties of this level, and an underlying derivation repr...
friend void merge_underlying(std::vector< SampledDerivationRef< P >> &derivations)
const PropertiesTSet< P > & properties() const
BaseDerivation(Projections &projections, DerivationRef< Properties > underlying, size_t level)
carl::Variable main_var() const
DerivationRef< Properties > m_underlying
BaseDerivation(const BaseDerivation &other)
void merge_with(const BaseDerivation< Properties > &other)
bool contains(const P &property) const
DerivationRef< Properties > & underlying()
const DerivationRef< Properties > & underlying() const
Projections & m_projections
A DelineatedDerivation is a BaseDerivation with a Delineation and an underlying SampledDerivation.
carl::Variable main_var() const
Delineation m_delineation
DerivationRef< Properties > & underlying()
DelineatedDerivation(BaseDerivationRef< Properties > base)
void merge_with(const DelineatedDerivation< Properties > &other)
DelineatedDerivation(BaseDerivationRef< Properties > base, const Delineation &delineation)
const Assignment & underlying_sample() const
BaseDerivationRef< Properties > m_base
const BaseDerivationRef< Properties > & base() const
BaseDerivationRef< Properties > & base()
const PropertiesTSet< P > & properties() const
const DerivationRef< Properties > & underlying() const
bool contains(const P &property) const
An interval of a delineation.
Represents the delineation of a set of polynomials (at a sample), that is.
void merge_with(const Delineation &other)
A reference to a derivation, which is either.
const auto & base() const
DerivationRef(const DelineatedDerivationRef< Properties > &data)
friend bool operator==(const DerivationRef< P > &lhs, const DerivationRef< P > &rhs)
friend bool operator<(const DerivationRef< P > &lhs, const DerivationRef< P > &rhs)
DerivationRef(const BaseDerivationRef< Properties > &data)
const auto & delineated_ref() const
const auto & delineated() const
const auto & sampled() const
std::variant< BaseDerivationRef< Properties >, DelineatedDerivationRef< Properties >, SampledDerivationRef< Properties > > m_data
DerivationRef(const SampledDerivationRef< Properties > &data)
const auto & base_ref() const
const auto & sampled_ref() const
Encapsulates all computations on polynomials.
A SampledDerivation is a DelineatedDerivation with a sample and an DelineationInterval w....
DelineatedDerivationRef< Properties > m_delineated
std::optional< DelineationInterval > m_cell
void delineate_cell()
Determines the cell w.r.t.
const Assignment & sample() const
BaseDerivationRef< Properties > & base()
const Assignment & underlying_sample() const
void merge_with(const SampledDerivation< Properties > &other)
DerivationRef< Properties > & underlying()
bool contains(const P &property) const
const RAN & main_var_sample() const
DelineatedDerivationRef< Properties > & delineated()
const PropertiesTSet< P > & properties() const
SampledDerivation(DelineatedDerivationRef< Properties > base, RAN main_sample)
const BaseDerivationRef< Properties > & base() const
carl::Variable main_var() const
const DelineatedDerivationRef< Properties > & delineated() const
const DelineationInterval & cell() const
bool operator==(const TaggedIndexedRoot &lhs, const TaggedIndexedRoot &rhs)
std::shared_ptr< DelineatedDerivation< Properties > > DelineatedDerivationRef
SampledDerivationRef< Properties > make_sampled_derivation(DelineatedDerivationRef< Properties > delineated, const RAN &main_sample)
Initializes a sampled derivation w.r.t.
void merge_underlying(std::vector< SampledDerivationRef< Properties >> &derivations)
Merges the underlying derivations of a set of sampled derivations.
DerivationRef< Properties > make_derivation(Projections &proj, const Assignment &assignment, size_t level)
Initializes a derivation according the the given assignment and level.
bool operator<(const TaggedIndexedRoot &lhs, const TaggedIndexedRoot &rhs)
std::shared_ptr< BaseDerivation< Properties > > BaseDerivationRef
std::shared_ptr< SampledDerivation< Properties > > SampledDerivationRef
SampledDerivationRef< Properties > merge(std::vector< SampledDerivationRef< Properties >> &derivations)
Merges a set of sampled derivations.
boost::container::flat_set< T > PropertiesTSet
carl::Assignment< RAN > Assignment
static const Assignment empty_assignment
std::vector< carl::Variable > vars(const std::pair< QuantifierType, std::vector< carl::Variable >> &p)
#define SMTRAT_LOG_FUNC(channel, args)