62 for (
const auto &v : vec) {
63 result.insert(v.begin(), v.end());
70 if (vec.empty())
return one();
73 for (
size_t i = 1; i < vec.size(); ++i) {
75 for (
const auto &s1 : result) {
76 for (
const auto &s2 : vec[i]) {
78 combined.insert(s2.begin(), s2.end());
79 temp.insert(std::move(combined));
82 result = std::move(temp);
89 for (
auto const &s : y) {
96 return x.empty() ?
zero() : x;
Abstract semiring interface for provenance evaluation.
Abstract base class for (m-)semirings.
why_provenance_t value_type
The carrier type of this semiring.
value_type one() const override
Return the multiplicative identity .
value_type times(const std::vector< value_type > &vec) const override
Apply the multiplicative operation to a list of values.
value_type plus(const std::vector< value_type > &vec) const override
Apply the additive operation to a list of values.
virtual value_type monus(value_type x, value_type y) const override
Apply the monus (m-semiring difference) operation.
value_type zero() const override
Return the additive identity .
value_type delta(value_type x) const override
Apply the operator.
std::set< label_set > why_provenance_t
Why-provenance value: the full set of all witnesses.
std::string label_t
A single label identifying a base tuple.
std::set< label_t > label_set
A witness: a set of labels that collectively justify one derivation.