77 std::set<gate_t> seen;
78 for (
const auto &h : vec) {
79 if(seen.find(h)!=seen.end())
93 std::set<gate_t> seen;
94 for (
const auto &h : vec) {
95 if(seen.find(h)!=seen.end())
157 const auto t =
c.getGateType(g);
161 c.getWires(g).empty();
177 const std::vector<value_type> &present,
178 const std::vector<value_type> &missing)
const override {
179 if (missing.empty() && present.size() == 1)
183 for (
const auto &h : present)
185 for (
const auto &h : missing) {
192 c.addWire(g, it->second);
203 const std::vector<value_type> &vec)
const override {
208 for (
const auto &h : vec)
@ OR
Boolean OR aggregate.
@ AND
Boolean AND aggregate.
Boolean provenance circuit with support for knowledge compilation.
constexpr unsigned DNNF_CERT_INFO
d-DNNF certificate value for the (gate-type-specific) per-gate info field.
BooleanGate
Gate types for a Boolean provenance circuit.
@ NOT
Logical negation of a single child gate.
@ OR
Logical disjunction of child gates.
@ AND
Logical conjunction of child gates.
@ IN
Input (variable) gate representing a base tuple.
gate_t
Strongly-typed gate identifier.
Abstract semiring interface for provenance evaluation.
Boolean circuit for provenance formula evaluation.
BoolExpr(BooleanCircuit &bc)
Construct a BoolExpr semiring over the given circuit.
virtual bool independent_literal(const value_type &g) const override
A gate qualifies as an independent literal when it is a base Bernoulli input, or a constant (the empt...
value_type plus(const std::vector< value_type > &vec) const override
Apply the additive operation to a list of values.
const gate_t ZERO
Pre-allocated zero gate (OR with no children).
value_type delta(value_type x) const override
Apply the operator.
value_type one() const override
Return the multiplicative identity .
std::map< gate_t, gate_t > not_cache
Per-literal NOT gates of certified_world_term (shared across world terms).
virtual value_type monus(value_type x, value_type y) const override
Apply the monus (m-semiring difference) operation.
BooleanCircuit & c
The Boolean circuit being constructed.
value_type zero() const override
Return the additive identity .
virtual bool compatibleWithBooleanRewrite() const override
BoolExpr is the free Boolean-circuit construction; the evaluation map to Bool at any valuation is an ...
virtual value_type certified_world_term(const std::vector< value_type > &present, const std::vector< value_type > &missing) const override
One complete world: AND of the present literals and of NOT-gates over the missing ones,...
gate_t value_t
Carrier type: a gate ID in the target BooleanCircuit.
const gate_t ONE
Pre-allocated one gate (AND with no children).
virtual value_type certified_exclusive_plus(const std::vector< value_type > &vec) const override
Deterministic OR over pairwise-exclusive world terms, marked with the d-DNNF certificate.
virtual bool absorptive() const override
Return true if this semiring is absorptive ( for all ).
virtual bool certifying() const override
BoolExpr persists the d-DNNF certificate on the HAVING possible-worlds enumerations it builds (determ...
value_type times(const std::vector< value_type > &vec) const override
Apply the multiplicative operation to a list of values.
Abstract base class for (m-)semirings.