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_, a_value = &StmShowSig::value_};
367 }
368
370 explicit StmShowSig(Location loc, bool sign, String name, int arity, bool value)
371 : loc_{std::move(loc)}, name_{name}, arity_{arity}, sign_{sign}, value_{value} {}
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_; }
382 [[nodiscard]] auto value() const -> bool { return value_; }
383
384 private:
385 Location loc_;
386 SharedString name_;
387 int arity_;
388 bool sign_;
389 bool value_;
390};
391
395class StmShowNothing : public Expression<StmShowNothing> {
396 public:
398 static constexpr auto attributes() { return std::tuple{a_loc = &StmShowNothing::loc_}; }
399
401 explicit StmShowNothing(Location loc) : loc_{std::move(loc)} {}
402
404 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
405
406 private:
407 Location loc_;
408};
409
413class StmProject : public Expression<StmProject> {
414 public:
416 static constexpr auto attributes() {
417 return std::tuple{a_loc = &StmProject::loc_, a_atom = &StmProject::atom_, a_body = &StmProject::body_};
418 }
419
422 : loc_{std::move(loc)}, atom_(std::move(atom)), body_(std::move(body)) {}
423
425 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
427 [[nodiscard]] auto atom() const -> Term const & { return atom_; }
429 [[nodiscard]] auto body() const -> BdLitArray const & { return body_; }
430
431 private:
432 Location loc_;
433 Term atom_;
434 BdLitArray body_;
435};
436
440class StmProjectSig : public Expression<StmProjectSig> {
441 public:
443 static constexpr auto attributes() {
444 return std::tuple{a_loc = &StmProjectSig::loc_, a_name = &StmProjectSig::name, a_sign = &StmProjectSig::sign_,
445 a_arity = &StmProjectSig::arity_};
446 }
447
450 : loc_{std::move(loc)}, sign_{sign}, name_{name}, arity_{arity} {}
451
453 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
455 [[nodiscard]] auto sign() const -> bool { return sign_; }
457 [[nodiscard]] auto name() const -> String const & { return *name_; }
459 [[nodiscard]] auto arity() const -> int { return arity_; }
460
461 private:
462 Location loc_;
463 bool sign_;
464 SharedString name_;
465 int arity_;
466};
467
471class StmDefined : public Expression<StmDefined> {
472 public:
474 static constexpr auto attributes() {
475 return std::tuple{a_loc = &StmDefined::loc_, a_name = &StmDefined::name, a_sign = &StmDefined::sign_,
476 a_arity = &StmDefined::arity_};
477 }
478
481 : loc_{std::move(loc)}, sign_{sign}, name_{name}, arity_{arity} {}
482
484 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
486 [[nodiscard]] auto sign() const -> bool { return sign_; }
488 [[nodiscard]] auto name() const -> String const & { return *name_; }
490 [[nodiscard]] auto arity() const -> int { return arity_; }
491
492 private:
493 Location loc_;
495 bool sign_;
497 SharedString name_;
499 int arity_;
500};
501
505class StmExternal : public Expression<StmExternal> {
506 public:
508 static constexpr auto attributes() {
509 return std::tuple{a_loc = &StmExternal::loc_, a_atom = &StmExternal::atom_, a_body = &StmExternal::body_,
510 a_type = &StmExternal::type_};
511 }
512
514 explicit StmExternal(Location loc, Term atom, BdLitArray body, std::optional<Term> type = std::nullopt)
515 : loc_{std::move(loc)}, atom_(std::move(atom)), body_(std::move(body)), type_{std::move(type)} {}
516
518 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
520 [[nodiscard]] auto atom() const -> Term const & { return atom_; }
522 [[nodiscard]] auto body() const -> BdLitArray const & { return body_; }
524 [[nodiscard]] auto type() const -> std::optional<Term> const & { return type_; }
525
526 private:
527 Location loc_;
528 Term atom_;
529 BdLitArray body_;
530 std::optional<Term> type_;
531};
532
534class Edge : public Expression<Edge> {
535 public:
537 static constexpr auto attributes() { return std::tuple{a_src = &Edge::src_, a_dst = &Edge::dst_}; }
538
540 explicit Edge(Term src, Term dst) : src_{std::move(src)}, dst_{std::move(dst)} {}
541
543 [[nodiscard]] auto src() const -> Term const & { return src_; }
545 [[nodiscard]] auto dst() const -> Term const & { return dst_; }
546
547 private:
548 Term src_;
549 Term dst_;
550};
553
557class StmEdge : public Expression<StmEdge> {
558 public:
560 static constexpr auto attributes() {
561 return std::tuple{a_loc = &StmEdge::loc_, a_edges = &StmEdge::edges_, a_body = &StmEdge::body_};
562 }
563
566 : loc_{std::move(loc)}, edges_{std::move(edges)}, body_{std::move(body)} {}
567
569 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
571 [[nodiscard]] auto edges() const -> EdgeArray const & { return edges_; }
573 [[nodiscard]] auto body() const -> BdLitArray const & { return body_; }
574
575 private:
576 Location loc_;
577 EdgeArray edges_;
578 BdLitArray body_;
579};
580
584class StmHeuristic : public Expression<StmHeuristic> {
585 public:
587 static constexpr auto attributes() {
588 return std::tuple{a_loc = &StmHeuristic::loc_, a_atom = &StmHeuristic::atom_,
589 a_body = &StmHeuristic::body_, a_weight = &StmHeuristic::weight_,
590 a_prio = &StmHeuristic::prio_, a_type = &StmHeuristic::type_};
591 }
592
595 : loc_{std::move(loc)}, atom_{std::move(atom)}, body_{std::move(body)}, weight_(std::move(weight)),
596 prio_(std::move(prio)), type_(std::move(type)) {}
599 : StmHeuristic{
600 std::move(loc), std::move(atom), std::move(body), std::move(weight), std::make_optional(std::move(prio)),
601 std::move(type)} {}
604 : StmHeuristic{std::move(loc), std::move(atom), std::move(body),
605 std::move(weight), std::nullopt, std::move(type)} {}
606
608 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
610 [[nodiscard]] auto atom() const -> Term const & { return atom_; }
612 [[nodiscard]] auto body() const -> BdLitArray const & { return body_; }
614 [[nodiscard]] auto weight() const -> Term const & { return weight_; }
616 [[nodiscard]] auto prio() const -> std::optional<Term> const & { return prio_; }
618 [[nodiscard]] auto type() const -> Term const & { return type_; }
619
620 private:
621 Location loc_;
622 Term atom_;
623 BdLitArray body_;
624 Term weight_;
625 std::optional<Term> prio_;
626 Term type_;
627};
628
632class StmScript : public Expression<StmScript> {
633 public:
635 static constexpr auto attributes() {
636 return std::tuple{a_loc = &StmScript::loc_, a_type = &StmScript::type, a_value = &StmScript::value};
637 }
638
640 explicit StmScript(Location loc, String type, String value) : loc_{std::move(loc)}, type_(type), value_(value) {}
641
643 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
645 [[nodiscard]] auto type() const -> String const & { return *type_; }
647 [[nodiscard]] auto value() const -> String const & { return *value_; }
648
649 private:
650 Location loc_;
651 SharedString type_;
652 SharedString value_;
653};
654
658enum class IncludeType : uint8_t {
659 system,
660 inbuild,
661};
662
666class StmInclude : public Expression<StmInclude> {
667 public:
669 static constexpr auto attributes() {
670 return std::tuple{a_loc = &StmInclude::loc_, a_type = &StmInclude::type_, a_value = &StmInclude::value};
671 }
672
675 : loc_{std::move(loc)}, type_(type), value_(value) {}
676
678 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
680 [[nodiscard]] auto type() const -> IncludeType { return type_; }
682 [[nodiscard]] auto value() const -> String const & { return *value_; }
683
684 private:
685 Location loc_;
686 IncludeType type_;
687 SharedString value_;
688};
689
693class StmProgram : public Expression<StmProgram> {
694 public:
696 static constexpr auto attributes() {
697 return std::tuple{a_loc = &StmProgram::loc_, a_name = &StmProgram::name, a_args = &StmProgram::args};
698 }
699
702 : loc_{std::move(loc)}, name_(name), args_{args.begin(), args.end()} {}
705 : loc_{std::move(loc)}, name_(name), args_{std::move(args)} {}
706
708 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
710 [[nodiscard]] auto name() const -> String const & { return *name_; }
712 [[nodiscard]] auto args() const -> StringSpan { return as_string_span(args_); }
713
714 private:
715 Location loc_;
716 SharedString name_;
717 SharedStringArray args_;
718};
719
723enum class Precedence : uint8_t {
724 default_,
725 override_
726};
727
731class StmConst : public Expression<StmConst> {
732 public:
734 static constexpr auto attributes() {
735 return std::tuple{a_loc = &StmConst::loc_, a_type = &StmConst::type_, a_name = &StmConst::name,
736 a_value = &StmConst::value_};
737 }
738
741 : loc_{std::move(loc)}, type_(type), name_(name), value_(std::move(value)) {}
742
744 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
746 [[nodiscard]] auto type() const -> Precedence const & { return type_; }
748 [[nodiscard]] auto name() const -> String const & { return *name_; }
750 [[nodiscard]] auto value() const -> Term const & { return value_; }
751
752 private:
753 Location loc_;
754 Precedence type_;
755 SharedString name_;
756 Term value_;
757};
758
762using ProgramParam = std::pair<SharedString, std::vector<SharedSymbol>>;
764using ProgramParamVec = std::vector<ProgramParam>;
765
769class StmParts : public Expression<StmParts> {
770 public:
772 static constexpr auto attributes() {
773 return std::tuple{a_loc = &StmParts::loc_, a_type = &StmParts::type_, a_elems = &StmParts::elems_};
774 }
775
778 : loc_{std::move(loc)}, type_(type), elems_(std::move(elems)) {}
779
781 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
783 [[nodiscard]] auto type() const -> Precedence const & { return type_; }
785 [[nodiscard]] auto elems() const -> ProgramParamVec const & { return elems_; }
786
787 private:
788 Location loc_;
789 Precedence type_;
790 ProgramParamVec elems_;
791};
792
796enum class CommentType : uint8_t {
797 line,
798 block,
799};
800
804class StmComment : public Expression<StmComment> {
805 public:
807 static constexpr auto attributes() {
808 return std::tuple{a_loc = &StmComment::loc_, a_type = &StmComment::type_, a_value = &StmComment::value};
809 }
810
813 : loc_{std::move(loc)}, type_{type}, value_{value} {}
814
816 [[nodiscard]] auto loc() const -> Location const & { return loc_; }
818 [[nodiscard]] auto type() const -> CommentType { return type_; }
820 [[nodiscard]] auto value() const -> String const & { return *value_; }
821
822 private:
823 Location loc_;
824 CommentType type_;
825 SharedString value_;
826};
827
833using StmVec = std::vector<Stm>;
834
836
837} // namespace CppClingo::Input
An directed edge.
Definition statement.hh:534
Edge(Term src, Term dst)
Construct an edge.
Definition statement.hh:540
auto src() const -> Term const &
The source vertex.
Definition statement.hh:543
static constexpr auto attributes()
The record attributes.
Definition statement.hh:537
auto dst() const -> Term const &
The target vertex.
Definition statement.hh:545
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:804
auto type() const -> CommentType
The type of the comment.
Definition statement.hh:818
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:816
auto value() const -> String const &
The content of the comment including comment markers.
Definition statement.hh:820
StmComment(Location loc, CommentType type, String value)
Construct a comment.
Definition statement.hh:812
static constexpr auto attributes()
The record attributes.
Definition statement.hh:807
A const statement.
Definition statement.hh:731
auto type() const -> Precedence const &
The type of the statement.
Definition statement.hh:746
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:744
auto name() const -> String const &
The name of the constant.
Definition statement.hh:748
static constexpr auto attributes()
The record attributes.
Definition statement.hh:734
StmConst(Location loc, Precedence type, String name, Term value)
Construct a const statement.
Definition statement.hh:740
auto value() const -> Term const &
The value of the constant.
Definition statement.hh:750
A defined statement.
Definition statement.hh:471
static constexpr auto attributes()
The record attributes.
Definition statement.hh:474
auto sign() const -> bool
Whether the signature is negative.
Definition statement.hh:486
auto arity() const -> int
The arity.
Definition statement.hh:490
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:484
StmDefined(Location loc, bool sign, String name, int arity)
Construct a defined statement.
Definition statement.hh:480
auto name() const -> String const &
The name.
Definition statement.hh:488
An edge statement.
Definition statement.hh:557
StmEdge(Location loc, EdgeArray edges, BdLitArray body={})
Construct an edge statement.
Definition statement.hh:565
auto body() const -> BdLitArray const &
The body.
Definition statement.hh:573
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:569
auto edges() const -> EdgeArray const &
The pool of edges.
Definition statement.hh:571
static constexpr auto attributes()
The record attributes.
Definition statement.hh:560
An external statement.
Definition statement.hh:505
auto type() const -> std::optional< Term > const &
The type of the statement.
Definition statement.hh:524
auto atom() const -> Term const &
The term representing the atom to project.
Definition statement.hh:520
auto body() const -> BdLitArray const &
The body.
Definition statement.hh:522
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:518
static constexpr auto attributes()
The record attributes.
Definition statement.hh:508
StmExternal(Location loc, Term atom, BdLitArray body, std::optional< Term > type=std::nullopt)
Construct an external statement.
Definition statement.hh:514
A heuristic statement.
Definition statement.hh:584
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:608
auto weight() const -> Term const &
The weight.
Definition statement.hh:614
auto body() const -> BdLitArray const &
The body.
Definition statement.hh:612
StmHeuristic(Location loc, Term atom, BdLitArray body, Term weight, std::optional< Term > prio, Term type)
Construct a heuristic statement.
Definition statement.hh:594
auto type() const -> Term const &
The type of the heuristic modification.
Definition statement.hh:618
StmHeuristic(Location loc, Term atom, BdLitArray body, Term weight, Term prio, Term type)
Construct a heuristic statement.
Definition statement.hh:598
StmHeuristic(Location loc, Term atom, BdLitArray body, Term weight, Term type)
Construct a heuristic statement.
Definition statement.hh:603
auto prio() const -> std::optional< Term > const &
The optional priority.
Definition statement.hh:616
auto atom() const -> Term const &
The atom to modify.
Definition statement.hh:610
static constexpr auto attributes()
The record attributes.
Definition statement.hh:587
An include statement.
Definition statement.hh:666
static constexpr auto attributes()
The record attributes.
Definition statement.hh:669
auto type() const -> IncludeType
The include type.
Definition statement.hh:680
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:678
auto value() const -> String const &
The path.
Definition statement.hh:682
StmInclude(Location loc, IncludeType type, String value)
Construct an include statement.
Definition statement.hh:674
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:769
auto type() const -> Precedence const &
The type of the statement.
Definition statement.hh:783
auto elems() const -> ProgramParamVec const &
The program parts to ground and solve.
Definition statement.hh:785
StmParts(Location loc, Precedence type, ProgramParamVec elems)
Construct a const statement.
Definition statement.hh:777
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:781
static constexpr auto attributes()
The record attributes.
Definition statement.hh:772
A program statement.
Definition statement.hh:693
static constexpr auto attributes()
The record attributes.
Definition statement.hh:696
auto args() const -> StringSpan
The arguments of the program.
Definition statement.hh:712
auto name() const -> String const &
The name of the program.
Definition statement.hh:710
StmProgram(Location loc, String name, StringSpan args)
Construct an program statement.
Definition statement.hh:701
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:708
StmProgram(Location loc, String name, SharedStringArray args)
Construct an program statement.
Definition statement.hh:704
A project signature statement.
Definition statement.hh:440
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:453
StmProjectSig(Location loc, bool sign, String name, int arity)
Construct a project signature statement.
Definition statement.hh:449
static constexpr auto attributes()
The record attributes.
Definition statement.hh:443
auto name() const -> String const &
The name.
Definition statement.hh:457
auto arity() const -> int
The arity.
Definition statement.hh:459
auto sign() const -> bool
Whether the signature is negative.
Definition statement.hh:455
A project statement.
Definition statement.hh:413
auto body() const -> BdLitArray const &
The body.
Definition statement.hh:429
static constexpr auto attributes()
The record attributes.
Definition statement.hh:416
auto atom() const -> Term const &
The term representing the atom to project.
Definition statement.hh:427
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:425
StmProject(Location loc, Term atom, BdLitArray body)
Construct a project statement.
Definition statement.hh:421
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:632
auto type() const -> String const &
The code type.
Definition statement.hh:645
StmScript(Location loc, String type, String value)
Construct a script statement.
Definition statement.hh:640
auto value() const -> String const &
The code.
Definition statement.hh:647
static constexpr auto attributes()
The record attributes.
Definition statement.hh:635
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:643
A show signature statement.
Definition statement.hh:395
StmShowNothing(Location loc)
Construct the show statement.
Definition statement.hh:401
static constexpr auto attributes()
The record attributes.
Definition statement.hh:398
auto loc() const -> Location const &
The location of the statement.
Definition statement.hh:404
A show signature statement.
Definition statement.hh:361
auto name() const -> String const &
The name.
Definition statement.hh:378
auto value() const -> bool
The value.
Definition statement.hh:382
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, bool value)
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:764
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:831
Precedence
Enumeration of constant statement types.
Definition statement.hh:723
TheoryAtomType
Enumeration of theory atom types.
Definition statement.hh:117
IncludeType
Enumeration of include types.
Definition statement.hh:658
OptimizeType
Enumeration of optimization statement types.
Definition statement.hh:225
std::vector< Stm > StmVec
A vector of statements.
Definition statement.hh:833
std::pair< SharedString, std::vector< SharedSymbol > > ProgramParam
Concrete symbols for a program statement.
Definition statement.hh:762
CommentType
Enumeration of comment types.
Definition statement.hh:796
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, TermFormatString > Term
Variant holding the different term types.
Definition term.hh:48