![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Support-based bound check for continuous-RV comparators. More...
#include <memory>#include <optional>#include <utility>#include <variant>#include <vector>#include "GenericCircuit.h"#include "RandomVariable.h"

Go to the source code of this file.
Classes | |
| struct | provsql::TruncatedSingleRv |
| Detection result for a closed-form, optionally-truncated single-RV shape. More... | |
| struct | provsql::DiracShape |
Point mass at a finite scalar value (a gate_value root, or an as_random(c) leaf surfaced as a gate_value). More... | |
| struct | provsql::CategoricalShape |
| Categorical distribution over a finite outcome set. More... | |
| struct | provsql::BernoulliMixtureShape |
Bernoulli mixture (gate_mixture with the [p_token, x_token, y_token] shape). More... | |
Namespaces | |
| namespace | provsql |
Typedefs | |
| using | provsql::ClosedFormShape |
| One of the closed-form shapes the analytical-curves payload can render: bare RV (continuous PDF/CDF), Dirac (point mass), categorical (multiple point masses), or Bernoulli mixture of any two of the above. | |
Functions | |
| 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. | |
| 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. | |
| 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. | |
| unsigned | provsql::runRangeCheck (GenericCircuit &gc) |
Run the support-based pruning pass over gc. | |
Support-based bound check for continuous-RV comparators.
Each continuous distribution has a known support: uniform(a,b) on [a,b], exponential(λ) on [0,∞), normal on ℝ. Interval arithmetic propagates these supports through gate_arith combinators, giving a per-gate [lo,hi] bound on the value the gate can take in any possible world. When a gate_cmp's two sides have provably-disjoint supports, the comparator's probability is 0 or 1 exactly – no sampling required.
The peephole pass walks every gate_cmp reachable from a root, decides probabilities where it can, and replaces decided comparators by Bernoulli gate_input gates via GenericCircuit::resolveCmpToBernoulli. Anything it cannot decide is left untouched for downstream evaluators (analytic CDFs where they apply, Monte Carlo otherwise).
No external dependency.
Definition in file RangeCheck.h.