carl  24.04
Computer ARithmetic Library
Condition.h
Go to the documentation of this file.
1 /**
2  * Condition.h
3  * @author Florian Corzilius<corzilius@cs.rwth-aachen.de>
4  * @since 2012-06-11
5  * @version 2014-10-30
6  */
7 
8 #pragma once
9 
10 #include <bitset>
11 #include <cassert>
12 #include <cstdio>
13 #include <iostream>
14 
15 
16 namespace carl {
17  static constexpr std::size_t CONDITION_SIZE = 64;
18 
19  class Condition: public std::bitset<CONDITION_SIZE>
20  {
21  public:
22  constexpr Condition():
23  std::bitset<CONDITION_SIZE>()
24  {}
25 
26  constexpr Condition(std::bitset<CONDITION_SIZE> _bitset):
27  std::bitset<CONDITION_SIZE>(_bitset)
28  {}
29 
30  explicit constexpr Condition(std::size_t i):
31  std::bitset<CONDITION_SIZE>(static_cast<std::size_t>(1) << i)
32  {}
33  };
34 
35  /**
36  * Check whether the bits of one condition are always set if the corresponding bit
37  * of another condition is set. Essentially checks for an implication.
38  *
39  * @param lhs The first condition.
40  * @param rhs The second condition.
41  * @return true, if all bits of lhs are set if the corresponding bit
42  * of rhs are set;
43  * false, otherwise.
44  */
45  inline bool operator<=(const Condition& lhs, const Condition& rhs) {
46  return (lhs & (~rhs)).none();
47  }
48 
49  static constexpr Condition PROP_TRUE = Condition();
50 
51  //Propositions which hold, if they hold for each sub formula of a formula including itself (0-15)
52  static constexpr Condition PROP_IS_IN_NNF = Condition( 0 );
53  static constexpr Condition PROP_IS_IN_CNF = Condition( 1 );
54  static constexpr Condition PROP_IS_PURE_CONJUNCTION = Condition( 2 );
55  static constexpr Condition PROP_IS_A_CLAUSE = Condition( 3 );
56  static constexpr Condition PROP_IS_A_LITERAL = Condition( 4 );
57  static constexpr Condition PROP_IS_AN_ATOM = Condition( 5 );
59  static constexpr Condition PROP_IS_IN_PNF = Condition( 7 );
63 
64  //Propositions which hold, if they hold in at least one sub formula (16-63)
65  static constexpr Condition PROP_CONTAINS_EQUATION = Condition( 16 );
66  static constexpr Condition PROP_CONTAINS_INEQUALITY = Condition( 17 );
71  static constexpr Condition PROP_CONTAINS_BOOLEAN = Condition( 22 );
75  static constexpr Condition PROP_CONTAINS_BITVECTOR = Condition( 26 );
83 
84 
91 
92 } // namespace carl
carl is the main namespace for the library.
static constexpr Condition PROP_CONTAINS_NONLINEAR_POLYNOMIAL
Definition: Condition.h:69
static constexpr Condition PROP_CONTAINS_LINEAR_POLYNOMIAL
Definition: Condition.h:68
static constexpr Condition PROP_CONTAINS_MULTIVARIATE_POLYNOMIAL
Definition: Condition.h:70
static constexpr Condition PROP_CONTAINS_STRICT_INEQUALITY
Definition: Condition.h:67
static constexpr Condition PROP_IS_IN_CNF
Definition: Condition.h:53
static constexpr Condition PROP_CONTAINS_BOOLEAN
Definition: Condition.h:71
static constexpr Condition PROP_TRUE
Definition: Condition.h:49
static constexpr std::size_t CONDITION_SIZE
Definition: Condition.h:17
static constexpr Condition PROP_IS_A_CLAUSE
Definition: Condition.h:55
static constexpr Condition PROP_IS_A_LITERAL
Definition: Condition.h:56
static constexpr Condition PROP_IS_PURE_CONJUNCTION
Definition: Condition.h:54
static constexpr Condition PROP_VARIABLE_DEGREE_GREATER_THAN_THREE
Definition: Condition.h:78
static const Condition STRONG_CONDITIONS
Definition: Condition.h:60
static constexpr Condition PROP_IS_AN_ATOM
Definition: Condition.h:57
static constexpr Condition PROP_VARIABLE_DEGREE_GREATER_THAN_FOUR
Definition: Condition.h:79
static constexpr Condition PROP_CONTAINS_QUANTIFIER_EXISTS
Definition: Condition.h:81
static constexpr Condition PROP_IS_IN_NNF
Definition: Condition.h:52
static constexpr Condition PROP_CONTAINS_INEQUALITY
Definition: Condition.h:66
static constexpr Condition PROP_CONTAINS_WEAK_INEQUALITY
Definition: Condition.h:80
static const Condition WEAK_CONDITIONS
Definition: Condition.h:85
static constexpr Condition PROP_CONTAINS_UNINTERPRETED_EQUATIONS
Definition: Condition.h:74
bool operator<=(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
static constexpr Condition PROP_CONTAINS_EQUATION
Definition: Condition.h:65
static constexpr Condition PROP_IS_IN_PNF
Definition: Condition.h:59
static constexpr Condition PROP_CONTAINS_QUANTIFIER_FORALL
Definition: Condition.h:82
static constexpr Condition PROP_CONTAINS_INTEGER_VALUED_VARS
Definition: Condition.h:72
static constexpr Condition PROP_IS_LITERAL_CONJUNCTION
Definition: Condition.h:58
static constexpr Condition PROP_VARIABLE_DEGREE_GREATER_THAN_TWO
Definition: Condition.h:77
static constexpr Condition PROP_CONTAINS_REAL_VALUED_VARS
Definition: Condition.h:73
static constexpr Condition PROP_CONTAINS_BITVECTOR
Definition: Condition.h:75
static constexpr Condition PROP_CONTAINS_PSEUDOBOOLEAN
Definition: Condition.h:76
constexpr Condition(std::bitset< CONDITION_SIZE > _bitset)
Definition: Condition.h:26
constexpr Condition(std::size_t i)
Definition: Condition.h:30
constexpr Condition()
Definition: Condition.h:22