Clingo
Loading...
Searching...
No Matches
dependency.hh
1#pragma once
2
3#include <clingo/input/program.hh>
4
5#include <clingo/util/enum.hh>
6#include <clingo/util/ordered_map.hh>
7
8namespace CppClingo::Input {
9
12
13// examples:
14// - h :- a : b, not c; d; not e.
15// - depend:
16// - positive: a, d
17// - negative: b, c, e
18// - provide: h
19// - h :- { a; b } >= 1.
20// - depend:
21// - positive: a, b
22// - provide: h
23// - h :- { a; b } <= 1.
24// - depend:
25// - negative: a, b
26// - provide: h
27// - h :- { a; b } != 1.
28// - depend:
29// - positive: a, b
30// - negative: a, b
31// - provide: h
32// - {h} :- a.
33// - depend:
34// - positive: a
35// - negative: h
36// - provide: h
37// - g | h :- a.
38// - depend:
39// - positive: a
40// - negative: g, h
41// - provide: g, h
42
43// graph:
44// - n: number of statements
45// - m: number of atoms in depends
46// - nodes: [0,n) + [n,n+m)
47// - statement depends on atoms occurring in it (either positively or negatively)
48// - component graph uses both dependencies
49// - refined component graph only considers positive ones
50
52auto analyze(SymbolStore &store, std::vector<Stm> const &stms) -> Components;
53
56
62auto unify(SymbolStore &store, Term const &a, Term const &b) -> bool;
63
67void visualize(Components const &comps, std::ostream &out);
68
70
71} // namespace CppClingo::Input
A store for symbols.
Definition symbol.hh:454
std::vector< std::vector< Component > > Components
The list of components in groundable order.
Definition program.hh:110
auto unify(SymbolStore &store, Term const &a, Term const &b) -> bool
Try to unify the two terms.
void visualize(Components const &comps, std::ostream &out)
Output components in the dot language for visualization.
auto analyze(SymbolStore &store, std::vector< Stm > const &stms) -> Components
Analyze the given statements organizing them in components for grounding.
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
std::variant< TermVariable, TermSymbol, TermTuple, TermFunction, TermAbs, TermUnary, TermBinary > Term
Variant holding the different term types.
Definition term.hh:45
Util::ordered_set< SharedSig > SharedSigSet
A set of predicate signatures.
Definition term.hh:42
tsl::ordered_map< Key, T, Hash, KeyEqual, Allocator, ValueTypeContainer, IndexType > ordered_map
Alias for ordered maps.
Definition ordered_map.hh:16