Lattice Land Core Library
|
#include <ast.hpp>
Public Types | |
using | allocator_type = Allocator |
using | this_type = TFormula<Allocator, ExtendedSig> |
using | Sequence = battery::vector<this_type, Allocator> |
using | Existential = battery::tuple<LVar<Allocator>, Sort<Allocator>> |
using | LogicSet = logic_set<this_type> |
using | Formula |
Representation of Booleans. | |
Public Member Functions | |
CUDA | TFormula () |
CUDA | TFormula (Formula &&formula) |
CUDA | TFormula (AType uid, Formula &&formula) |
CUDA | TFormula (const this_type &other) |
CUDA | TFormula (this_type &&other) |
template<class Alloc2 , class ExtendedSig2 > | |
CUDA NI | TFormula (const TFormula< Alloc2, ExtendedSig2 > &other, const Allocator &allocator=Allocator()) |
CUDA void | swap (this_type &other) |
CUDA this_type & | operator= (const this_type &rhs) |
CUDA this_type & | operator= (this_type &&rhs) |
CUDA Formula & | data () |
CUDA const Formula & | data () const |
CUDA AType | type () const |
CUDA void | type_as (AType ty) |
CUDA constexpr bool | is_untyped () const |
CUDA NI std::optional< Sort< allocator_type > > | sort () const |
CUDA size_t | index () const |
CUDA bool | is (size_t kind) const |
CUDA bool | is_true () const |
CUDA bool | is_false () const |
CUDA logic_int | to_z () const |
CUDA bool | is_constant () const |
CUDA bool | is_variable () const |
CUDA bool | is_unary () const |
CUDA bool | is_binary () const |
CUDA logic_bool | b () const |
CUDA logic_int | z () const |
CUDA const logic_real & | r () const |
CUDA const LogicSet & | s () const |
CUDA AVar | v () const |
CUDA const LVar< Allocator > & | lv () const |
CUDA const Existential & | exists () const |
CUDA Sig | sig () const |
CUDA NI bool | is_logical () const |
CUDA const ExtendedSig & | esig () const |
CUDA const Sequence & | seq () const |
CUDA const this_type & | seq (size_t i) const |
CUDA const Sequence & | eseq () const |
CUDA const this_type & | eseq (size_t i) const |
CUDA logic_bool & | b () |
CUDA logic_int & | z () |
CUDA logic_real & | r () |
CUDA LogicSet & | s () |
CUDA AVar & | v () |
CUDA Sig & | sig () |
CUDA ExtendedSig & | esig () |
CUDA Sequence & | seq () |
CUDA this_type & | seq (size_t i) |
CUDA Sequence & | eseq () |
CUDA this_type & | eseq (size_t i) |
CUDA NI this_type | map_sig (Sig sig) const |
CUDA NI this_type | map_atype (AType aty) const |
template<class Fun > | |
CUDA NI void | inplace_map (Fun fun) |
template<class Fun > | |
CUDA NI this_type | map (Fun fun) |
CUDA void | print (bool print_atype=true) const |
Static Public Member Functions | |
static CUDA this_type | make_true () |
static CUDA this_type | make_false () |
static CUDA this_type | make_bool (logic_bool b, AType atype=UNTYPED) |
static CUDA this_type | make_z (logic_int i, AType atype=UNTYPED) |
static CUDA this_type | make_real (double lb, double ub, AType atype=UNTYPED) |
static CUDA this_type | make_real (logic_real r, AType atype=UNTYPED) |
static CUDA this_type | make_set (LogicSet set, AType atype=UNTYPED) |
static CUDA this_type | make_avar (AVar v) |
static CUDA this_type | make_avar (AType ty, int vid) |
static CUDA this_type | make_lvar (AType ty, LVar< Allocator > lvar) |
static CUDA this_type | make_exists (AType ty, LVar< Allocator > lvar, Sort< Allocator > ctype) |
CUDA static NI this_type | make_nary (Sig sig, Sequence children, AType atype=UNTYPED, bool flatten=true) |
static CUDA this_type | make_unary (Sig sig, TFormula child, AType atype=UNTYPED, const Allocator &allocator=Allocator()) |
static CUDA this_type | make_binary (TFormula lhs, Sig sig, TFormula rhs, AType atype=UNTYPED, const Allocator &allocator=Allocator(), bool flatten=true) |
static CUDA this_type | make_nary (ExtendedSig esig, Sequence children, AType atype=UNTYPED) |
Static Public Attributes | |
static constexpr size_t | B = 0 |
static constexpr size_t | Z = B + 1 |
static constexpr size_t | R = Z + 1 |
static constexpr size_t | S = R + 1 |
static constexpr size_t | V = S + 1 |
static constexpr size_t | LV = V + 1 |
static constexpr size_t | E = LV + 1 |
static constexpr size_t | Seq = E + 1 |
static constexpr size_t | ESeq = Seq + 1 |
Friends | |
template<class Alloc2 , class ExtendedSig2 > | |
class | TFormula |
TFormula
represents the AST of a typed first-order logical formula. In our context, the type of a formula is an integer representing the UID of an abstract domain in which the formula should to be interpreted. It defaults to the value UNTYPED
if the formula is not (yet) typed. By default, the types of integer and real number are supported. The supported symbols can be extended with the template parameter ExtendedSig
. This extended signature can also be used for representing exactly constant such as real numbers using a string. The AST of a formula is represented by a variant, where each alternative is described below. We represent everything at the same level (term, formula, predicate, variable, constant). This is generally convenient when modelling to avoid creating intermediate boolean variables when reifying. We can have x + (x > y \/ y > x + 4) >= 1
.
Differently from first-order logic, the existential quantifier does not have a subformula, i.e., we write \( \exists{x:Int} \land \exists{y:Int} \land x < y\). This semantics comes from "dynamic predicate logic" where a formula is interpreted in a context (here the abstract element). (The exact connection of our framework to dynamic predicate logic is not yet perfectly clear.)
using lala::TFormula< Allocator, ExtendedSig >::allocator_type = Allocator |
using lala::TFormula< Allocator, ExtendedSig >::this_type = TFormula<Allocator, ExtendedSig> |
using lala::TFormula< Allocator, ExtendedSig >::Sequence = battery::vector<this_type, Allocator> |
using lala::TFormula< Allocator, ExtendedSig >::Existential = battery::tuple<LVar<Allocator>, Sort<Allocator>> |
using lala::TFormula< Allocator, ExtendedSig >::LogicSet = logic_set<this_type> |
using lala::TFormula< Allocator, ExtendedSig >::Formula |
Representation of Booleans.
Representation of integers. Approximation of real numbers. Set of Booleans, integers, reals or sets. Abstract variable Logical variable Existential quantifier ADD, SUB, ..., EQ, ..., AND, .., NOT see above
|
inline |
By default, we initialize the formula to true
.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineconstexpr |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Create a term representing a real number which is approximated by interval [lb..ub]. By default the real number is supposedly over-approximated.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
The type of the formula is embedded in v
.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
If flatten
is true
it will try to merge the children together to avoid nested formula.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
In-place map of each leaf of the formula to a new leaf according to fun
.
|
inline |
Map of each leaf of the formula to a new leaf according to fun
.
|
inline |
|
friend |
|
staticconstexpr |
Index of Booleans in the variant type Formula
(called kind below).
|
staticconstexpr |
Index of integers in the variant type Formula
(called kind below).
|
staticconstexpr |
Index of real numbers in the variant type Formula
(called kind below).
|
staticconstexpr |
Index of sets in the variant type Formula
(called kind below).
|
staticconstexpr |
Index of abstract variables in the variant type Formula
(called kind below).
|
staticconstexpr |
Index of logical variables in the variant type Formula
(called kind below).
|
staticconstexpr |
Index of existential quantifier in the variant type Formula
(called kind below).
|
staticconstexpr |
Index of n-ary operators in the variant type Formula
(called kind below).
|
staticconstexpr |
Index of n-ary operators where the operator is an extended signature in the variant type Formula
(called kind below).