ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
JointEncoding Class Reference

The joint encoding of an instance: facts, world events, and the joint graph the screen and the DP run over. More...

#include "JointEncoding.h"

Public Member Functions

Graph buildGraph () const
 Construct the joint graph for the screen and the DP.

Static Public Member Functions

static JointEncoding fromFacts (const std::vector< FactRow > &rows)
 Build the data-graph (§3.5 fast path) encoding from raw rows.
static JointEncoding fromCorrelated (std::vector< Fact > facts, std::vector< SliceGate > slice, unsigned long n_elements)
 Construct the correlated-regime encoding from facts and an already-extracted circuit slice.

Public Attributes

std::vector< Factfacts
 Deduplicated facts.
std::vector< Eventevents
 Independent world variables (data-graph regime).
std::vector< SliceGateslice
 Circuit slice (correlated regime); gate vertex = n_elements + index.
bool correlated = false
 true when the slice is present (correlated regime).
unsigned long n_elements = 0
 One past the largest domain element id (vertex ids [0,n_elements)).
unsigned data_treewidth_lb = 0
 Degeneracy lower bound of the data-only graph (diagnostics).
unsigned circuit_treewidth_lb = 0
 Degeneracy lower bound of the slice-only graph (0 in the data-graph regime).

Detailed Description

The joint encoding of an instance: facts, world events, and the joint graph the screen and the DP run over.

Definition at line 135 of file JointEncoding.h.

Member Function Documentation

◆ buildGraph()

Graph JointEncoding::buildGraph ( ) const

Construct the joint graph for the screen and the DP.

Data-graph regime: the Gaifman graph of the facts – per-fact cliques over domain elements, isolated nodes for unary facts. Correlated regime: additionally the gate vertices [n_elements, n_elements + |slice|), with a clique over {elements}{fact gate} per fact (thesis Def. 4.2.5, rule 1) and a clique over {gate}{children} per internal slice gate (the stronger ternary co-occurrence of arXiv:1511.08723, rule 2).

Returns
The joint graph (a fresh copy; the decomposition consumes it).

Definition at line 144 of file JointEncoding.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromCorrelated()

JointEncoding JointEncoding::fromCorrelated ( std::vector< Fact > facts,
std::vector< SliceGate > slice,
unsigned long n_elements )
static

Construct the correlated-regime encoding from facts and an already-extracted circuit slice.

The caller (the SQL glue) walks the mmap circuit from the distinct fact tokens down to gate_input leaves and normalises the slice to arity ≤ 2, filling slice and, per fact, the index of its slice gate (or marking it certain for an untracked / constant-true token). This factory assembles the joint graph (element vertices, gate vertices, fact-to-gate and gate-wire cliques) and the diagnostics.

Parameters
factsDeduplicated facts (kind GATE carry a slice index in Fact::gate; kind CERTAIN are always present).
sliceThe circuit slice (arity ≤ 2).
n_elementsOne past the largest element id used.
Returns
The assembled correlated encoding.

Definition at line 87 of file JointEncoding.cpp.

Here is the call graph for this function:

◆ fromFacts()

JointEncoding JointEncoding::fromFacts ( const std::vector< FactRow > & rows)
static

Build the data-graph (§3.5 fast path) encoding from raw rows.

Dedups facts by token (a token over identical element tuples serves many atoms; a gate_input token shared across different element tuples is rejected with JointCompilerException, routing the caller to the general path). Each independent fact becomes one Bernoulli event; certain facts (empty token) are always present. The joint graph is the Gaifman graph of the facts (one clique per fact over its elements).

Parameters
rowsPer-atom relation rows (already dense-encoded).
Returns
The assembled encoding.

Definition at line 17 of file JointEncoding.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ circuit_treewidth_lb

unsigned JointEncoding::circuit_treewidth_lb = 0

Degeneracy lower bound of the slice-only graph (0 in the data-graph regime).

Definition at line 144 of file JointEncoding.h.

◆ correlated

bool JointEncoding::correlated = false

true when the slice is present (correlated regime).

Definition at line 140 of file JointEncoding.h.

◆ data_treewidth_lb

unsigned JointEncoding::data_treewidth_lb = 0

Degeneracy lower bound of the data-only graph (diagnostics).

Definition at line 143 of file JointEncoding.h.

◆ events

std::vector<Event> JointEncoding::events

Independent world variables (data-graph regime).

Definition at line 138 of file JointEncoding.h.

◆ facts

std::vector<Fact> JointEncoding::facts

Deduplicated facts.

Definition at line 137 of file JointEncoding.h.

◆ n_elements

unsigned long JointEncoding::n_elements = 0

One past the largest domain element id (vertex ids [0,n_elements)).

Definition at line 141 of file JointEncoding.h.

◆ slice

std::vector<SliceGate> JointEncoding::slice

Circuit slice (correlated regime); gate vertex = n_elements + index.

Definition at line 139 of file JointEncoding.h.


The documentation for this class was generated from the following files: