Clingo
Loading...
Searching...
No Matches
simplify.hh
1#pragma once
2
3#include <clingo/input/rewrite/rewrite_context.hh>
4
5#include <clingo/util/enum.hh>
6#include <clingo/util/optional.hh>
7
8namespace CppClingo::Input {
9
12
14enum class SimplifyTermFlags : uint8_t {
15 none = 0,
16 matchable = 1,
17 unfailable = 2,
20};
23
25enum class SimplifyLiteralFlags : uint8_t {
26 none = 0,
27 matchable = 1,
28 unfailable = 2,
29 head = 4,
30};
33
36
39
46[[nodiscard]] auto simplify(SimplifyTermFlags flags, RewriteContext &ctx, Term const &term) -> SimplifyTermResult;
47
57[[nodiscard]] auto simplify(SimplifyLiteralFlags flags, RewriteContext &ctx, Lit const &lit) -> SimplifyResult<Lit>;
58
65[[nodiscard]] auto simplify(RewriteContext &ctx, HdLit const &lit) -> SimplifyResult<HdLit>;
66
73[[nodiscard]] auto simplify(RewriteContext &ctx, BdLit const &lit) -> SimplifyResult<BdLit>;
74
79[[nodiscard]] auto simplify(RewriteContext &ctx, Stm const &stm) -> SimplifyResult<Stm>;
80
82
83} // namespace CppClingo::Input
Helper to pass arguments to rewrite functions.
Definition rewrite_context.hh:97
std::variant< BdLitSimple, BdLitConjunction, BdLitAggregate, BdLitSetAggregate, BdLitTheoryAtom > BdLit
A body literal.
Definition body_literal.hh:116
std::variant< HdLitSimple, HdLitDisjunction, HdLitAggregate, HdLitSetAggregate, HdLitTheoryAtom > HdLit
A head literal.
Definition head_literal.hh:130
std::variant< LitBool, LitComparison, LitSymbolic > Lit
Variant holding the different literal types.
Definition literal.hh:129
SimplifyLiteralFlags
Flags controlling simplification of literals.
Definition simplify.hh:25
SimplifyTermFlags
Flags controlling simplification of terms.
Definition simplify.hh:14
Util::ResultState< Term, bool > SimplifyTermResult
The result of a simplification.
Definition simplify.hh:38
auto simplify(IETermVec &terms) -> Number
Simplify the given sum of terms.
@ unfailable
Ensure that terms do not evaluate to empty pools (should be used together with matchable).
@ nested_matchable
Do not make roots of terms matchable (should be used together with matchable).
@ matchable
Ensure that terms are matchable.
@ preserve_toplevel
Preserve toplevel terms terms like u..t or @f.
std::variant< StmRule, StmTheory, StmOptimize, StmWeakConstraint, StmShow, StmShowNothing, StmShowSig, StmProject, StmProjectSig, StmDefined, StmExternal, StmEdge, StmHeuristic, StmScript, StmInclude, StmProgram, StmConst, StmParts, StmComment > Stm
Variant of available statements.
Definition statement.hh:828
@ head
A theory atom that can appear only in the head.
std::variant< TermVariable, TermSymbol, TermTuple, TermFunction, TermAbs, TermUnary, TermBinary > Term
Variant holding the different term types.
Definition term.hh:45
#define CLINGO_ENABLE_BITSET_ENUM(E,...)
Opt-in macro for enabling bit operations for a given enum type.
Definition enum.hh:18
The result of a simplification.
Definition optional.hh:128