Clingo
Loading...
Searching...
No Matches
statement.hh
1#pragma once
2
3#include <clingo/input/body_literal.hh>
4#include <clingo/input/head_literal.hh>
5
6#include <utility>
7
8namespace CppClingo::Input {
9
12
16class StmRule : public Expression<StmRule> {
17 public:
19 static constexpr auto attributes() {
20 return std::tuple{a_loc = &StmRule::loc_, a_head = &StmRule::head_, a_body = &StmRule::body_};
21 }
22
25 : loc_{std::move(loc)}, head_{std::move(head)}, body_{std::move(body)} {}
26
28 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
30 [[nodiscard]] auto head() const -> HdLit const & { return head_; }
32 [[nodiscard]] auto body() const -> BdLitArray const & { return body_; }
33
34 private:
35 Location loc_;
36 HdLit head_;
37 BdLitArray body_;
38};
39
43enum class TheoryOpType : uint8_t {
44 unary,
47};
48
52class TheoryOpDefinition : public Expression<TheoryOpDefinition> {
53 public:
55 static constexpr auto attributes() {
56 return std::tuple{a_loc = &TheoryOpDefinition::loc_, a_op = &TheoryOpDefinition::op,
57 a_prio = &TheoryOpDefinition::prio_, a_type = &TheoryOpDefinition::type_};
58 }
59
62 : loc_{std::move(loc)}, op_{op}, prio_{prio}, type_{type} {}
63
65 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
67 [[nodiscard]] auto op() const -> String const & { return *op_; }
69 [[nodiscard]] auto prio() const -> int { return prio_; }
71 [[nodiscard]] auto type() const -> TheoryOpType { return type_; }
72
73 private:
74 Location loc_;
75 SharedString op_;
76 int prio_;
77 TheoryOpType type_;
78};
79
82
86class TheoryTermDefinition : public Expression<TheoryTermDefinition> {
87 public:
89 static constexpr auto attributes() {
90 return std::tuple{a_loc = &TheoryTermDefinition::loc_, a_name = &TheoryTermDefinition::name,
91 a_op_defs = &TheoryTermDefinition::op_defs_};
92 }
93
96 : loc_{std::move(loc)}, name_{name}, op_defs_{std::move(op_defs)} {}
97
99 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
101 [[nodiscard]] auto name() const -> String const & { return *name_; }
103 [[nodiscard]] auto op_defs() const -> TheoryOpDefinitionArray const & { return op_defs_; }
104
105 private:
106 Location loc_;
107 SharedString name_;
109};
110
113
117enum class TheoryAtomType : uint8_t {
118 head,
119 body,
120 any,
121 directive
122};
123
127class TheoryRGuardDefinition : public Expression<TheoryRGuardDefinition> {
128 public:
130 static constexpr auto attributes() {
131 return std::tuple{a_ops = &TheoryRGuardDefinition::ops, a_term = &TheoryRGuardDefinition::term_};
132 }
134 explicit TheoryRGuardDefinition(StringSpan ops, String term) : ops_{ops.begin(), ops.end()}, term_{term} {}
136 explicit TheoryRGuardDefinition(SharedStringArray ops, String term) : ops_{std::move(ops)}, term_{term} {}
137
139 [[nodiscard]] auto ops() const -> StringSpan { return as_string_span(ops_); }
141 [[nodiscard]] auto term() const -> String const & { return *term_; }
142
143 private:
145 SharedString term_;
146};
147
151class TheoryAtomDefinition : public Expression<TheoryAtomDefinition> {
152 public:
154 static constexpr auto attributes() {
155 return std::tuple{a_loc = &TheoryAtomDefinition::loc_, a_name = &TheoryAtomDefinition::name,
156 a_arity = &TheoryAtomDefinition::arity_, a_term = &TheoryAtomDefinition::term,
157 a_rhs = &TheoryAtomDefinition::rhs_, a_type = &TheoryAtomDefinition::type_};
158 }
159
162 std::optional<TheoryRGuardDefinition> rhs, TheoryAtomType type)
163 : loc_{std::move(loc)}, name_(name), arity_(arity), term_(term), rhs_(std::move(rhs)), type_(type) {}
164
166 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
168 [[nodiscard]] auto name() const -> String const & { return *name_; }
170 [[nodiscard]] auto arity() const -> int { return arity_; }
172 [[nodiscard]] auto term() const -> String const & { return *term_; }
174 [[nodiscard]] auto rhs() const -> std::optional<TheoryRGuardDefinition> const & { return rhs_; }
176 [[nodiscard]] auto type() const -> TheoryAtomType { return type_; }
177
178 private:
179 Location loc_;
180 SharedString name_;
181 int arity_;
182 SharedString term_;
183 std::optional<TheoryRGuardDefinition> rhs_;
184 TheoryAtomType type_;
185};
186
189
193class StmTheory : public Expression<StmTheory> {
194 public:
196 static constexpr auto attributes() {
197 return std::tuple{a_loc = &StmTheory::loc_, a_name = &StmTheory::name, a_term_defs = &StmTheory::term_defs_,
199 }
200
204 : loc_{std::move(loc)}, name_{name}, term_defs_{std::move(term_defs)}, atom_defs_{std::move(atom_defs)} {}
205
207 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
209 [[nodiscard]] auto name() const -> String const & { return *name_; }
211 [[nodiscard]] auto term_defs() const -> TheoryTermDefinitionArray const & { return term_defs_; }
213 [[nodiscard]] auto atom_defs() const -> TheoryAtomDefinitionArray const & { return atom_defs_; }
214
215 private:
216 Location loc_;
217 SharedString name_;
218 TheoryTermDefinitionArray term_defs_;
219 TheoryAtomDefinitionArray atom_defs_;
220};
221
225enum class OptimizeType : uint8_t { minimize, maximize };
226
228class OptimizeTuple : public Expression<OptimizeTuple> {
229 public:
231 static constexpr auto attributes() {
232 return std::tuple{a_weight = &OptimizeTuple::weight_, a_prio = &OptimizeTuple::prio_,
233 a_terms = &OptimizeTuple::terms_};
234 }
235
237 explicit OptimizeTuple(Term weight, std::optional<Term> priority, TermArray terms)
238 : weight_{std::move(weight)}, prio_{std::move(priority)}, terms_{std::move(terms)} {}
239
241 [[nodiscard]] auto weight() const -> Term const & { return weight_; }
243 [[nodiscard]] auto prio() const -> std::optional<Term> const & { return prio_; }
245 [[nodiscard]] auto terms() const -> TermArray const & { return terms_; }
246
247 private:
248 Term weight_;
249 std::optional<Term> prio_;
250 TermArray terms_;
251};
252
254class OptimizeElement : public Expression<OptimizeElement> {
255 public:
257 static constexpr auto attributes() {
258 return std::tuple{a_tuple = &OptimizeElement::tuple_, a_cond = &OptimizeElement::cond_};
259 }
260
262 explicit OptimizeElement(OptimizeTuple tuple, LitArray cond) : tuple_{std::move(tuple)}, cond_{std::move(cond)} {}
263
265 [[nodiscard]] auto tuple() const -> OptimizeTuple const & { return tuple_; }
267 [[nodiscard]] auto cond() const -> LitArray const & { return cond_; }
268
269 private:
270 OptimizeTuple tuple_;
271 LitArray cond_;
272};
275
279class StmOptimize : public Expression<StmOptimize> {
280 public:
282 static constexpr auto attributes() {
283 return std::tuple{a_loc = &StmOptimize::loc_, a_type = &StmOptimize::type_, a_elems = &StmOptimize::elems_};
284 }
285
288 : loc_{std::move(loc)}, type_{type}, elems_{std::move(elems)} {}
289
291 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
293 [[nodiscard]] auto type() const -> OptimizeType { return type_; }
295 [[nodiscard]] auto elems() const -> OptimizeElementArray const & { return elems_; }
296
297 private:
298 Location loc_;
299 OptimizeType type_;
301};
302
306class StmWeakConstraint : public Expression<StmWeakConstraint> {
307 public:
309 static constexpr auto attributes() {
310 return std::tuple{a_loc = &StmWeakConstraint::loc_, a_body = &StmWeakConstraint::body_,
311 a_tuple = &StmWeakConstraint::tuple_};
312 }
313
316 : loc_{std::move(loc)}, body_{std::move(body)}, tuple_{std::move(tuple)} {}
317
319 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
321 [[nodiscard]] auto body() const -> BdLitArray const & { return body_; }
323 [[nodiscard]] auto tuple() const -> OptimizeTuple const & { return tuple_; }
324
325 private:
326 Location loc_;
327 BdLitArray body_;
328 OptimizeTuple tuple_;
329};
330
334class StmShow : public Expression<StmShow> {
335 public:
337 static constexpr auto attributes() {
338 return std::tuple{a_loc = &StmShow::loc_, a_term = &StmShow::term_, a_body = &StmShow::body_};
339 }
340
343 : loc_{std::move(loc)}, term_(std::move(term)), body_(std::move(body)) {}
344
346 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
348 [[nodiscard]] auto term() const -> Term const & { return term_; }
350 [[nodiscard]] auto body() const -> BdLitArray const & { return body_; }
351
352 private:
353 Location loc_;
354 Term term_;
355 BdLitArray body_;
356};
357
361class StmShowSig : public Expression<StmShowSig> {
362 public:
364 static constexpr auto attributes() {
365 return std::tuple{a_loc = &StmShowSig::loc_, a_name = &StmShowSig::name, a_sign = &StmShowSig::sign_,
366 a_arity = &StmShowSig::arity_};
367 }
368
371 : loc_{std::move(loc)}, name_{name}, arity_{arity}, sign_{sign} {}
372
374 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
376 [[nodiscard]] auto sign() const -> bool { return sign_; }
378 [[nodiscard]] auto name() const -> String const & { return *name_; }
380 [[nodiscard]] auto arity() const -> int { return arity_; }
381
382 private:
383 Location loc_;
384 SharedString name_;
385 int arity_;
386 bool sign_;
387};
388
392class StmShowNothing : public Expression<StmShowNothing> {
393 public:
395 static constexpr auto attributes() { return std::tuple{a_loc = &StmShowNothing::loc_}; }
396
398 explicit StmShowNothing(Location loc) : loc_{std::move(loc)} {}
399
401 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
402
403 private:
404 Location loc_;
405};
406
410class StmProject : public Expression<StmProject> {
411 public:
413 static constexpr auto attributes() {
414 return std::tuple{a_loc = &StmProject::loc_, a_atom = &StmProject::atom_, a_body = &StmProject::body_};
415 }
416
419 : loc_{std::move(loc)}, atom_(std::move(atom)), body_(std::move(body)) {}
420
422 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
424 [[nodiscard]] auto atom() const -> Term const & { return atom_; }
426 [[nodiscard]] auto body() const -> BdLitArray const & { return body_; }
427
428 private:
429 Location loc_;
430 Term atom_;
431 BdLitArray body_;
432};
433
437class StmProjectSig : public Expression<StmProjectSig> {
438 public:
440 static constexpr auto attributes() {
441 return std::tuple{a_loc = &StmProjectSig::loc_, a_name = &StmProjectSig::name, a_sign = &StmProjectSig::sign_,
442 a_arity = &StmProjectSig::arity_};
443 }
444
447 : loc_{std::move(loc)}, sign_{sign}, name_{name}, arity_{arity} {}
448
450 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
452 [[nodiscard]] auto sign() const -> bool { return sign_; }
454 [[nodiscard]] auto name() const -> String const & { return *name_; }
456 [[nodiscard]] auto arity() const -> int { return arity_; }
457
458 private:
459 Location loc_;
460 bool sign_;
461 SharedString name_;
462 int arity_;
463};
464
468class StmDefined : public Expression<StmDefined> {
469 public:
471 static constexpr auto attributes() {
472 return std::tuple{a_loc = &StmDefined::loc_, a_name = &StmDefined::name, a_sign = &StmDefined::sign_,
473 a_arity = &StmDefined::arity_};
474 }
475
478 : loc_{std::move(loc)}, sign_{sign}, name_{name}, arity_{arity} {}
479
481 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
483 [[nodiscard]] auto sign() const -> bool { return sign_; }
485 [[nodiscard]] auto name() const -> String const & { return *name_; }
487 [[nodiscard]] auto arity() const -> int { return arity_; }
488
489 private:
490 Location loc_;
492 bool sign_;
494 SharedString name_;
496 int arity_;
497};
498
502class StmExternal : public Expression<StmExternal> {
503 public:
505 static constexpr auto attributes() {
506 return std::tuple{a_loc = &StmExternal::loc_, a_atom = &StmExternal::atom_, a_body = &StmExternal::body_,
507 a_type = &StmExternal::type_};
508 }
509
511 explicit StmExternal(Location loc, Term atom, BdLitArray body, std::optional<Term> type = std::nullopt)
512 : loc_{std::move(loc)}, atom_(std::move(atom)), body_(std::move(body)), type_{std::move(type)} {}
513
515 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
517 [[nodiscard]] auto atom() const -> Term const & { return atom_; }
519 [[nodiscard]] auto body() const -> BdLitArray const & { return body_; }
521 [[nodiscard]] auto type() const -> std::optional<Term> const & { return type_; }
522
523 private:
524 Location loc_;
525 Term atom_;
526 BdLitArray body_;
527 std::optional<Term> type_;
528};
529
531class Edge : public Expression<Edge> {
532 public:
534 static constexpr auto attributes() { return std::tuple{a_src = &Edge::src_, a_dst = &Edge::dst_}; }
535
537 explicit Edge(Term src, Term dst) : src_{std::move(src)}, dst_{std::move(dst)} {}
538
540 [[nodiscard]] auto src() const -> Term const & { return src_; }
542 [[nodiscard]] auto dst() const -> Term const & { return dst_; }
543
544 private:
545 Term src_;
546 Term dst_;
547};
550
554class StmEdge : public Expression<StmEdge> {
555 public:
557 static constexpr auto attributes() {
558 return std::tuple{a_loc = &StmEdge::loc_, a_edges = &StmEdge::edges_, a_body = &StmEdge::body_};
559 }
560
563 : loc_{std::move(loc)}, edges_{std::move(edges)}, body_{std::move(body)} {}
564
566 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
568 [[nodiscard]] auto edges() const -> EdgeArray const & { return edges_; }
570 [[nodiscard]] auto body() const -> BdLitArray const & { return body_; }
571
572 private:
573 Location loc_;
574 EdgeArray edges_;
575 BdLitArray body_;
576};
577
581class StmHeuristic : public Expression<StmHeuristic> {
582 public:
584 static constexpr auto attributes() {
585 return std::tuple{a_loc = &StmHeuristic::loc_, a_atom = &StmHeuristic::atom_,
586 a_body = &StmHeuristic::body_, a_weight = &StmHeuristic::weight_,
587 a_prio = &StmHeuristic::prio_, a_type = &StmHeuristic::type_};
588 }
589
592 : loc_{std::move(loc)}, atom_{std::move(atom)}, body_{std::move(body)}, weight_(std::move(weight)),
593 prio_(std::move(prio)), type_(std::move(type)) {}
596 : StmHeuristic{
597 std::move(loc), std::move(atom), std::move(body), std::move(weight), std::make_optional(std::move(prio)),
598 std::move(type)} {}
601 : StmHeuristic{std::move(loc), std::move(atom), std::move(body),
602 std::move(weight), std::nullopt, std::move(type)} {}
603
605 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
607 [[nodiscard]] auto atom() const -> Term const & { return atom_; }
609 [[nodiscard]] auto body() const -> BdLitArray const & { return body_; }
611 [[nodiscard]] auto weight() const -> Term const & { return weight_; }
613 [[nodiscard]] auto prio() const -> std::optional<Term> const & { return prio_; }
615 [[nodiscard]] auto type() const -> Term const & { return type_; }
616
617 private:
618 Location loc_;
619 Term atom_;
620 BdLitArray body_;
621 Term weight_;
622 std::optional<Term> prio_;
623 Term type_;
624};
625
629class StmScript : public Expression<StmScript> {
630 public:
632 static constexpr auto attributes() {
633 return std::tuple{a_loc = &StmScript::loc_, a_type = &StmScript::type, a_value = &StmScript::value};
634 }
635
637 explicit StmScript(Location loc, String type, String value) : loc_{std::move(loc)}, type_(type), value_(value) {}
638
640 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
642 [[nodiscard]] auto type() const -> String const & { return *type_; }
644 [[nodiscard]] auto value() const -> String const & { return *value_; }
645
646 private:
647 Location loc_;
648 SharedString type_;
649 SharedString value_;
650};
651
655enum class IncludeType : uint8_t {
656 system,
657 inbuild,
658};
659
663class StmInclude : public Expression<StmInclude> {
664 public:
666 static constexpr auto attributes() {
667 return std::tuple{a_loc = &StmInclude::loc_, a_type = &StmInclude::type_, a_value = &StmInclude::value};
668 }
669
672 : loc_{std::move(loc)}, type_(type), value_(value) {}
673
675 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
677 [[nodiscard]] auto type() const -> IncludeType { return type_; }
679 [[nodiscard]] auto value() const -> String const & { return *value_; }
680
681 private:
682 Location loc_;
683 IncludeType type_;
684 SharedString value_;
685};
686
690class StmProgram : public Expression<StmProgram> {
691 public:
693 static constexpr auto attributes() {
694 return std::tuple{a_loc = &StmProgram::loc_, a_name = &StmProgram::name, a_args = &StmProgram::args};
695 }
696
699 : loc_{std::move(loc)}, name_(name), args_{args.begin(), args.end()} {}
702 : loc_{std::move(loc)}, name_(name), args_{std::move(args)} {}
703
705 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
707 [[nodiscard]] auto name() const -> String const & { return *name_; }
709 [[nodiscard]] auto args() const -> StringSpan { return as_string_span(args_); }
710
711 private:
712 Location loc_;
713 SharedString name_;
714 SharedStringArray args_;
715};
716
720enum class Precedence : uint8_t {
721 default_,
722 override_
723};
724
728class StmConst : public Expression<StmConst> {
729 public:
731 static constexpr auto attributes() {
732 return std::tuple{a_loc = &StmConst::loc_, a_type = &StmConst::type_, a_name = &StmConst::name,
733 a_value = &StmConst::value_};
734 }
735
738 : loc_{std::move(loc)}, type_(type), name_(name), value_(std::move(value)) {}
739
741 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
743 [[nodiscard]] auto type() const -> Precedence const & { return type_; }
745 [[nodiscard]] auto name() const -> String const & { return *name_; }
747 [[nodiscard]] auto value() const -> Term const & { return value_; }
748
749 private:
750 Location loc_;
751 Precedence type_;
752 SharedString name_;
753 Term value_;
754};
755
759using ProgramParam = std::pair<SharedString, std::vector<SharedSymbol>>;
761using ProgramParamVec = std::vector<ProgramParam>;
762
766class StmParts : public Expression<StmParts> {
767 public:
769 static constexpr auto attributes() {
770 return std::tuple{a_loc = &StmParts::loc_, a_type = &StmParts::type_, a_elems = &StmParts::elems_};
771 }
772
775 : loc_{std::move(loc)}, type_(type), elems_(std::move(elems)) {}
776
778 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
780 [[nodiscard]] auto type() const -> Precedence const & { return type_; }
782 [[nodiscard]] auto elems() const -> ProgramParamVec const & { return elems_; }
783
784 private:
785 Location loc_;
786 Precedence type_;
787 ProgramParamVec elems_;
788};
789
793enum class CommentType : uint8_t {
794 line,
795 block,
796};
797
801class StmComment : public Expression<StmComment> {
802 public:
804 static constexpr auto attributes() {
805 return std::tuple{a_loc = &StmComment::loc_, a_type = &StmComment::type_, a_value = &StmComment::value};
806 }
807
810 : loc_{std::move(loc)}, type_{type}, value_{value} {}
811
813 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
815 [[nodiscard]] auto type() const -> CommentType { return type_; }
817 [[nodiscard]] auto value() const -> String const & { return *value_; }
818
819 private:
820 Location loc_;
821 CommentType type_;
822 SharedString value_;
823};
824
830using StmVec = std::vector<Stm>;
831
833
834} // namespace CppClingo::Input
An directed edge.
Definition statement.hh:531
Edge(Term src, Term dst)
Construct an edge.
Definition statement.hh:537
auto src() const -> Term const &
The source vertex.
Definition statement.hh:540
static constexpr auto attributes()
The record attributes.
Definition statement.hh:534
auto dst() const -> Term const &
The target vertex.
Definition statement.hh:542
A record that friend declares and defines comparison operators.
Definition attributes.hh:60
An optimize element.
Definition statement.hh:254
auto tuple() const -> OptimizeTuple const &
The weight.
Definition statement.hh:265
static constexpr auto attributes()
The record attributes.
Definition statement.hh:257
OptimizeElement(OptimizeTuple tuple, LitArray cond)
Construct an optimize element.
Definition statement.hh:262
auto cond() const -> LitArray const &
The condition.
Definition statement.hh:267
The tuple of a minimize element.
Definition statement.hh:228
OptimizeTuple(Term weight, std::optional< Term > priority, TermArray terms)
Construct an optimize tuple.
Definition statement.hh:237
auto prio() const -> std::optional< Term > const &
The optional priority.
Definition statement.hh:243
static constexpr auto attributes()
The record attributes.
Definition statement.hh:231
auto terms() const -> TermArray const &
The remaining terms.
Definition statement.hh:245
auto weight() const -> Term const &
The weight.
Definition statement.hh:241
A comment.
Definition statement.hh:801
auto type() const -> CommentType
The type of the comment.
Definition statement.hh:815
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:813
auto value() const -> String const &
The content of the comment including comment markers.
Definition statement.hh:817
StmComment(Location loc, CommentType type, String value)
Construct a comment.
Definition statement.hh:809
static constexpr auto attributes()
The record attributes.
Definition statement.hh:804
A const statement.
Definition statement.hh:728
auto type() const -> Precedence const &
The type of the statement.
Definition statement.hh:743
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:741
auto name() const -> String const &
The name of the constant.
Definition statement.hh:745
static constexpr auto attributes()
The record attributes.
Definition statement.hh:731
StmConst(Location loc, Precedence type, String name, Term value)
Construct a const statement.
Definition statement.hh:737
auto value() const -> Term const &
The value of the constant.
Definition statement.hh:747
A defined statement.
Definition statement.hh:468
static constexpr auto attributes()
The record attributes.
Definition statement.hh:471
auto sign() const -> bool
Whether the signature is negative.
Definition statement.hh:483
auto arity() const -> int
The arity.
Definition statement.hh:487
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:481
StmDefined(Location loc, bool sign, String name, int arity)
Construct a defined statement.
Definition statement.hh:477
auto name() const -> String const &
The name.
Definition statement.hh:485
An edge statement.
Definition statement.hh:554
StmEdge(Location loc, EdgeArray edges, BdLitArray body={})
Construct an edge statement.
Definition statement.hh:562
auto body() const -> BdLitArray const &
The body.
Definition statement.hh:570
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:566
auto edges() const -> EdgeArray const &
The pool of edges.
Definition statement.hh:568
static constexpr auto attributes()
The record attributes.
Definition statement.hh:557
An external statement.
Definition statement.hh:502
auto type() const -> std::optional< Term > const &
The type of the statement.
Definition statement.hh:521
auto atom() const -> Term const &
The term representing the atom to project.
Definition statement.hh:517
auto body() const -> BdLitArray const &
The body.
Definition statement.hh:519
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:515
static constexpr auto attributes()
The record attributes.
Definition statement.hh:505
StmExternal(Location loc, Term atom, BdLitArray body, std::optional< Term > type=std::nullopt)
Construct an external statement.
Definition statement.hh:511
A heuristic statement.
Definition statement.hh:581
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:605
auto weight() const -> Term const &
The weight.
Definition statement.hh:611
auto body() const -> BdLitArray const &
The body.
Definition statement.hh:609
StmHeuristic(Location loc, Term atom, BdLitArray body, Term weight, std::optional< Term > prio, Term type)
Construct a heuristic statement.
Definition statement.hh:591
auto type() const -> Term const &
The type of the heuristic modification.
Definition statement.hh:615
StmHeuristic(Location loc, Term atom, BdLitArray body, Term weight, Term prio, Term type)
Construct a heuristic statement.
Definition statement.hh:595
StmHeuristic(Location loc, Term atom, BdLitArray body, Term weight, Term type)
Construct a heuristic statement.
Definition statement.hh:600
auto prio() const -> std::optional< Term > const &
The optional priority.
Definition statement.hh:613
auto atom() const -> Term const &
The atom to modify.
Definition statement.hh:607
static constexpr auto attributes()
The record attributes.
Definition statement.hh:584
An include statement.
Definition statement.hh:663
static constexpr auto attributes()
The record attributes.
Definition statement.hh:666
auto type() const -> IncludeType
The include type.
Definition statement.hh:677
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:675
auto value() const -> String const &
The path.
Definition statement.hh:679
StmInclude(Location loc, IncludeType type, String value)
Construct an include statement.
Definition statement.hh:671
An optimization statement.
Definition statement.hh:279
StmOptimize(Location loc, OptimizeType type, OptimizeElementArray elems)
Construct a weak constraint.
Definition statement.hh:287
auto type() const -> OptimizeType
The type of the statement.
Definition statement.hh:293
auto elems() const -> OptimizeElementArray const &
The elements of the statement.
Definition statement.hh:295
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:291
static constexpr auto attributes()
The record attributes.
Definition statement.hh:282
A parts statement.
Definition statement.hh:766
auto type() const -> Precedence const &
The type of the statement.
Definition statement.hh:780
auto elems() const -> ProgramParamVec const &
The program parts to ground and solve.
Definition statement.hh:782
StmParts(Location loc, Precedence type, ProgramParamVec elems)
Construct a const statement.
Definition statement.hh:774
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:778
static constexpr auto attributes()
The record attributes.
Definition statement.hh:769
A program statement.
Definition statement.hh:690
static constexpr auto attributes()
The record attributes.
Definition statement.hh:693
auto args() const -> StringSpan
The arguments of the program.
Definition statement.hh:709
auto name() const -> String const &
The name of the program.
Definition statement.hh:707
StmProgram(Location loc, String name, StringSpan args)
Construct an program statement.
Definition statement.hh:698
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:705
StmProgram(Location loc, String name, SharedStringArray args)
Construct an program statement.
Definition statement.hh:701
A project signature statement.
Definition statement.hh:437
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:450
StmProjectSig(Location loc, bool sign, String name, int arity)
Construct a project signature statement.
Definition statement.hh:446
static constexpr auto attributes()
The record attributes.
Definition statement.hh:440
auto name() const -> String const &
The name.
Definition statement.hh:454
auto arity() const -> int
The arity.
Definition statement.hh:456
auto sign() const -> bool
Whether the signature is negative.
Definition statement.hh:452
A project statement.
Definition statement.hh:410
auto body() const -> BdLitArray const &
The body.
Definition statement.hh:426
static constexpr auto attributes()
The record attributes.
Definition statement.hh:413
auto atom() const -> Term const &
The term representing the atom to project.
Definition statement.hh:424
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:422
StmProject(Location loc, Term atom, BdLitArray body)
Construct a project statement.
Definition statement.hh:418
A rule.
Definition statement.hh:16
auto loc() const -> Location const &
The location of the rule.
Definition statement.hh:28
static constexpr auto attributes()
The record attributes.
Definition statement.hh:19
auto head() const -> HdLit const &
The head.
Definition statement.hh:30
StmRule(Location loc, HdLit head, BdLitArray body)
Construct a rule.
Definition statement.hh:24
auto body() const -> BdLitArray const &
The body.
Definition statement.hh:32
A script statement.
Definition statement.hh:629
auto type() const -> String const &
The code type.
Definition statement.hh:642
StmScript(Location loc, String type, String value)
Construct a script statement.
Definition statement.hh:637
auto value() const -> String const &
The code.
Definition statement.hh:644
static constexpr auto attributes()
The record attributes.
Definition statement.hh:632
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:640
A show signature statement.
Definition statement.hh:392
StmShowNothing(Location loc)
Construct the show statement.
Definition statement.hh:398
static constexpr auto attributes()
The record attributes.
Definition statement.hh:395
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:401
A show signature statement.
Definition statement.hh:361
auto name() const -> String const &
The name.
Definition statement.hh:378
static constexpr auto attributes()
The record attributes.
Definition statement.hh:364
auto arity() const -> int
The arity.
Definition statement.hh:380
StmShowSig(Location loc, bool sign, String name, int arity)
Construct a show signature statement.
Definition statement.hh:370
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:374
auto sign() const -> bool
Whether the signature is negative.
Definition statement.hh:376
A show statement.
Definition statement.hh:334
static constexpr auto attributes()
The record attributes.
Definition statement.hh:337
StmShow(Location loc, Term term, BdLitArray body)
Construct a show statement.
Definition statement.hh:342
auto body() const -> BdLitArray const &
The body.
Definition statement.hh:350
auto term() const -> Term const &
The term to show.
Definition statement.hh:348
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:346
A theory definition.
Definition statement.hh:193
StmTheory(Location loc, String name, TheoryTermDefinitionArray term_defs, TheoryAtomDefinitionArray atom_defs)
Construct a theory definition.
Definition statement.hh:202
static constexpr auto attributes()
The record attributes.
Definition statement.hh:196
auto term_defs() const -> TheoryTermDefinitionArray const &
The theory term definitions.
Definition statement.hh:211
auto atom_defs() const -> TheoryAtomDefinitionArray const &
The theory atom definitions.
Definition statement.hh:213
auto name() const -> String const &
The name of the definition.
Definition statement.hh:209
auto loc() const -> Location const &
The location of the definition.
Definition statement.hh:207
A weak constraint.
Definition statement.hh:306
StmWeakConstraint(Location loc, BdLitArray body, OptimizeTuple tuple)
Construct a weak constraint.
Definition statement.hh:315
auto tuple() const -> OptimizeTuple const &
The tuple of the constraint.
Definition statement.hh:323
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:319
static constexpr auto attributes()
The record attributes.
Definition statement.hh:309
auto body() const -> BdLitArray const &
The body of the constraint.
Definition statement.hh:321
A theory atom definition.
Definition statement.hh:151
auto term() const -> String const &
The name of the term definition used in elements.
Definition statement.hh:172
auto name() const -> String const &
The name of the atom.
Definition statement.hh:168
TheoryAtomDefinition(Location loc, String name, int arity, String term, std::optional< TheoryRGuardDefinition > rhs, TheoryAtomType type)
Construct a theory atom definition.
Definition statement.hh:161
auto rhs() const -> std::optional< TheoryRGuardDefinition > const &
The definition for the right hand side of the atom.
Definition statement.hh:174
auto arity() const -> int
The arity of the atom.
Definition statement.hh:170
static constexpr auto attributes()
The record attributes.
Definition statement.hh:154
auto type() const -> TheoryAtomType
The type of the atom.
Definition statement.hh:176
auto loc() const -> Location const &
The location of the definition.
Definition statement.hh:166
A theory operator definition.
Definition statement.hh:52
auto prio() const -> int
The priority of the operator.
Definition statement.hh:69
auto loc() const -> Location const &
The location of the definition.
Definition statement.hh:65
static constexpr auto attributes()
The record attributes.
Definition statement.hh:55
auto op() const -> String const &
The representation of the operator.
Definition statement.hh:67
TheoryOpDefinition(Location loc, String op, int prio, TheoryOpType type)
Construct a theory operator definition.
Definition statement.hh:61
auto type() const -> TheoryOpType
The type of the operator.
Definition statement.hh:71
An optional definition for the right-hand-side of a theory atom.
Definition statement.hh:127
static constexpr auto attributes()
The record attributes.
Definition statement.hh:130
TheoryRGuardDefinition(StringSpan ops, String term)
Construct a right guard definition.
Definition statement.hh:134
TheoryRGuardDefinition(SharedStringArray ops, String term)
Construct a right guard definition.
Definition statement.hh:136
auto ops() const -> StringSpan
The list of operator names.
Definition statement.hh:139
auto term() const -> String const &
The name of the term definition.
Definition statement.hh:141
A theory term definition.
Definition statement.hh:86
auto op_defs() const -> TheoryOpDefinitionArray const &
The associated operator definitions.
Definition statement.hh:103
auto loc() const -> Location const &
The location of the definition.
Definition statement.hh:99
static constexpr auto attributes()
The record attributes.
Definition statement.hh:89
TheoryTermDefinition(Location loc, String name, TheoryOpDefinitionArray op_defs)
Construct a theory term definition.
Definition statement.hh:95
auto name() const -> String const &
The name of the definition.
Definition statement.hh:101
The Location of an expression in an input source.
Definition location.hh:44
Class managing the lifetime of a String.
Definition symbol.hh:93
Reference to a string stored in a symbol store.
Definition symbol.hh:18
auto as_string_span(T const &vec) -> StringSpan
Convert a collection of shared strings into a string span.
Definition symbol.hh:196
std::span< String const > StringSpan
A span of strings.
Definition symbol.hh:87
std::variant< HdLitSimple, HdLitDisjunction, HdLitAggregate, HdLitSetAggregate, HdLitTheoryAtom > HdLit
A head literal.
Definition head_literal.hh:130
constexpr auto a_edges
Definition attributes.hh:22
constexpr auto a_sign
Definition attributes.hh:37
constexpr auto a_elems
Definition attributes.hh:23
constexpr auto a_prio
Definition attributes.hh:35
constexpr auto a_cond
Definition attributes.hh:20
constexpr auto a_atom_defs
Definition attributes.hh:17
constexpr auto a_ops
Definition attributes.hh:33
constexpr auto a_args
Definition attributes.hh:15
constexpr auto a_dst
Definition attributes.hh:21
constexpr auto a_term_defs
Definition attributes.hh:39
constexpr auto a_op_defs
Definition attributes.hh:31
constexpr auto a_name
Definition attributes.hh:30
constexpr auto a_terms
Definition attributes.hh:40
constexpr auto a_head
Definition attributes.hh:26
constexpr auto a_src
Definition attributes.hh:38
constexpr auto a_rhs
Definition attributes.hh:36
constexpr auto a_tuple
Definition attributes.hh:42
constexpr auto a_weight
Definition attributes.hh:45
constexpr auto a_arity
Definition attributes.hh:16
constexpr auto a_type
Definition attributes.hh:43
constexpr auto a_loc
Definition attributes.hh:29
constexpr auto a_op
Definition attributes.hh:32
constexpr auto a_body
Definition attributes.hh:19
constexpr auto a_term
Definition attributes.hh:41
constexpr auto a_value
Definition attributes.hh:44
constexpr auto a_atom
Definition attributes.hh:18
std::vector< ProgramParam > ProgramParamVec
A list of program params.
Definition statement.hh:761
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
Precedence
Enumeration of constant statement types.
Definition statement.hh:720
TheoryAtomType
Enumeration of theory atom types.
Definition statement.hh:117
IncludeType
Enumeration of include types.
Definition statement.hh:655
OptimizeType
Enumeration of optimization statement types.
Definition statement.hh:225
std::vector< Stm > StmVec
A vector of statements.
Definition statement.hh:830
std::pair< SharedString, std::vector< SharedSymbol > > ProgramParam
Concrete symbols for a program statement.
Definition statement.hh:759
CommentType
Enumeration of comment types.
Definition statement.hh:793
TheoryOpType
The type of a theory operator.
Definition statement.hh:43
@ override_
A statement providing default value.
@ any
A theory atom that can appear only in the head and a body.
@ body
A theory atom that can appear only in the body.
@ head
A theory atom that can appear only in the head.
@ directive
A theory atom that can appear only in the head with an empty body.
@ unary
An unary theory operator.
@ binary_left
An binary left associative theory operator.
@ binary_right
An binary right associative theory operator.
std::variant< TermVariable, TermSymbol, TermTuple, TermFunction, TermAbs, TermUnary, TermBinary > Term
Variant holding the different term types.
Definition term.hh:45