![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Implementation of the support-based bound check pass. More...
#include "RangeCheck.h"#include <algorithm>#include <cmath>#include <limits>#include <stack>#include <unordered_map>#include <unordered_set>#include <vector>#include "Aggregation.h"#include "AnalyticEvaluator.h"#include "CircuitFromMMap.h"#include "RandomVariable.h"#include "provsql_utils_cpp.h"#include <type_traits>#include <variant>#include "postgres.h"#include "fmgr.h"#include "funcapi.h"#include "access/htup_details.h"#include "utils/uuid.h"#include "provsql_utils.h"#include "provsql_error.h"
Go to the source code of this file.
Namespaces | |
| namespace | provsql |
Functions | |
| unsigned | provsql::runRangeCheck (GenericCircuit &gc) |
Run the support-based pruning pass over gc. | |
| std::pair< double, double > | provsql::compute_support (const GenericCircuit &gc, gate_t root, std::optional< gate_t > event_root=std::nullopt) |
Compute the [lo, hi] support interval of a scalar sub-circuit rooted at root. | |
| std::optional< std::pair< double, double > > | provsql::collectRvConstraints (const GenericCircuit &gc, gate_t event_root, gate_t target_rv) |
Walk event_root collecting rv op c constraints on target_rv. | |
| static bool | provsql::extract_finite_double (const GenericCircuit &gc, gate_t x, double &out) |
Parse a gate_value's extra as a finite float8. | |
| static bool | provsql::extract_mulinput_value (const GenericCircuit &gc, gate_t mul, double &out) |
| Same parsing applied to a mulinput's outcome label (categorical). | |
| std::optional< TruncatedSingleRv > | provsql::matchTruncatedSingleRv (const GenericCircuit &gc, gate_t root, std::optional< gate_t > event_root) |
| Detect a closed-form, optionally-truncated single-RV shape. | |
| bool | provsql::eventIsProvablyInfeasible (const GenericCircuit &gc, gate_t root, std::optional< gate_t > event_root) |
True iff the conditioning event is provably infeasible for a bare gate_rv root. | |
| static std::optional< double > | provsql::shape_mass (const ClosedFormShape &s, double lo, double hi) |
Unconditional probability mass of a shape over the interval [lo, hi]. | |
| static std::optional< ClosedFormShape > | provsql::truncateShape (const ClosedFormShape &s, double lo, double hi) |
Conditional shape after truncating the underlying variable to [lo, hi]. | |
| std::optional< ClosedFormShape > | provsql::matchClosedFormDistribution (const GenericCircuit &gc, gate_t root, std::optional< gate_t > event_root) |
Detect any of the closed-form shapes supported by rv_analytical_curves. | |
| Datum | rv_support (PG_FUNCTION_ARGS) |
| SQL: rv_support(token uuid, prov uuid, OUT lo float8, OUT hi float8). | |
Implementation of the support-based bound check pass.
See RangeCheck.h for the full docstring.
Definition in file RangeCheck.cpp.
| Datum rv_support | ( | PG_FUNCTION_ARGS | ) |
SQL: rv_support(token uuid, prov uuid, OUT lo float8, OUT hi float8).
Loads the persisted circuit rooted at token, intersects with the AND-conjunct cmps in prov constraining token, and returns the resulting [lo, hi] support interval. When prov resolves to gate_one (the unconditional default after load-time simplification), the conditional path is skipped and the bare unconditional support of token is returned.
-Infinity / +Infinity float8 represent unbounded ends (e.g. the support of a normal RV is [-Infinity, +Infinity]).
Definition at line 1456 of file RangeCheck.cpp.
