22#ifndef PROVSQL_RANGE_CHECK_H
23#define PROVSQL_RANGE_CHECK_H
63std::pair<double, double>
65 std::optional<gate_t> event_root = std::nullopt);
87std::optional<std::pair<double, double>>
137std::optional<TruncatedSingleRv>
139 std::optional<gate_t> event_root);
161 std::optional<gate_t> event_root);
220 std::shared_ptr<ClosedFormShape>
left;
221 std::shared_ptr<ClosedFormShape>
right;
237std::optional<ClosedFormShape>
239 std::optional<gate_t> event_root);
251std::optional<std::vector<std::tuple<double, double, double>>>
gate_t
Strongly-typed gate identifier.
Semiring-agnostic in-memory provenance circuit.
Continuous random-variable helpers (distribution parsing, moments).
In-memory provenance circuit with semiring-generic evaluation.
std::pair< double, double > compute_support(const GenericCircuit &gc, gate_t root, std::optional< gate_t > event_root)
Compute the [lo, hi] support interval of a scalar sub-circuit rooted at root.
std::optional< ClosedFormShape > 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.
std::variant< TruncatedSingleRv, DiracShape, CategoricalShape, BernoulliMixtureShape > ClosedFormShape
One of the closed-form shapes the analytical-curves payload can render: bare RV (continuous PDF/CDF),...
std::optional< std::vector< std::tuple< double, double, double > > > analyticalHistogram(const ClosedFormShape &shape, int bins)
Exact histogram (bin_lo, bin_hi, probability mass) of a closed-form shape, in bins equal-width bins o...
unsigned runRangeCheck(GenericCircuit &gc)
Run the support-based pruning pass over gc.
bool 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< std::pair< double, double > > 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 > matchTruncatedSingleRv(const GenericCircuit &gc, gate_t root, std::optional< gate_t > event_root)
Detect a closed-form, optionally-truncated single-RV shape.
unsigned runHavingAlwaysTrueRewriter(GenericCircuit &gc)
Probability-side pre-pass: rewrite HAVING-style gate_cmp gates that are provably TRUE on the agg's va...
Bernoulli mixture (gate_mixture with the [p_token, x_token, y_token] shape).
std::shared_ptr< ClosedFormShape > right
std::shared_ptr< ClosedFormShape > left
Categorical distribution over a finite outcome set.
std::vector< std::pair< double, double > > outcomes
(value, mass) pairs
Point mass at a finite scalar value (a gate_value root, or an as_random(c) leaf surfaced as a gate_va...
Parsed distribution spec (kind + up to two parameters).
Detection result for a closed-form, optionally-truncated single-RV shape.
double lo
Lower bound (-INF if unbounded).
DistributionSpec spec
Parsed kind + parameters.
double hi
Upper bound (+INF if unbounded).
bool truncated
True iff the bounds came from a non-trivial event_root.