69virtual char const *
what() const noexcept {
228 const std::vector<value_type> ¶ms)
const {
230 "This semiring does not support rv gates: a continuous "
231 "distribution is not a semiring value. Query a "
232 "random-variable token through the measure surface "
233 "(expected / variance / quantile / support / sample), or use "
234 "the formula pseudo-semiring for a symbolic rendering.");
249 const std::vector<value_type> &children,
250 const std::string &extra)
const {
252 "This semiring does not support arith gates: arithmetic over "
253 "scalar (random-variable) children is not a semiring "
254 "operation. Query such a token through the measure surface "
255 "(expected / variance / quantile / support / sample), or use "
256 "the formula pseudo-semiring for a symbolic rendering.");
269 "This semiring does not support mixture gates: a probabilistic "
270 "mixture is not a semiring operation. Query such a token "
271 "through the measure surface (expected / variance / quantile / "
272 "support / sample), or use the formula pseudo-semiring for a "
273 "symbolic rendering.");
286 const std::vector<double> &probs,
287 const std::vector<std::string> &outcomes)
const {
289 "This semiring does not support categorical mixture gates: a "
290 "distribution over outcomes is not a semiring value. Query "
291 "such a token through the measure surface (expected / "
292 "variance / quantile / support / sample), or use the formula "
293 "pseudo-semiring for a symbolic rendering.");
306 "The requested semiring does not support a CASE / guarded "
307 "selection over random variables (gate_case): it is evaluable "
308 "only through the random-variable / measure surface "
309 "(expected / variance / support / probability / sample).");
321 "This semiring does not support observe gates: the density "
322 "factor of a likelihood-weighting observation is not a "
323 "semiring value. Such a token is evaluated by the "
324 "importance-sampling surface, or rendered symbolically by the "
325 "formula pseudo-semiring.");
339 "The requested semiring does not support conditioning: "
340 "P(·|C) = P(·∧C)/P(C) needs a normalising division "
341 "no general semiring provides. A conditioned token is "
342 "evaluable only in the measure interpretation "
343 "(probability_evaluate, or the random-variable / agg_token "
344 "distribution evaluators).");
430 const std::vector<value_type> &,
431 const std::vector<value_type> &)
const {
442 const std::vector<value_type> &)
const {
Typed aggregation value, operator, and aggregator abstractions.
AggregationOperator
SQL aggregation functions tracked by ProvSQL.
ComparisonOperator
SQL comparison operators used in gate_cmp circuit gates.
ArithmeticOperator
Arithmetic operations carried by gate_arith circuit gates.
Exception thrown when a semiring operation is not supported.
std::string message
Human-readable description of the error.
virtual char const * what() const noexcept
Return the error message as a C-string.
SemiringException(const std::string &m)
Construct with a descriptive error message.
Abstract base class for (m-)semirings.
V value_type
The carrier type of this semiring.
virtual value_type semimod(value_type x, value_type s) const
Apply a semimodule scalar multiplication.
virtual value_type plus(const std::vector< value_type > &v) const =0
Apply the additive operation to a list of values.
virtual value_type mixture(value_type p, value_type x, value_type y) const
Evaluate a Bernoulli mixture (gate_mixture, three wires).
virtual bool absorptive() const
Return true if this semiring is absorptive ( for all ).
virtual bool certifying() const
Whether this semiring builds certified exclusive enumerations (see the three hooks below).
virtual ~Semiring()=default
virtual bool compatibleWithBooleanRewrite() const
Return true if a semiring homomorphism BoolFunc(X) →+* S exists, so the safe-query (Boolean-rewrite) ...
virtual value_type zero() const =0
Return the additive identity .
virtual value_type guarded_case(const std::vector< value_type > &children) const
Evaluate a guarded selection (gate_case).
virtual value_type cmp(value_type s1, ComparisonOperator op, value_type s2) const
Evaluate a comparison gate.
virtual value_type agg(AggregationOperator op, const std::vector< value_type > &s)
Evaluate an aggregation gate.
virtual value_type conditioned(const std::vector< value_type > &children) const
Evaluate a conditioning marker (gate_conditioned).
virtual value_type arith(ArithmeticOperator op, const std::vector< value_type > &children, const std::string &extra) const
Evaluate an arithmetic gate over scalar children (gate_arith).
virtual value_type certified_world_term(const std::vector< value_type > &, const std::vector< value_type > &) const
Build one complete world term: the conjunction of the present literals and the negations of the missi...
virtual value_type unmapped_input(const std::string &uuid) const
Value of a variable leaf (gate_input / gate_mulinput) that the provenance mapping does not name.
virtual value_type one() const =0
Return the multiplicative identity .
virtual value_type monus(value_type x, value_type y) const =0
Apply the monus (m-semiring difference) operation.
virtual value_type rv(const std::string &spec, const std::vector< value_type > ¶ms) const
Evaluate a continuous random-variable leaf (gate_rv).
virtual value_type certified_exclusive_plus(const std::vector< value_type > &) const
Build the disjunction of pairwise-exclusive disjuncts, certified deterministic.
virtual value_type delta(value_type x) const =0
Apply the operator.
virtual value_type times(const std::vector< value_type > &v) const =0
Apply the multiplicative operation to a list of values.
virtual value_type observe(value_type child, const std::string &datum) const
Evaluate a latent-variable observation (gate_observe).
virtual value_type categorical(value_type key, const std::vector< double > &probs, const std::vector< std::string > &outcomes) const
Evaluate a categorical mixture (gate_mixture over gate_mulinput outcomes).
virtual bool independent_literal(const value_type &) const
Whether v is an independent literal for certification purposes: a base Bernoulli variable (or a const...
virtual value_type value(const std::string &s) const
Interpret a literal string as a semiring value.