SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
operator_mccallum.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "operator.h"
4 
5 
6 #include "../datastructures/roots.h"
7 #include "properties.h"
8 #include "rules.h"
9 
11 
13  static constexpr bool complete = false;
14 };
15 
17  static constexpr bool complete = true;
18 };
19 
20 template<typename Settings>
21 
22 struct Mccallum {
23 
24 static constexpr bool filter = false;
25 
27 
28 /**
29  * Project basic cell properties.
30  *
31  * Returns false iff the given operator is incomplete and cannot cover the given case (i.e. on nullification with McCallum).
32  */
34  SMTRAT_LOG_FUNC("smtrat.cadcells.operators", &deriv);
35  for(const auto& prop : deriv.properties<properties::poly_del>()) {
36  if (!rules::poly_del(deriv, prop.poly)) return false;
37  }
38  for(const auto& prop : deriv.properties<properties::poly_ord_inv>()) {
39  if (!Settings::complete) {
40  rules::poly_ord_inv(deriv, prop.poly);
41  } else {
42  rules::poly_ord_inv_maybe_null(deriv, prop.poly);
43  }
44  }
45  for(const auto& prop : deriv.properties<properties::poly_semi_sgn_inv>()) {
47  }
48  for(const auto& prop : deriv.properties<properties::poly_sgn_inv>()) {
49  rules::poly_sgn_inv(deriv, prop.poly, !Settings::complete);
50  }
51  return true;
52 }
53 
54 /**
55  * Delineate properties.
56  */
58  SMTRAT_LOG_FUNC("smtrat.cadcells.operators", &deriv);
59  for(const auto& prop : deriv.properties<properties::poly_irreducible_sgn_inv>()) {
60  rules::delineate(*deriv.delineated(), prop);
61  }
62 }
63 
64 /**
65  * Project cell properties that depend on a delineation.
66  */
68  SMTRAT_LOG_FUNC("smtrat.cadcells.operators", repr);
69  auto& deriv = *repr.derivation;
70 
71  for (const auto poly : deriv.delin().nullified()) {
72  if (deriv.contains(properties::poly_del{ poly })) {
73  return false;
74  }
75  }
76 
77  for(const auto& poly : repr.description.polys()) {
78  deriv.insert(properties::poly_del{ poly });
79  }
80  for(const auto& poly : repr.ordering.polys()) {
81  deriv.insert(properties::poly_del{ poly });
82  }
83 
84  if (deriv.contains(properties::cell_connected{deriv.level()})) {
85  rules::cell_connected(deriv, repr.description, repr.ordering);
86  }
89 
90  rules::root_ordering_holds(deriv.underlying().sampled(), repr.ordering);
91 
92  for(const auto& prop : deriv.properties<properties::poly_irreducible_sgn_inv>()) {
93  if (repr.equational.find(prop.poly) != repr.equational.end()) {
94  rules::poly_irreducible_sgn_inv_ec(deriv, repr.description, prop.poly);
95  } else if (deriv.delin().nonzero().find(prop.poly) != deriv.delin().nonzero().end()) {
96  rules::poly_irreducible_nonzero_sgn_inv(*deriv.delineated(), prop.poly);
97  } else if (deriv.delin().nullified().find(prop.poly) != deriv.delin().nullified().end()) {
98  rules::poly_irreducible_null_sgn_inv(deriv, prop.poly);
99  } else {
100  rules::poly_irreducible_sgn_inv(deriv, repr.description, repr.ordering, prop.poly);
101  }
102  }
103  return true;
104 }
105 
106 /**
107  * Project covering properties.
108  */
110  SMTRAT_LOG_FUNC("smtrat.cadcells.operators", repr);
111  for (auto& cell_repr : repr.cells) {
112  if (!project_cell_properties(cell_repr)) {
113  return false;
114  }
115  }
116  auto cov = repr.get_covering();
117  rules::root_ordering_holds(repr.cells.front().derivation->underlying().sampled(), repr.ordering);
118  rules::covering_holds(repr.cells.front().derivation->underlying().delineated(), cov, repr.ordering);
119  return true;
120 }
121 
122 };
123 
124 }
void polys(boost::container::flat_set< PolyRef > &result) const
Definition: roots.h:561
A SampledDerivation is a DelineatedDerivation with a sample and an DelineationInterval w....
Definition: derivation.h:299
DelineatedDerivationRef< Properties > & delineated()
Definition: derivation.h:314
const PropertiesTSet< P > & properties() const
Definition: derivation.h:345
void polys(boost::container::flat_set< PolyRef > &result) const
Definition: roots.h:296
void root_ordering_holds(datastructures::SampledDerivation< P > &deriv, const datastructures::IndexedRootOrdering &ordering)
Definition: rules.h:222
void cell_analytic_submanifold([[maybe_unused]] datastructures::SampledDerivation< P > &deriv, const datastructures::SymbolicInterval &)
Definition: rules.h:169
void poly_irreducible_null_sgn_inv(datastructures::SampledDerivation< P > &deriv, datastructures::PolyRef poly)
Definition: rules.h:244
void poly_ord_inv(datastructures::SampledDerivation< P > &deriv, datastructures::PolyRef poly)
Definition: rules.h:71
void poly_irreducible_sgn_inv_ec(datastructures::SampledDerivation< P > &deriv, const datastructures::SymbolicInterval &cell, datastructures::PolyRef poly)
Definition: rules.h:174
void poly_irreducible_nonzero_sgn_inv(datastructures::DelineatedDerivation< P > &deriv, datastructures::PolyRef poly)
Definition: rules.h:118
void cell_connected(datastructures::SampledDerivation< P > &deriv, const datastructures::SymbolicInterval &cell, const datastructures::IndexedRootOrdering &ordering)
Definition: rules.h:160
void poly_sgn_inv(datastructures::SampledDerivation< P > &deriv, datastructures::PolyRef poly, bool skip_if_ord_inv=true)
Definition: rules.h:85
void poly_ord_inv_maybe_null(datastructures::SampledDerivation< P > &deriv, datastructures::PolyRef poly)
Definition: rules_null.h:50
bool poly_del(datastructures::SampledDerivation< P > &deriv, datastructures::PolyRef poly)
Definition: rules.h:43
void poly_irreducible_sgn_inv(datastructures::SampledDerivation< P > &, const datastructures::SymbolicInterval &, const datastructures::IndexedRootOrdering &, [[maybe_unused]] datastructures::PolyRef poly)
Definition: rules.h:239
void cell_represents(datastructures::SampledDerivation< P > &deriv, const datastructures::SymbolicInterval &cell)
Definition: rules.h:191
void delineate(datastructures::DelineatedDerivation< P > &deriv, const properties::poly_irreducible_sgn_inv &prop)
Definition: rules.h:126
void covering_holds(datastructures::DelineatedDerivation< P > &, const datastructures::CoveringDescription &covering, const datastructures::IndexedRootOrdering &ordering)
Definition: rules_covering.h:6
Projection operators.
Definition: operator.h:33
#define SMTRAT_LOG_FUNC(channel, args)
Definition: logging.h:38
IndexedRootOrdering ordering
An ordering on the roots that protects the cell.
SymbolicInterval description
Description of a cell.
boost::container::flat_set< PolyRef > equational
Polynomials that should be projected using the equational constraints projection.
SampledDerivationRef< P > derivation
Derivation.
IndexedRootOrdering ordering
An ordering on the roots for the cell boundaries mainting the covering.
std::vector< CellRepresentation< P > > cells
Cells of the covering in increasing order and no cell is contained in another cell.
CoveringDescription get_covering() const
Returns a descriptions of the covering.
static bool project_covering_properties(datastructures::CoveringRepresentation< PropertiesSet > &repr)
Project covering properties.
static bool project_basic_properties(datastructures::SampledDerivation< PropertiesSet > &deriv)
Project basic cell properties.
static bool project_cell_properties(datastructures::CellRepresentation< PropertiesSet > &repr)
Project cell properties that depend on a delineation.
static void delineate_properties(datastructures::SampledDerivation< PropertiesSet > &deriv)
Delineate properties.