ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
ComparatorResolution.h
Go to the documentation of this file.
1
/**
2
* @file ComparatorResolution.h
3
* @brief The single comparator-resolution pipeline and the single
4
* Boolean-subcircuit probability entry point, shared by the
5
* probability path and the scalar-moment evaluator.
6
*
7
* Historically the probability path (@c probability_evaluate) and the
8
* moment evaluator (@c Expectation.cpp) each had their own, divergent
9
* notion of "resolve the RV comparators, then compute the probability of
10
* a Boolean function". This header collapses both into one place.
11
*/
12
#ifndef COMPARATOR_RESOLUTION_H
13
#define COMPARATOR_RESOLUTION_H
14
15
#include "
GenericCircuit.h
"
16
17
namespace
provsql
{
18
19
/**
20
* @brief Run the comparator-resolution pipeline on @p gc, rewriting every
21
* @c gate_cmp (RV comparison, HAVING aggregate comparison) into
22
* Boolean structure so the downstream @c getBooleanCircuit /
23
* BoolExpr translation never meets a raw comparator.
24
*
25
* The single source of truth for the resolution pipeline. Two flags carry
26
* the (principled) differences between the two callers:
27
*
28
* @param gc the circuit whose comparators are resolved in place.
29
* @param root the gate below which comparators are rewritten.
30
* @param simplify run @c runHybridSimplifier, which folds
31
* @c gate_arith-over-@c gate_rv into closed-form distributions. Sound for
32
* the probability path (the circuit collapses to Boolean, so a folded
33
* value RV is never observed as a value) but it MUST be false for the
34
* scalar-moment path: that path takes moments over the very value
35
* structure the fold rewrites, and a value-structure shared latent
36
* (@c mu_i + d inside @c normal(mu_i+d, s)) would be decoupled into
37
* independent Normals, corrupting the covariance.
38
* @param decompose run @c runHybridDecomposer, which groups correlated
39
* comparators into a @c gate_mulinput joint table (capped at
40
* @c JOINT_TABLE_K_MAX). The probability path wants it; the moment path
41
* leaves it false so genuinely-correlated comparators stay raw and fall
42
* to the direct RV Monte-Carlo sampler, which couples the shared base RV
43
* at any group size (no k cap, no joint-table quantisation).
44
*
45
* Emits the "shortcut by probability-side pre-pass" NOTICE at
46
* @c provsql.verbose_level >= 5.
47
*/
48
void
resolveComparators
(GenericCircuit &gc,
gate_t
root,
49
bool
simplify,
bool
decompose);
50
51
}
// namespace provsql
52
53
#endif
/* COMPARATOR_RESOLUTION_H */
gate_t
gate_t
Strongly-typed gate identifier.
Definition
Circuit.h:49
GenericCircuit.h
Semiring-agnostic in-memory provenance circuit.
provsql
Definition
AggMarginalEvaluator.cpp:27
provsql::resolveComparators
void resolveComparators(GenericCircuit &gc, gate_t root, bool simplify, bool decompose)
Run the comparator-resolution pipeline on gc, rewriting every gate_cmp (RV comparison,...
Definition
ComparatorResolution.cpp:46
Home
·
Documentation
·
Publications
·
Contributors
·
Source
·
Cite