28#ifndef CIRCUIT_CANONICAL_FORM_H
29#define CIRCUIT_CANONICAL_FORM_H
33#include <unordered_set>
43 return std::hash<typename std::underlying_type<gate_t>::type>()(
44 static_cast<typename std::underlying_type<gate_t>::type
>(g));
49using GateSet = std::unordered_set<gate_t, CanonicalGateHash>;
71 const GateSet *abstract_leaves =
nullptr);
83 const GateSet *abstract_leaves =
nullptr);
Boolean provenance circuit with support for knowledge compilation.
gate_t
Strongly-typed gate identifier.
Boolean circuit for provenance formula evaluation.
GateSet reachableNodes(const BooleanCircuit &c, gate_t root, const GateSet *abstract_leaves)
Gates reachable from root.
std::vector< gate_t > maximalIslandRoots(const BooleanCircuit &c, gate_t root)
Roots of the outermost islands below root.
IslandKey computeIslandKey(const BooleanCircuit &c, gate_t root)
Splits the circuit below root into its outermost islands and the residual.
CanonicalForm computeCanonicalForm(const BooleanCircuit &c, gate_t root, const GateSet *abstract_leaves)
Canonical form of the circuit below root.
std::unordered_set< gate_t, CanonicalGateHash > GateSet
Set of gates of one circuit.
Hash of a gate_t, for the containers of this module.
size_t operator()(gate_t g) const
A leaf of a canonical form, in the order the form meets it.
bool is_abstract
Whether it is an island root read as an input.
gate_t gate
The gate of the circuit this leaf stands for.
A circuit split into its outermost islands and what remains.
std::vector< gate_t > island_roots
Island roots, in the order of the residual's leaves.
CanonicalForm residual
Form of the circuit, each island read as an input.
std::vector< CanonicalForm > islands
Form of each island, in the same order.