![]() |
ProvSQL SQL API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Types | |
| TYPE | GATE_WITH_DESC |
| Row type for sub_circuit_with_desc results. More... | |
| TYPE | rv_percentile_state |
Transition state for rv_percentile_impl: the fraction (from the first row) plus the interleaved indicator/value token pairs. More... | |
Enumerations | |
| ENUM | PROVENANCE_GATE { input , plus , times , monus , project , zero , one , eq , agg , semimod , cmp , delta , value , mulinput , update , rv , arith , mixture , assumed , annotation , conditioned , mobius , case , observe } |
| Provenance circuit gate types. More... | |
| ENUM | QUERY_TYPE_ENUM { INSERT , DELETE , UPDATE , UNDO } |
| Types of update operations tracked for temporal provenance. More... | |
Functions | |
| VOID | create_gate (UUID token, PROVENANCE_GATE type, UUID[] children=NULL) |
| Create a new gate in the provenance circuit. | |
| PROVENANCE_GATE | get_gate_type (UUID token) |
| Return the gate type of a provenance token. | |
| UUID[] | get_children (UUID token) |
| Return the children of a provenance gate. | |
| VOID | set_prob (UUID token, DOUBLE PRECISION p) |
| Set the probability of an input gate. | |
| DOUBLE PRECISION | get_prob (UUID token) |
| Get the probability associated with an input gate. | |
| VOID | set_infos (UUID token, INT info1, INT info2=NULL) |
| Set additional INTEGER values on provenance circuit gate. | |
| RECORD | get_infos (UUID token, OUT INT info1, OUT INT info2) |
| Get the INTEGER info values associated with a circuit gate. | |
| UUID | provenance_assume (UUID token, TEXT assumption) |
Wrap token in a fresh gate_assumed carrying assumption as its label, and return the wrapper's UUID. | |
| UUID | assume_boolean (UUID token) |
Wrap token in a Boolean-assumption marker (compatibility name; see provenance_assume). | |
| UUID | annotate (UUID token, TEXT extra) |
Wrap token in a fresh transparent gate_annotation carrying extra, and return the wrapper's UUID. | |
| UUID | strip_annotations (UUID token) |
Peel every transparent gate_annotation wrapper off token, returning the first non-annotation gate underneath. | |
| UUID | cond (UUID target, UUID evidence) |
| Condition a provenance token (a Boolean event) on another. | |
| BOOLEAN | UUID_op_UUID (UUID left, UUID right) |
Binary | : value-level conditioning, "target | evidence". | |
| UUID | cond_predicate (UUID target, BOOLEAN predicate) |
Placeholder for "X | (predicate)" on a UUID event. | |
| BOOLEAN | UUID_op_boolean (UUID left, BOOLEAN right) |
| UUID | predicate_cond_predicate (BOOLEAN target, BOOLEAN evidence) |
Placeholder for "(predicate) | (predicate)" on two events. | |
| BOOLEAN | boolean_op_boolean (BOOLEAN left, BOOLEAN right) |
| UUID | regular_indicator (BOOLEAN cond) |
| Deterministic indicator gate for an ordinary (regular) comparison. | |
| UUID | given (UUID evidence) |
Whole-tuple output conditioning directive: "given(evidence)". | |
| UUID | given (BOOLEAN predicate) |
Prefix unary | : alias for given, "| evidence". | |
| UUID | provenance_not (UUID event) |
Event negation: "! event" / "provenance_not(event)". | |
| TEXT | inversion_free_key (TEXT root, TEXT sec, INT factor) |
Prefix unary ! | |
| VOID | set_extra (UUID token, TEXT data) |
| Set extra TEXT information on provenance circuit gate. | |
| TEXT | get_extra (UUID token) |
| Get the TEXT-encoded extra data associated with a circuit gate. | |
| BIGINT | get_nb_gates () |
| Return the total number of materialized gates in the provenance circuit. | |
| TRIGGER | delete_statement_trigger () |
| Trigger function for DELETE statement provenance tracking. | |
| VOID | set_table_info (OID relid, TEXT kind, INT2[] block_key=ARRAY[]::INT2[]) |
| Record per-relation provenance metadata used by the safe-query optimisation. | |
| VOID | remove_table_info (OID relid) |
| Remove per-relation provenance metadata. | |
| RECORD | get_table_info (OID relid, OUT TEXTkind, INT2[] &block_key) |
| Read per-relation provenance metadata. | |
| VOID | set_ancestors (OID relid, OID[] ancestors=ARRAY[]::OID[]) |
| Record the base-relation ancestor set of a tracked relation. | |
| VOID | remove_ancestors (OID relid) |
| Clear the ancestor half of a per-relation RECORD (keeps kind/block_key). | |
| OID[] | get_ancestors (OID relid) |
| Read the base-relation ancestor set of a tracked relation. | |
| TRIGGER | provenance_guard () |
BEFORE INSERT OR UPDATE OF provsql row trigger installed by add_provenance. | |
| VOID | add_provenance (REGCLASS _tbl) |
| Enable provenance tracking on an existing table. | |
| VOID | remove_provenance (REGCLASS _tbl) |
| Remove provenance tracking from a table. | |
| VOID | repair_key (REGCLASS _tbl, TEXT key_att) |
| Set up provenance for a table with duplicate key values. | |
| event_trigger | cleanup_table_info () |
| Event trigger that purges per-table provenance metadata when a tracked relation is dropped outside of remove_provenance(). | |
| CREATE TABLE IF NOT EXISTS provsql | provenance_mapping_registry (mapping oid PRIMARY KEY, source oid NOT NULL, attribute name NOT NULL) |
| Registry of maintained provenance mappings. | |
| CREATE INDEX IF NOT EXISTS provenance_mapping_registry_source_idx ON provsql | provenance_mapping_registry (source) |
| VOID | create_provenance_mapping (TEXT newtbl, REGCLASS oldtbl, TEXT att, BOOL preserve_case='f', BOOL maintained=false) |
| Create a provenance mapping table from an attribute. | |
| UUID | uuid_ns_provsql () |
| Return the ProvSQL UUID namespace (used for deterministic gate UUIDs). | |
| UUID | gate_zero () |
| Return the UUID of the semiring zero gate. | |
| UUID | gate_one () |
| Return the UUID of the semiring one gate. | |
| DOUBLE PRECISION | epsilon () |
| Return the epsilon threshold used for probability comparisons. | |
| UUID | provenance_times (UUID[] tokens) |
| Create a times (product) gate from multiple provenance tokens. | |
| UUID | provenance_monus (UUID token1, UUID token2) |
| Create a monus (difference) gate from two provenance tokens. | |
| UUID | provenance_project (UUID token, INT[] positions) |
| Create a project gate for where-provenance tracking. | |
| UUID | provenance_eq (UUID token, INT pos1, INT pos2) |
| Create an equijoin gate for where-provenance tracking. | |
| UUID | provenance_plus (UUID[] tokens) |
| Create a plus (sum) gate from an array of provenance tokens. | |
| VOID | eval_recursive (TEXT body_sql, TEXT work_name, TEXT colnames, TEXT coldef, INT max_iter=1000) |
| Driver for provenance over recursive queries (WITH RECURSIVE). | |
| UUID | provenance_cmp (UUID left_token, OID comparison_op, UUID right_token) |
| Create a comparison gate for HAVING clause provenance. | |
| UUID | provenance_arith (INTEGER op, UUID[] children) |
| Create an arithmetic gate over scalar-valued provenance children. | |
| UUID | provenance_case (UUID[] children) |
| Create a guarded-selection gate over scalar (RV) children. | |
| ANYELEMENT | provenance_evaluate_compiled (UUID token, REGCLASS token2value, TEXT semiring, ANYELEMENT element_one) |
| Evaluate provenance using a compiled (built-in) semiring. | |
| ANYELEMENT | provenance_evaluate (UUID token, REGCLASS token2value, ANYELEMENT element_one, REGTYPE value_type, REGPROC plus_function, REGPROC times_function, REGPROC monus_function, REGPROC delta_function) |
| Evaluate provenance over a user-defined semiring (PL/pgSQL version). | |
| ANYELEMENT | provenance_evaluate (UUID token, REGCLASS token2value, ANYELEMENT element_one, REGPROC plus_function, REGPROC times_function, REGPROC monus_function=NULL, REGPROC delta_function=NULL) |
| Evaluate provenance over a user-defined semiring (C version). | |
| SETOF GATE_WITH_DESC | sub_circuit_with_desc (UUID token, REGCLASS token2desc) |
| Return the sub-circuit reachable from a token, with descriptions. | |
| VOID | identify_token (UUID token, OUT REGCLASS table_name, OUT INTEGER nb_columns) |
| Identify which table and how many columns a provenance token belongs to. | |
| TABLE | sub_circuit_for_where (UUID token) |
| Return the sub-circuit for where-provenance computation. | |
| TABLE | circuit_subgraph (UUID root, INT max_depth=8) |
BFS expansion of a provenance circuit, capped at max_depth. | |
| jsonb | simplified_circuit_subgraph (UUID root, INT max_depth=8) |
BFS subgraph of the IN-MEMORY simplified circuit rooted at root. | |
| jsonb | rv_histogram (UUID token, INT bins=30, UUID prov=gate_one()) |
| Empirical histogram of a scalar sub-circuit. | |
| jsonb | rv_analytical_curves (UUID token, INT samples=100, UUID prov=gate_one()) |
| Sample the closed-form PDF and CDF of a (possibly truncated) scalar distribution. | |
| SETOF float8 | rv_sample (UUID token, INTEGER n, UUID prov=gate_one()) |
| Draw conditional Monte Carlo samples from a scalar gate. | |
| TABLE | resolve_input (UUID UUID) |
| Resolve an input gate UUID back to its source row. | |
| AGG_TOKEN | agg_token_in (CSTRING) |
| Input function for the AGG_TOKEN type (parses TEXT representation). | |
| CSTRING | agg_token_out (AGG_TOKEN) |
| Output function for the AGG_TOKEN type. | |
| TEXT | agg_token_cast (AGG_TOKEN) |
| Cast an AGG_TOKEN to its TEXT representation. | |
| UUID | agg_token_uuid (AGG_TOKEN aggtok) |
| Extract the UUID from an AGG_TOKEN (implicit cast to UUID). | |
| UUID | CAST(AGG_TOKEN AS UUID) (AGG_TOKEN) |
| Implicit PostgreSQL cast from AGG_TOKEN to UUID (delegates to agg_token_uuid()). | |
| BOOLEAN | agg_guard_holds (UUID token) |
| Deterministic truth of a Boolean guard sub-circuit over aggregate comparisons, evaluated in the actual world (all input tuples present). | |
| NUMERIC | agg_gate_value (UUID token) |
| Deterministic (actual-world) scalar value of an aggregate-carrying gate. | |
| TEXT | agg_token_value_text (UUID token) |
Recover the "value (*)" display string for an aggregation gate. | |
| NUMERIC | agg_token_to_numeric (AGG_TOKEN) |
| Cast an AGG_TOKEN to NUMERIC (extracts the aggregate value, loses provenance). | |
| DOUBLE PRECISION | agg_token_to_float8 (AGG_TOKEN) |
| Cast an AGG_TOKEN to DOUBLE PRECISION (extracts the aggregate value, loses provenance). | |
| INTEGER | agg_token_to_int4 (AGG_TOKEN) |
| Cast an AGG_TOKEN to INTEGER (extracts the aggregate value, loses provenance). | |
| bigint | agg_token_to_int8 (AGG_TOKEN) |
| Cast an AGG_TOKEN to bigint (extracts the aggregate value, loses provenance). | |
| TEXT | agg_token_to_text (AGG_TOKEN) |
| Cast an AGG_TOKEN to TEXT (extracts the aggregate value, loses provenance). | |
| CREATE | CAST (AGG_TOKEN AS NUMERIC) WITH FUNCTION agg_token_to_numeric(AGG_TOKEN) AS ASSIGNMENT |
| Assignment cast from AGG_TOKEN to NUMERIC (extracts the scalar value, dropping provenance). | |
| NUMERIC | agg_token_value (AGG_TOKEN) |
| Arithmetic on aggregates (AGG_TOKEN) Mirrors the random_variable arithmetic surface: the operators build a gate_arith over the operand provenance UUIDs (via provenance_arith, info1 = PROVSQL_ARITH_*), so the arithmetic is recorded symbolically in the circuit and can be resolved when a comparison (gate_cmp) over the result is evaluated. | |
| AGG_TOKEN | agg_token_make (UUID tok, NUMERIC val) |
| Bundle a provenance gate UUID with a running value into an AGG_TOKEN (inverse of the agg_token_uuid / agg_token_value accessors). | |
| UUID | agg_value_gate (NUMERIC v) |
| Lift a scalar NUMERIC constant into a gate_value leaf and return its UUID, so it can be a child of a gate_arith (the agg-side analogue of as_random for random_variable). | |
| AGG_TOKEN | agg_arith_make (INT op, UUID[] children, NUMERIC val) |
| Mint (or reuse) the gate_arith for an AGG_TOKEN arithmetic result and return the AGG_TOKEN carrying it. | |
| AGG_TOKEN | agg_token_plus (AGG_TOKEN a, AGG_TOKEN b) |
| AGG_TOKEN <op> AGG_TOKEN | |
| AGG_TOKEN | agg_token_minus (AGG_TOKEN a, AGG_TOKEN b) |
| AGG_TOKEN - AGG_TOKEN (gate_arith MINUS). | |
| AGG_TOKEN | agg_token_times (AGG_TOKEN a, AGG_TOKEN b) |
| AGG_TOKEN * AGG_TOKEN (gate_arith TIMES). | |
| AGG_TOKEN | agg_token_div (AGG_TOKEN a, AGG_TOKEN b) |
| AGG_TOKEN / AGG_TOKEN (gate_arith DIV). | |
| AGG_TOKEN | agg_token_neg (AGG_TOKEN a) |
| Unary -AGG_TOKEN (gate_arith NEG). | |
| AGG_TOKEN | agg_token_plus_numeric (AGG_TOKEN a, NUMERIC b) |
| AGG_TOKEN <op> NUMERIC | |
| AGG_TOKEN | agg_token_minus_numeric (AGG_TOKEN a, NUMERIC b) |
| AGG_TOKEN - NUMERIC. | |
| AGG_TOKEN | agg_token_times_numeric (AGG_TOKEN a, NUMERIC b) |
| AGG_TOKEN * NUMERIC. | |
| AGG_TOKEN | agg_token_div_numeric (AGG_TOKEN a, NUMERIC b) |
| AGG_TOKEN / NUMERIC. | |
| AGG_TOKEN | numeric_plus_agg_token (NUMERIC a, AGG_TOKEN b) |
| NUMERIC <op> AGG_TOKEN | |
| AGG_TOKEN | numeric_minus_agg_token (NUMERIC a, AGG_TOKEN b) |
| NUMERIC - AGG_TOKEN. | |
| AGG_TOKEN | numeric_times_agg_token (NUMERIC a, AGG_TOKEN b) |
| NUMERIC * AGG_TOKEN. | |
| AGG_TOKEN | numeric_div_agg_token (NUMERIC a, AGG_TOKEN b) |
| NUMERIC / AGG_TOKEN. | |
| BOOLEAN | agg_token_op_agg_token (AGG_TOKEN left, AGG_TOKEN right) |
| Operator declarations. | |
| BOOLEAN | agg_token_op_numeric (AGG_TOKEN left, NUMERIC right) |
| BOOLEAN | numeric_op_agg_token (NUMERIC left, AGG_TOKEN right) |
| AGG_TOKEN | agg_token_cond (AGG_TOKEN a, UUID cond) |
Condition a discrete aggregate's distribution on an event: "SUM(x) | C". | |
| BOOLEAN | agg_token_op_uuid (AGG_TOKEN left, UUID right) |
| AGG_TOKEN | agg_token_cond_predicate (AGG_TOKEN a, BOOLEAN predicate) |
Placeholder for "SUM(x) | (predicate)" on an AGG_TOKEN. | |
| BOOLEAN | agg_token_op_boolean (AGG_TOKEN left, BOOLEAN right) |
| AGG_TOKEN | agg_conditioned_target (AGG_TOKEN a) |
Unpack the target of a conditioned AGG_TOKEN. | |
| BOOLEAN | agg_token_comp_numeric (AGG_TOKEN a, NUMERIC b) |
| Placeholder comparison of AGG_TOKEN with NUMERIC. | |
| BOOLEAN | numeric_comp_agg_token (NUMERIC a, AGG_TOKEN b) |
| Placeholder comparison of NUMERIC with AGG_TOKEN. | |
| BOOLEAN | agg_token_lt_numeric (AGG_TOKEN left, NUMERIC right) |
| SQL operator AGG_TOKEN < NUMERIC (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | numeric_lt_agg_token (NUMERIC left, AGG_TOKEN right) |
| SQL operator NUMERIC < AGG_TOKEN (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | agg_token_le_numeric (AGG_TOKEN left, NUMERIC right) |
| SQL operator AGG_TOKEN <= NUMERIC (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | numeric_le_agg_token (NUMERIC left, AGG_TOKEN right) |
| SQL operator NUMERIC <= AGG_TOKEN (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | agg_token_eq_numeric (AGG_TOKEN left, NUMERIC right) |
| SQL operator AGG_TOKEN = NUMERIC (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | numeric_eq_agg_token (NUMERIC left, AGG_TOKEN right) |
| SQL operator NUMERIC = AGG_TOKEN (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | agg_token_ne_numeric (AGG_TOKEN left, NUMERIC right) |
| SQL operator AGG_TOKEN <> NUMERIC (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | numeric_ne_agg_token (NUMERIC left, AGG_TOKEN right) |
| SQL operator NUMERIC <> AGG_TOKEN (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | agg_token_ge_numeric (AGG_TOKEN left, NUMERIC right) |
| SQL operator AGG_TOKEN >= NUMERIC (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | numeric_ge_agg_token (NUMERIC left, AGG_TOKEN right) |
| SQL operator NUMERIC >= AGG_TOKEN (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | agg_token_gt_numeric (AGG_TOKEN left, NUMERIC right) |
| SQL operator AGG_TOKEN > NUMERIC (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | numeric_gt_agg_token (NUMERIC left, AGG_TOKEN right) |
| SQL operator NUMERIC > AGG_TOKEN (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | agg_token_comp_agg_token (AGG_TOKEN a, AGG_TOKEN b) |
| Placeholder comparison of two AGG_TOKEN values (the diagonal). | |
| BOOLEAN | agg_token_lt_agg_token (AGG_TOKEN left, AGG_TOKEN right) |
| SQL operator AGG_TOKEN < AGG_TOKEN (placeholder rewritten at plan time). | |
| BOOLEAN | agg_token_le_agg_token (AGG_TOKEN left, AGG_TOKEN right) |
| SQL operator AGG_TOKEN <= AGG_TOKEN (placeholder rewritten at plan time). | |
| BOOLEAN | agg_token_gt_agg_token (AGG_TOKEN left, AGG_TOKEN right) |
| SQL operator AGG_TOKEN > AGG_TOKEN (placeholder rewritten at plan time). | |
| BOOLEAN | agg_token_ge_agg_token (AGG_TOKEN left, AGG_TOKEN right) |
| SQL operator AGG_TOKEN >= AGG_TOKEN (placeholder rewritten at plan time). | |
| BOOLEAN | agg_token_eq_agg_token (AGG_TOKEN left, AGG_TOKEN right) |
| SQL operator AGG_TOKEN = AGG_TOKEN (placeholder rewritten at plan time). | |
| BOOLEAN | agg_token_ne_agg_token (AGG_TOKEN left, AGG_TOKEN right) |
| SQL operator AGG_TOKEN <> AGG_TOKEN (placeholder rewritten at plan time). | |
| BOOLEAN | agg_token_comp_text (AGG_TOKEN a, TEXT b) |
| Placeholder comparison of AGG_TOKEN with TEXT. | |
| BOOLEAN | text_comp_agg_token (TEXT a, AGG_TOKEN b) |
| Placeholder comparison of TEXT with AGG_TOKEN. | |
| BOOLEAN | agg_token_eq_text (AGG_TOKEN left, TEXT right) |
| SQL operator AGG_TOKEN = TEXT (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | text_eq_agg_token (TEXT left, AGG_TOKEN right) |
| SQL operator TEXT = AGG_TOKEN (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | agg_token_ne_text (AGG_TOKEN left, TEXT right) |
| SQL operator AGG_TOKEN <> TEXT (placeholder rewritten by ProvSQL at plan time). | |
| BOOLEAN | text_ne_agg_token (TEXT left, AGG_TOKEN right) |
| SQL operator TEXT <> AGG_TOKEN (placeholder rewritten by ProvSQL at plan time). | |
| random_variable | random_variable_in (CSTRING) |
| Input function for the random_variable type. | |
| CSTRING | random_variable_out (random_variable) |
| Output function for the random_variable type. | |
| random_variable | random_variable_make (UUID tok) |
| Build a random_variable from a UUID (internal). | |
| CREATE | CAST (random_variable AS UUID) WITHOUT FUNCTION AS ASSIGNMENT |
| Binary-coercible cast random_variable -> UUID. | |
| CREATE | CAST (UUID AS random_variable) WITHOUT FUNCTION |
| random_variable | agg_token_to_random_variable (AGG_TOKEN a) |
Coerce an AGG_TOKEN to a random_variable (its circuit token). | |
| random_variable | CAST(AGG_TOKEN AS RANDOM_VARIABLE) (AGG_TOKEN) |
| BOOL | is_finite_float8 (DOUBLE PRECISION x) |
Internal: true iff x is a finite (non-NaN, non-±∞) float8. | |
| random_variable | rv_parametric2 (TEXT family, UUID p1_tok, DOUBLE PRECISION p1_lit, UUID p2_tok, DOUBLE PRECISION p2_lit) |
Internal: build a two-parameter latent gate_rv. | |
| random_variable | rv_parametric1 (TEXT family, UUID p_tok) |
Internal: build a one-parameter latent gate_rv (rate/scale). | |
| random_variable | normal (random_variable mu, DOUBLE PRECISION sigma) |
| normal(mu, sigma) | |
| random_variable | normal (DOUBLE PRECISION mu, random_variable sigma) |
| random_variable | normal (random_variable mu, random_variable sigma) |
| random_variable | logistic (random_variable mu, DOUBLE PRECISION s) |
| logistic(mu, s) | |
| random_variable | logistic (DOUBLE PRECISION mu, random_variable s) |
| random_variable | logistic (random_variable mu, random_variable s) |
| random_variable | uniform (random_variable a, DOUBLE PRECISION b) |
| uniform(a, b) | |
| random_variable | uniform (DOUBLE PRECISION a, random_variable b) |
| random_variable | uniform (random_variable a, random_variable b) |
| random_variable | exponential (random_variable lambda) |
| exponential(lambda) | |
| random_variable | gamma (random_variable k, DOUBLE PRECISION lambda) |
| gamma(k, lambda) | |
| random_variable | gamma (DOUBLE PRECISION k, random_variable lambda) |
| random_variable | gamma (random_variable k, random_variable lambda) |
| random_variable | lognormal (random_variable mu, DOUBLE PRECISION sigma) |
| lognormal(mu, sigma) | |
| random_variable | lognormal (DOUBLE PRECISION mu, random_variable sigma) |
| random_variable | lognormal (random_variable mu, random_variable sigma) |
| random_variable | weibull (random_variable k, DOUBLE PRECISION lambda) |
| weibull(k, lambda) | |
| random_variable | weibull (DOUBLE PRECISION k, random_variable lambda) |
| random_variable | weibull (random_variable k, random_variable lambda) |
| random_variable | pareto (random_variable xm, DOUBLE PRECISION alpha) |
| pareto(xm, alpha) | |
| random_variable | pareto (DOUBLE PRECISION xm, random_variable alpha) |
| random_variable | pareto (random_variable xm, random_variable alpha) |
| random_variable | beta (random_variable alpha, DOUBLE PRECISION beta) |
| beta(alpha, beta) | |
| random_variable | beta (DOUBLE PRECISION alpha, random_variable beta) |
| random_variable | beta (random_variable alpha, random_variable beta) |
| random_variable | inverse_gamma (random_variable alpha, DOUBLE PRECISION beta) |
| inverse_gamma(alpha, beta) | |
| random_variable | inverse_gamma (DOUBLE PRECISION alpha, random_variable beta) |
| random_variable | inverse_gamma (random_variable alpha, random_variable beta) |
| random_variable | inverse_gaussian (random_variable mu, DOUBLE PRECISION lambda) |
| inverse_gaussian(mu, lambda) | |
| random_variable | inverse_gaussian (DOUBLE PRECISION mu, random_variable lambda) |
| random_variable | inverse_gaussian (random_variable mu, random_variable lambda) |
| random_variable | normal (DOUBLE PRECISION mu, DOUBLE PRECISION sigma) |
| Construct a normal-distribution random variable. | |
| random_variable | logistic (DOUBLE PRECISION mu, DOUBLE PRECISION s) |
| Construct a logistic-distribution random variable Logistic(μ, s). | |
| random_variable | uniform (DOUBLE PRECISION a, DOUBLE PRECISION b) |
| Construct a uniform-distribution random variable on [a, b]. | |
| random_variable | exponential (DOUBLE PRECISION lambda) |
| Construct an exponential-distribution random variable with rate λ | |
| random_variable | erlang (INTEGER k, DOUBLE PRECISION lambda) |
Construct an Erlang-distribution random variable, sum of k i.i.d. | |
| random_variable | gamma (DOUBLE PRECISION k, DOUBLE PRECISION lambda) |
Construct a gamma-distribution random variable with shape k (any positive real) and rate lambda. | |
| random_variable | chi_squared (DOUBLE PRECISION k) |
Construct a chi-squared random variable with k degrees of freedom: syntactic sugar for gamma(k/2, 1/2). | |
| random_variable | lognormal (DOUBLE PRECISION mu, DOUBLE PRECISION sigma) |
Construct a log-normal random variable: exp of a Normal(mu, sigma), parameterised by the underlying normal (so its median is exp(mu) and its mean exp(mu + sigma^2/2)). | |
| random_variable | weibull (DOUBLE PRECISION k, DOUBLE PRECISION lambda) |
Construct a Weibull random variable with shape k and scale lambda. | |
| random_variable | pareto (DOUBLE PRECISION xm, DOUBLE PRECISION alpha) |
Construct a Pareto random variable with scale (minimum) xm and shape alpha. | |
| random_variable | inverse_gamma (DOUBLE PRECISION alpha, DOUBLE PRECISION beta) |
Construct an inverse-gamma random variable with shape alpha and scale beta. | |
| random_variable | inverse_gaussian (DOUBLE PRECISION mu, DOUBLE PRECISION lambda) |
Construct an inverse-Gaussian (Wald) random variable with mean mu and shape lambda. | |
| random_variable | wald (DOUBLE PRECISION mu, DOUBLE PRECISION lambda) |
| Wald distribution: alias for inverse_gaussian. | |
| random_variable | categorical_from_log_pmf (DOUBLE_PRECISION[] outcomes, DOUBLE_PRECISION[] log_pmf) |
| Build a discrete (categorical) random variable from outcomes and UNNORMALISED log-masses. | |
| random_variable | poisson (DOUBLE PRECISION lambda) |
Construct a Poisson random variable with mean lambda, as a truncated categorical. | |
| random_variable | poisson (random_variable lambda) |
Poisson with a LATENT rate: poisson(random_variable). | |
| random_variable | beta (DOUBLE PRECISION alpha, DOUBLE PRECISION beta) |
| Construct a Beta(α, β) random variable on the unit interval. | |
| random_variable | binomial (INTEGER n, DOUBLE PRECISION p) |
Construct a Binomial(n, p) random variable (number of successes in n independent trials), as a categorical. | |
| random_variable | binomial (INTEGER n, random_variable p) |
Binomial with a fixed trial count and a LATENT success probability: binomial(INTEGER, random_variable). | |
| random_variable | geometric (DOUBLE PRECISION p) |
| Construct a Geometric(p) random variable – the number of TRIALS up to and including the first success (support starting at 1; subtract 1 for the failures convention). | |
| random_variable | geometric (random_variable p) |
Geometric with a LATENT success probability: geometric(random_variable). | |
| random_variable | hypergeometric (INTEGER pop_n, INTEGER k_marked, INTEGER n) |
Construct a Hypergeometric(N, K, n) random variable: the number of marked items among n draws WITHOUT replacement from a population of pop_n items of which k_marked are marked. | |
| random_variable | negative_binomial (DOUBLE PRECISION r, DOUBLE PRECISION p) |
Construct a negative-binomial random variable: the number of FAILURES before the r-th success (support starting at 0), with real r > 0 allowed (the Polya / overdispersed-count parameterisation, the Poisson-Gamma mixture). | |
| random_variable | negative_binomial (DOUBLE PRECISION r, random_variable p) |
| random_variable | negative_binomial (random_variable r, DOUBLE PRECISION p) |
| random_variable | negative_binomial (random_variable r, random_variable p) |
| TABLE | rv_families () |
| Catalog of the registered continuous-distribution families. | |
| random_variable | mixture (UUID p, random_variable x, random_variable y) |
| Construct a probabilistic-mixture random variable. | |
| random_variable | mixture (DOUBLE PRECISION p_value, random_variable x, random_variable y) |
Ad-hoc mixture constructor that mints a fresh anonymous gate_input Bernoulli with probability p_value. | |
| random_variable | categorical (DOUBLE_PRECISION[] probs, DOUBLE_PRECISION[] outcomes) |
| Categorical-RV constructor over explicit (probabilities, values) arrays. | |
| random_variable | gmm (DOUBLE_PRECISION[] weights, DOUBLE_PRECISION[] means, DOUBLE_PRECISION[] stddevs) |
| Gaussian-mixture-model (GMM) constructor. | |
| random_variable | empirical_samples (DOUBLE_PRECISION[] samples) |
Empirical-samples constructor: the ecdf of a sample bundle as a random_variable. | |
| random_variable | empirical_cdf (DOUBLE_PRECISION[] grid, DOUBLE_PRECISION[] cdf) |
Empirical-CDF constructor: a piecewise-linear CDF table as a random_variable. | |
| random_variable | as_random (DOUBLE PRECISION c) |
| Lift a deterministic constant into a random_variable. | |
| CREATE | CAST (DOUBLE PRECISION AS random_variable) WITH FUNCTION as_random(DOUBLE PRECISION) AS IMPLICIT |
| Implicit cast DOUBLE PRECISION -> random_variable (lifts a scalar literal to a constant RV). | |
| random_variable | as_random (INTEGER c) |
as_random for INTEGER (delegates to the float8 form). | |
| random_variable | as_random (NUMERIC c) |
as_random for NUMERIC (delegates to the float8 form). | |
| random_variable | CAST(INTEGER AS RANDOM_VARIABLE) (INTEGER) |
| Implicit cast INTEGER -> random_variable. | |
| random_variable | CAST(NUMERIC AS RANDOM_VARIABLE) (NUMERIC) |
| Implicit cast NUMERIC -> random_variable. | |
| UUID | provenance_delta (UUID token) |
| Create a δ-semiring gate wrapping a provenance token. | |
| AGG_TOKEN | provenance_aggregate (INTEGER aggfnoid, INTEGER aggtype, ANYELEMENT val, UUID[] tokens, BOOLEAN is_scalar=false) |
| Build an aggregate provenance gate from grouped tokens. | |
| UUID | provenance_semimod (ANYELEMENT val, UUID token) |
| Create a semimodule scalar multiplication gate. | |
| DOUBLE PRECISION | probability_evaluate (UUID token, TEXT method=NULL, TEXT arguments=NULL) |
| Compute the probability of a provenance token. | |
| DOUBLE PRECISION | probability (UUID token, TEXT method=NULL, TEXT arguments=NULL) |
| Short alias of probability_evaluate. | |
| DOUBLE PRECISION | probability (BOOLEAN predicate, TEXT method=NULL, TEXT arguments=NULL) |
| Probability of a Boolean event over random variables. | |
| VOID | probability_bounds (UUID token, OUT DOUBLE PRECISION lower, OUT DOUBLE PRECISION upper) |
| Cheap certified probability interval of a DNF-shaped circuit. | |
| DOUBLE PRECISION | expected (ANYELEMENT input, UUID prov=gate_one(), TEXT method=NULL, TEXT arguments=NULL) |
| Compute the expected value of a probabilistic scalar. | |
| DOUBLE PRECISION | rv_moment (UUID token, INTEGER k, BOOLEAN central, UUID prov=gate_one()) |
| Internal: shared C entry point for variance / moment / central_moment. | |
| DOUBLE PRECISION | agg_avg_moment_exact (UUID token, INTEGER k) |
Exact E[AVG^k | COUNT >= 1] over independent rows (the joint (sum, count) fold); NULL when the shape is out of scope (shared leaves, compound contributors), signalling agg_raw_moment's avg arm to fall back to the Monte-Carlo scalar path. | |
| DOUBLE PRECISION | agg_collapsed_moment (UUID token, INTEGER k) |
| Collapsed (Rao-Blackwellised) raw moment E[C^k] of a correlated COUNT / SUM whose per-row selection events are coupled through a single shared continuous latent: 1-D quadrature over the latent, closed-form per-row CDF given it (O(G·n), exact up to the grid). | |
| DOUBLE_PRECISION[] | agg_collapsed_moments (UUID token) |
| Both collapsed raw moments {E[C], E[C^2]} of a correlated COUNT / SUM from a single circuit load and plan build; NULL when the shared-latent pattern does not match. | |
| UUID | agg_defined_event (UUID token) |
| Boolean event "this aggregate-carrying gate's value is defined
(non-NULL) in the world". | |
| DOUBLE PRECISION | agg_raw_moment (AGG_TOKEN token, INTEGER k, UUID prov=gate_one(), TEXT method=NULL, TEXT arguments=NULL) |
| Compute the raw moment E[X^k | prov] of an AGG_TOKEN aggregate. | |
| DOUBLE PRECISION | variance (ANYELEMENT input, UUID prov=gate_one(), TEXT method=NULL, TEXT arguments=NULL) |
| Compute the variance Var[X | prov] of a probabilistic scalar. | |
| DOUBLE PRECISION | moment (ANYELEMENT input, INTEGER k, UUID prov=gate_one(), TEXT method=NULL, TEXT arguments=NULL) |
| Compute the raw moment E[X^k | prov] of a probabilistic scalar. | |
| DOUBLE PRECISION | rv_quantile (UUID token, DOUBLE PRECISION p, UUID prov=gate_one()) |
| Internal: rv-side quantile computation. | |
| DOUBLE PRECISION | quantile (ANYELEMENT input, DOUBLE PRECISION p, UUID prov=gate_one(), TEXT method=NULL, TEXT arguments=NULL) |
| Compute the p-quantile (inverse CDF) of a probabilistic scalar. | |
| VOID | rv_support (UUID token, UUID prov=gate_one(), float8 &lo, float8 &hi) |
| Internal: rv-side support computation. | |
| VOID | support (ANYELEMENT input, UUID prov=gate_one(), TEXT method=NULL, TEXT arguments=NULL, float8 &lo, float8 &hi) |
Compute the support interval [lo, hi] of a probabilistic (or deterministic) scalar. | |
| DOUBLE PRECISION | central_moment (ANYELEMENT input, INTEGER k, UUID prov=gate_one(), TEXT method=NULL, TEXT arguments=NULL) |
| Compute the central moment E[(X - E[X|prov])^k | prov]. | |
| DOUBLE PRECISION | rv_covariance (UUID x, UUID y, UUID prov) |
| C entry point behind covariance (UUID-level binding). | |
| DOUBLE PRECISION | covariance (random_variable x, random_variable y, UUID prov=gate_one()) |
| Covariance Cov(X, Y) = E[XY] − E[X]·E[Y] of two random variables. | |
| DOUBLE PRECISION | stddev (random_variable x, UUID prov=gate_one()) |
| Standard deviation σ(X) = √Var(X) of a random variable. | |
| DOUBLE PRECISION | rv_correlation (UUID x, UUID y, UUID prov) |
| C entry point behind correlation (UUID-level binding). | |
| DOUBLE PRECISION | correlation (random_variable x, random_variable y, UUID prov=gate_one()) |
| Pearson correlation ρ(X, Y) = Cov(X, Y) / (σ(X)·σ(Y)). | |
| DOUBLE PRECISION | rv_entropy (UUID token, UUID prov) |
| C entry point behind entropy (UUID-level binding). | |
| DOUBLE PRECISION | entropy (random_variable x, UUID prov=gate_one()) |
| Entropy H(X) of a random variable, in nats. | |
| DOUBLE PRECISION | rv_kl (UUID p, UUID q) |
| C entry point behind kl (UUID-level binding). | |
| DOUBLE PRECISION | kl (random_variable p, random_variable q) |
| Kullback-Leibler divergence KL(P || Q), in nats. | |
| DOUBLE PRECISION | rv_mutual_information (UUID x, UUID y) |
| C entry point behind mutual_information (UUID-level binding). | |
| DOUBLE PRECISION | mutual_information (random_variable x, random_variable y) |
| Mutual information I(X; Y), in nats. | |
| DOUBLE PRECISION | shapley (UUID token, UUID variable, TEXT method=NULL, TEXT arguments=NULL, BOOLEAN banzhaf='f') |
| Compute the Shapley value of an input variable. | |
| SETOF RECORD | shapley_all_vars (UUID token, TEXT method=NULL, TEXT arguments=NULL, BOOLEAN banzhaf='f', OUT UUID variable, OUT DOUBLE PRECISIONvalue) |
| Compute Shapley values for all input variables at once. | |
| DOUBLE PRECISION | banzhaf (UUID token, UUID variable, TEXT method=NULL, TEXT arguments=NULL) |
| Compute the Banzhaf power index of an input variable. | |
| SETOF RECORD | banzhaf_all_vars (UUID token, TEXT method=NULL, TEXT arguments=NULL, OUT UUID variable, OUT DOUBLE PRECISIONvalue) |
| Compute Banzhaf power indices for all input variables at once. | |
| DOUBLE PRECISION | reachability_evaluate (INT[] sources, INT[] destinations, UUID[] tokens, DOUBLE_PRECISION[] probabilities, INT source, INT target, BOOLEAN directed) |
| Exact reachability probability over bounded-treewidth data (columnar form). | |
| VOID | reachability_compile_stats (INT[] sources, INT[] destinations, UUID[] tokens, DOUBLE_PRECISION[] probabilities, INT source, INT target, BOOLEAN directed, OUT DOUBLE PRECISIONprobability, OUT INT data_treewidth, OUT BIGINT nb_bags, OUT BIGINT max_states, OUT BIGINT nb_gates, OUT BIGINT nb_variables) |
| Reachability probability plus compilation statistics (columnar form). | |
| VOID | ucq_joint_compile_stats (INT[] disjunct_nvars, INT[] atom_disjunct, INT[] atom_rel, INT[] atom_vars, INT[] atom_arity, INT[] fact_rel, INT[] fact_elems, INT[] fact_arity, UUID[] fact_tokens, DOUBLE_PRECISION[] fact_probs, OUT DOUBLE PRECISIONprobability, OUT INT joint_treewidth, OUT INT data_treewidth_lb, OUT INT circuit_treewidth_lb, OUT BIGINT n_bags, OUT BIGINT max_states, OUT BIGINT dd_size, OUT INT n_enumerating) |
| Boolean UCQ probability plus compilation statistics (columnar form, internal). | |
| VOID | ucq_joint_compile_stats (JSONB query, INT[] fact_rel, INT[] fact_elems, INT[] fact_arity, UUID[] fact_tokens, DOUBLE_PRECISION[] fact_probs, OUT DOUBLE PRECISIONprobability, OUT INT joint_treewidth, OUT INT data_treewidth_lb, OUT INT circuit_treewidth_lb, OUT BIGINT n_bags, OUT BIGINT max_states, OUT BIGINT dd_size, OUT INT n_enumerating) |
| Boolean UCQ probability plus statistics from a JSON specification. | |
| VOID | ucq_joint_compile_stats_tracked (INT[] disjunct_nvars, INT[] atom_disjunct, INT[] atom_rel, INT[] atom_vars, INT[] atom_arity, INT[] fact_rel, INT[] fact_elems, INT[] fact_arity, UUID[] fact_tokens, OUT DOUBLE PRECISIONprobability, OUT INT joint_treewidth, OUT INT data_treewidth_lb, OUT INT circuit_treewidth_lb, OUT BIGINT n_bags, OUT BIGINT max_states, OUT BIGINT dd_size, OUT INT n_enumerating) |
| Correlated Boolean UCQ probability plus compilation statistics (columnar form, internal). | |
| VOID | ucq_joint_compile_stats_tracked (JSONB query, INT[] fact_rel, INT[] fact_elems, INT[] fact_arity, UUID[] fact_tokens, OUT DOUBLE PRECISIONprobability, OUT INT joint_treewidth, OUT INT data_treewidth_lb, OUT INT circuit_treewidth_lb, OUT BIGINT n_bags, OUT BIGINT max_states, OUT BIGINT dd_size, OUT INT n_enumerating) |
| Correlated Boolean UCQ probability plus statistics from a JSON spec. | |
| UUID | ucq_joint_materialize_tracked (INT[] disjunct_nvars, INT[] atom_disjunct, INT[] atom_rel, INT[] atom_vars, INT[] atom_arity, INT[] fact_rel, INT[] fact_elems, INT[] fact_arity, UUID[] fact_tokens) |
| Compile a correlated UCQ and materialise its certified d-D, returning the root provenance token (columnar form, internal). | |
| UUID | ucq_joint_materialize_tracked (JSONB query, INT[] fact_rel, INT[] fact_elems, INT[] fact_arity, UUID[] fact_tokens) |
| Compile a correlated UCQ and materialise its certified d-D from a JSON spec, returning the root provenance token. | |
| UUID | ucq_joint_provenance (JSONB descriptor, UUID fallback=NULL) |
| Compile a UCQ over named relations into a materialised certified d-D, gathering the facts from the store – the descriptor-driven engine. | |
| UUID | ucq_mobius_materialize_tracked (INT[] disjunct_nvars, INT[] atom_disjunct, INT[] atom_rel, INT[] atom_vars, INT[] atom_arity, INT[] fact_rel, INT[] fact_elems, INT[] fact_arity, UUID[] fact_tokens, UUID lineage=NULL) |
| =========================================================================== Safe-UCQ Möbius-inversion route (mobius_evaluate.cpp). | |
| VOID | ucq_mobius_compile_stats (INT[] disjunct_nvars, INT[] atom_disjunct, INT[] atom_rel, INT[] atom_vars, INT[] atom_arity, INT[] fact_rel, INT[] fact_elems, INT[] fact_arity, UUID[] fact_tokens, OUT DOUBLE PRECISIONprobability, OUT INT n_components, OUT INT n_cnf_conjuncts, OUT INT lattice_size, OUT INT n_nonzero, OUT INT n_cancelled, OUT BOOLEAN cancelled_hard, OUT BIGINT dd_size, OUT BIGINT memo_hits) |
| Compile the Möbius circuit and return the lattice statistics plus the probability (the demonstrability surface). | |
| UUID | mobius_or_null (UUID tok) |
Pass a token through iff it is a gate_mobius, else return NULL. | |
| UUID | ucq_mobius_provenance (JSONB descriptor, UUID fallback=NULL) |
| Möbius-route provenance from a descriptor (the planner-substituted entry point, and the manual one). | |
| RECORD | mobius_compile_stats (JSONB descriptor, OUT DOUBLE PRECISIONprobability, OUT INT n_components, OUT INT n_cnf_conjuncts, OUT INT lattice_size, OUT INT n_nonzero, OUT INT n_cancelled, OUT BOOLEAN cancelled_hard, OUT BIGINT dd_size, OUT BIGINT memo_hits) |
| Möbius lattice statistics + probability from a descriptor: the demonstrability SRF. | |
| VOID | ucq_joint_gather (JSONB descriptor, INT[] &disjunct_nvars, INT[] &atom_disjunct, INT[] &atom_rel, INT[] &atom_vars, INT[] &atom_arity, INT[] &fact_rel, INT[] &fact_elems, INT[] &fact_arity, UUID[] &fact_tokens, TEXT[] &val_by_id) |
Internal gather for the per-answer joint route: parse descriptor into the columnar UCQ arrays and gather every fact (relation index, dense element ids, provenance token) with the value dictionary. | |
| UUID | ucq_joint_provenance_answer (JSONB descriptor, INT[] head_vars, TEXT[] head_vals, UUID fallback=NULL) |
| Per-answer joint-width provenance via the TOP-DOWN single DP (planner-substituted, C). | |
| UUID | ucq_mobius_provenance_answer (JSONB descriptor, INT[] head_vars, TEXT[] head_vals, UUID fallback=NULL) |
| Per-answer safe-UCQ Möbius provenance (planner-substituted): one head-pinned Möbius circuit per output group. | |
| SETOF RECORD | reachability_materialize (INT[] sources, INT[] destinations, UUID[] tokens, DOUBLE_PRECISION[] probabilities, UUID[] block_keys, INT[] block_indices, INT[] source_vertices, UUID[] source_tokens, DOUBLE_PRECISION[] source_probabilities, BOOLEAN directed, OUT INT vertex, OUT UUID token) |
| Compile and materialise the reachability provenance of every vertex (columnar form, internal). | |
| SETOF RECORD | reachability_materialize_hops (INT[] sources, INT[] destinations, UUID[] tokens, DOUBLE_PRECISION[] probabilities, UUID[] block_keys, INT[] block_indices, INT[] source_vertices, UUID[] source_tokens, DOUBLE_PRECISION[] source_probabilities, BOOLEAN directed, INT hop_bound, INT hop_seed, OUT INT vertex, OUT INT hops, OUT UUID token) |
Bounded-hop variant of reachability_materialize() (internal). | |
| SETOF RECORD | reachability_materialize_any (INT[] sources, INT[] destinations, UUID[] tokens, DOUBLE_PRECISION[] probabilities, UUID[] block_keys, INT[] block_indices, INT[] source_vertices, UUID[] source_tokens, DOUBLE_PRECISION[] source_probabilities, BOOLEAN directed, INT[] group_ids, INT[] member_vertices, OUT INT group_id, OUT UUID token) |
| Per-group "some member reachable" compilation (columnar form, internal). | |
| UUID | reachability_materialize_cover (INT[] sources, INT[] destinations, UUID[] tokens, DOUBLE_PRECISION[] probabilities, UUID[] block_keys, INT[] block_indices, INT[] source_vertices, UUID[] source_tokens, DOUBLE_PRECISION[] source_probabilities, BOOLEAN directed, INT[] member_vertices) |
| Compile and materialise the "every member vertex reachable" (k-terminal / coverage) circuit (columnar form, internal). | |
| VOID | plant_reach_any_groups (TEXT work_name, TEXT node_attribute, REGCLASS member_rel, TEXT member_attribute, TEXT group_attribute, REGCLASS edge_rel, TEXT source_attribute, TEXT destination_attribute, TEXT source_value, BOOLEAN directed, TEXT edge_quals=NULL, REGCLASS source_rel=NULL, TEXT source_rel_attribute=NULL, TEXT edge_sql=NULL, TEXT member_quals=NULL) |
| Plant certified any-member-reachable gates for a grouped reachability aggregation (internal). | |
| VOID | plant_reach_cover (TEXT work_name, TEXT node_attribute, REGCLASS edge_rel, TEXT source_attribute, TEXT destination_attribute, TEXT source_value, BOOLEAN directed, TEXT[] node_values, TEXT edge_quals=NULL, REGCLASS source_rel=NULL, TEXT source_rel_attribute=NULL, TEXT edge_sql=NULL) |
| Plant the certified all-members-reachable gate for a reachability self-join conjunction (internal). | |
| UUID[] | token_conjunctive_leaves (UUID token) |
| Input leaves of a conjunction-shaped provenance token (internal). | |
| VOID | gather_reachability_edges (REGCLASS rel, TEXT source_attribute, TEXT destination_attribute, TEXT[] extra_vertices, TEXT edge_quals=NULL, TEXT rel_sql=NULL, INT[] &sources, INT[] &destinations, UUID[] &tokens, DOUBLE_PRECISION[] &probabilities, UUID[] &block_keys, INT[] &block_indices, INT[] &extra_ids, TEXT[] &vertices) |
| Gather the edges of a tracked relation in the columnar form expected by reachability_evaluate (internal). | |
| VOID | gather_reachability_sources (REGCLASS rel, TEXT source_attribute, TEXT[] &source_values, UUID[] &source_tokens, DOUBLE_PRECISION[] &source_probabilities) |
| Gather a source relation's vertices, tokens and probabilities (internal). | |
| VOID | eval_reachability (REGCLASS edge_rel, TEXT source_attribute, TEXT destination_attribute, TEXT source_value, BOOLEAN directed, TEXT work_name, TEXT colnames, TEXT coldef, TEXT coltype, TEXT body_sql, TEXT edge_quals=NULL, REGCLASS source_rel=NULL, TEXT source_rel_attribute=NULL, TEXT edge_sql=NULL, INT hop_bound=NULL, INT hop_seed=NULL, INT hops_position=NULL) |
| Fixpoint driver for the recursive reachability shape: decomposition-aligned compilation with fallback to eval_recursive. | |
| TEXT | view_circuit (UUID token, REGCLASS token2desc, INT dbg=0) |
| Return a DOT or TEXT visualization of the provenance circuit. | |
| TEXT | compile_to_ddnnf_dot (UUID token, TEXT compiler='') |
| Return a DOT visualisation of the d-DNNF compiled from the provenance circuit. | |
| TEXT | compile_to_ddnnf (UUID token, TEXT compiler='') |
| Return the compiled d-DNNF of a provenance circuit in the c2d / d4 ".nnf" TEXT interchange format. | |
| jsonb | ddnnf_stats (UUID token, TEXT compiler='') |
| Structural statistics of the d-DNNF a compiler produces for a provenance circuit. | |
| TEXT | tseytin_cnf (UUID token, BOOLEAN weighted=TRUE, BOOLEAN mapping=TRUE) |
| Return the DIMACS CNF (Tseytin transformation) of the provenance circuit. | |
| jsonb | tseytin_cnf_mapping_json (UUID token) |
| Map each DIMACS variable of tseytin_cnf back to its provenance input. | |
| TABLE | tseytin_cnf_mapping (UUID token) |
| TEXT | tree_decomposition_dot (UUID token) |
| Return a DOT visualisation of the tree decomposition of the provenance circuit. | |
| BOOLEAN | tool_available (TEXT name) |
| Report whether an external tool is on the backend's resolved PATH. | |
| CREATE TABLE IF NOT EXISTS | tool_overrides (name TEXT PRIMARY KEY, removed BOOLEAN NOT NULL DEFAULT false, kind TEXT, executable TEXT, operations TEXT[], input_formats TEXT[], output_format TEXT, parser TEXT, preference INT, enabled BOOLEAN, dependencies TEXT[], argtpl TEXT, argtpl_circuit TEXT, endpoint TEXT) |
| Persistent overrides overlaid on the compiled-in tool seed. | |
| TABLE | tool_registry_list () |
Set-returning listing backing the provsql.tools view. | |
| VOID | register_tool (TEXT name, TEXT executable=NULL, TEXT kind='cli', TEXT[] operations=NULL, TEXT[] input_formats=NULL, TEXT output_format=NULL, TEXT parser=NULL, TEXT argtpl=NULL, TEXT argtpl_circuit=NULL, INT preference=0, BOOLEAN enabled=true, TEXT endpoint=NULL) |
| Register a tool, or replace the RECORD with the same logical name. | |
| VOID | unregister_tool (TEXT name) |
| Unregister a tool; errors on an unknown tool name. | |
| VOID | set_tool_enabled (TEXT name, BOOLEAN enabled) |
| Enable/disable a tool; errors on an unknown tool name. | |
| VOID | set_tool_preference (TEXT name, INT preference) |
| Set a tool's preference; errors on an unknown tool name. | |
| TEXT | to_provxml (UUID token, REGCLASS token2desc=NULL) |
| Return an XML representation of the provenance circuit. | |
| UUID | provenance () |
| Return the provenance token of the current query result tuple. | |
| TEXT | where_provenance (UUID token) |
| Compute where-provenance for a result tuple. | |
| VOID | reset_constants_cache () |
| Reset the internal cache of OID constants used by the query rewriter. | |
| VARCHAR | sr_formula (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance as a symbolic formula (e.g., "a ⊗ b ⊕ c"). | |
| INT | sr_counting (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance over the counting semiring (ℕ). | |
| VARCHAR | sr_why (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance as why-provenance (set of witness sets). | |
| VARCHAR | sr_how (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance as how-provenance (canonical polynomial provenance ℕ[X], universal commutative-semiring provenance). | |
| VARCHAR | sr_which (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance as which-provenance (lineage: a single set of contributing labels). | |
| VARCHAR | sr_boolexpr (ANYELEMENT token, REGCLASS token2value=NULL) |
| Evaluate provenance as a Boolean expression. | |
| BOOLEAN | sr_boolean (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance over the Boolean semiring (true/false). | |
| BOOLEAN | true_nonzero (UUID token) |
| Structural universal-zero test (C backend of nonzero's default mode). | |
| BOOLEAN | nonzero (UUID token, TEXT semiring=NULL, REGCLASS mapping=NULL) |
| Test whether a provenance annotation is nonzero. | |
| BOOLEAN | present (UUID token) |
| Presence in the vanilla SQL answer on this instance. | |
| FLOAT | sr_tropical (ANYELEMENT token, REGCLASS token2value, BOOLEAN nonnegative=false) |
| Evaluate provenance over the tropical (min-plus) m-semiring. | |
| FLOAT | sr_viterbi (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance over the Viterbi (max-times) m-semiring. | |
| FLOAT | sr_lukasiewicz (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance over the Łukasiewicz fuzzy m-semiring. | |
| ANYENUM | sr_minmax (UUID token, REGCLASS token2value, ANYENUM element_one) |
| Evaluate provenance over the min-max m-semiring on a user ENUM. | |
| ANYENUM | sr_maxmin (UUID token, REGCLASS token2value, ANYENUM element_one) |
| Evaluate provenance over the max-min m-semiring on a user ENUM. | |
| ANYELEMENT | choose_function (ANYELEMENT state, ANYELEMENT data) |
| Transition function for the choose aggregate (keeps first non-NULL value). | |
| VOID | choose (ANYELEMENT) |
| Aggregate that returns an arbitrary non-NULL value from a group. | |
| VOID | explode_table (TEXT _tbl, TEXT AGG_TOKEN) |
| Explodes a table column containing aggregated provenance into multiple rows. | |
| TEXT | setup_search_path () |
Append provsql to this database's default search_path, if missing. | |
Order statistics over random_variable | |
Same-row They lower to a single PostgreSQL's built-in | |
| CREATE OR REPLACE FUNCTION | greatest (VARIADIC args random_variable[]) RETURNS random_variable AS CREATE OR REPLACE FUNCTION "least"(VARIADIC args random_variable[]) RETURNS random_variable AS random_variable rv_case(UUID[] children) |
| "greatest" / "least" are col_name keywords, so the CREATE FUNCTION name must be quoted; callers reach them qualified as provsql.greatest(...). | |
| AGG_TOKEN | agg_case (UUID[] children) |
Build an AGG_TOKEN from a guarded-selection gate_case. | |
Aggregates over random_variable | |
An overload of the standard Lives in the Direct calls outside a provenance-tracked query treat each row's contribution unconditionally (no per-row Boolean selector). When the planner hook sees a The internal state is the array of UUIDs of the per-row mixtures. The final function builds a single | |
| random_variable | rv_aggregate_semimod (UUID prov, random_variable rv) |
Per-row helper: wrap an RV in mixture(prov, rv, as_random(0)). | |
| random_variable | rv_aggregate_semimod (UUID prov, random_variable rv, DOUBLE PRECISION identity) |
| Identity-parameterised per-row wrap for an RV-returning aggregate. | |
| random_variable | rv_aggregate_indicator (UUID prov) |
Per-row denominator wrap for avg(random_variable): the provenance indicator \(\mathbf{1}\{\varphi\}\). | |
| random_variable | rv_aggregate_indicator (UUID prov, random_variable rv) |
| Value-aware presence indicator: NULL when the row's aggregated value is NULL. | |
| UUID[] | sum_rv_sfunc (UUID[] state, random_variable rv) |
State-transition function for sum(random_variable). | |
| random_variable | sum_rv_ffunc (UUID[] state) |
Final function for sum(random_variable): build a gate_arith PLUS root. | |
| VOID | sum (random_variable) |
| random_variable | rv_sum_or_null_ffunc (UUID[] state) |
Numerator final function for the avg rewrite: sum, but NULL on an empty group. | |
| VOID | rv_sum_or_null (random_variable) |
| random_variable | avg_rv_ffunc (UUID[] state) |
Final function for avg(random_variable). | |
| VOID | avg (random_variable) |
| random_variable | product_rv_ffunc (UUID[] state) |
Final function for product(random_variable): fold a gate_arith TIMES root over the per-row contributions. | |
| VOID | product (random_variable) |
| random_variable | extremum_rv_ffunc (UUID[] state, INTEGER op, DOUBLE PRECISION identity) |
Final function for max(random_variable) / min(random_variable): fold a gate_arith MAX / MIN root over the per-row contributions. | |
| random_variable | max_rv_ffunc (UUID[] state) |
| random_variable | min_rv_ffunc (UUID[] state) |
| VOID | max (random_variable) |
| VOID | min (random_variable) |
| UUID[] | rv_stat1_sfunc (UUID[] state, random_variable x) |
| SQL-standard statistic aggregates over random_variable rows: covar_pop / covar_samp / corr (two-argument), stddev_pop / stddev_samp (one-argument), and the ordered-set percentile_cont. | |
| UUID[] | rv_stat2_sfunc (UUID[] state, random_variable x, random_variable y) |
State transition for the two-argument RV statistic aggregates (covar_pop / covar_samp / corr): append the certain indicator and the row's RV pair as a triple. | |
| UUID[] | rv_stat1_impl_sfunc (UUID[] state, random_variable ind, random_variable x) |
Indicator-carrying state transition for the one-argument rv_*_impl statistic aggregates: the planner-hook rewrite passes the row's provenance indicator rv_aggregate_indicator(prov) as ind. | |
| UUID[] | rv_stat2_impl_sfunc (UUID[] state, random_variable ind, random_variable x, random_variable y) |
Indicator-carrying state transition for the two-argument rv_*_impl statistic aggregates. | |
| VOID | rv_stat_sum_tokens (UUID[] state, INTEGER stride, OUT UUID n_tok, OUT UUID sx_tok, OUT UUID sxx_tok, OUT UUID sy_tok, OUT UUID sxy_tok, OUT UUID syy_tok) |
| Mint the indicator-weighted power-sum gates shared by the covariance / stddev final functions. | |
| UUID | rv_stat_var_pop_token (UUID n_tok, UUID s_tok, UUID ss_tok) |
| Population-variance gate \(SXX/N - (SX/N)^2\) from the power-sum tokens. | |
| UUID | rv_stat_var_samp_token (UUID n_tok, UUID s_tok, UUID ss_tok) |
| Sample-variance gate \((SXX - SX^2/N) / (N - 1)\) from the power-sum tokens (NaN in a world with \(N \le 1\), the undefined-world convention). | |
| UUID | rv_stat_sqrt_token (UUID v_tok) |
| \(\sqrt{\max(v, 0)}\) gate over a variance token: the max-clamp removes the tiny negative values float error can produce (variance is mathematically non-negative), so the POW domain guard never fires. | |
| UUID | rv_stat_covar_pop_token (UUID n_tok, UUID sx_tok, UUID sy_tok, UUID sxy_tok) |
| Population-covariance gate \(SXY/N - (SX/N)(SY/N)\) from the power-sum tokens. | |
| random_variable | covar_pop_rv_ffunc (UUID[] state) |
Final function for covar_pop(random_variable, random_variable). | |
| random_variable | covar_samp_rv_ffunc (UUID[] state) |
Final function for covar_samp(random_variable, random_variable): \((SXY - SX\,SY/N) / (N-1)\). | |
| random_variable | corr_rv_ffunc (UUID[] state) |
Final function for corr(random_variable, random_variable): \(\mathrm{covar\_pop} / \sqrt{\max(v_x v_y, 0)}\) (a zero-variance world divides to \(\pm\infty\) / NaN, the undefined-world convention, matching SQL's NULL for a zero-stddev input). | |
| random_variable | stddev_pop_rv_ffunc (UUID[] state) |
Final function for stddev_pop(random_variable). | |
| random_variable | stddev_samp_rv_ffunc (UUID[] state) |
Final function for stddev_samp(random_variable). | |
| VOID | covar_pop (random_variable, random_variable) |
| VOID | covar_samp (random_variable, random_variable) |
| VOID | corr (random_variable, random_variable) |
| VOID | stddev_pop (random_variable) |
| VOID | stddev_samp (random_variable) |
| VOID | rv_covar_pop_impl (random_variable, random_variable, random_variable) |
| The indicator-carrying rewrite targets (planner hook only; never called directly by users). | |
| VOID | rv_covar_samp_impl (random_variable, random_variable, random_variable) |
| VOID | rv_corr_impl (random_variable, random_variable, random_variable) |
| VOID | rv_stddev_pop_impl (random_variable, random_variable) |
| VOID | rv_stddev_samp_impl (random_variable, random_variable) |
| random_variable | rv_percentile_make (DOUBLE PRECISION fraction, UUID[] pairs) |
Mint the PROVSQL_ARITH_PERCENTILE gate: the continuous percentile (SQL percentile_cont) over a group of RV rows. | |
| UUID[] | percentile_cont_rv_sfunc (UUID[] state, random_variable x) |
State transition for the public ordered-set percentile_cont(float8) WITHIN GROUP (ORDER BY random_variable): append the certain indicator and the row's RV. | |
| random_variable | percentile_cont_rv_ffunc (UUID[] state, DOUBLE PRECISION fraction) |
Final function for the public ordered-set percentile_cont: receives the direct fraction argument after the state. | |
| VOID | percentile_cont (DOUBLE PRECISION ORDER BY random_variable) |
| rv_percentile_state | rv_percentile_impl_sfunc (rv_percentile_state state, DOUBLE PRECISION fraction, random_variable ind, random_variable x) |
State transition for rv_percentile_impl, the planner-hook rewrite target of a provenance-tracked percentile_cont: stashes the (group-constant) fraction and appends the indicator/value pair. | |
| random_variable | rv_percentile_impl_ffunc (rv_percentile_state state) |
Final function for rv_percentile_impl. | |
| VOID | rv_percentile_impl (DOUBLE PRECISION, random_variable, random_variable) |
Variables | |
| DROP EVENT TRIGGER IF EXISTS | provsql_cleanup_table_info |
| CREATE OR REPLACE VIEW tools AS SELECT | name |
| Read-only view of the registered tools. | |
| CREATE OR REPLACE VIEW tools AS SELECT | kind |
| CREATE OR REPLACE VIEW tools AS SELECT | executable |
| CREATE OR REPLACE VIEW tools AS SELECT | operations |
| CREATE OR REPLACE VIEW tools AS SELECT | input_formats |
| CREATE OR REPLACE VIEW tools AS SELECT | output_format |
| CREATE OR REPLACE VIEW tools AS SELECT | parser |
| CREATE OR REPLACE VIEW tools AS SELECT | preference |
| CREATE OR REPLACE VIEW tools AS SELECT | enabled |
| CREATE OR REPLACE VIEW tools AS SELECT | argtpl |
| CREATE OR REPLACE VIEW tools AS SELECT | argtpl_circuit |
| CREATE OR REPLACE VIEW tools AS SELECT | endpoint |
Arithmetic and comparison on random_variable | |
Each binary operator below is declared on This avoids the resolution ambiguity that would arise if both (rv, NUMERIC) and (rv, rv) overloads were declared while implicit casts also existed. Arithmetic operators build a Comparison operators are placeholders that return | |
| CREATE OPERATOR CLASS random_variable_ops DEFAULT FOR TYPE random_variable USING btree AS OPERATOR<, OPERATOR 2<=, OPERATOR 3=, OPERATOR 4 > | OPERATOR |
| random_variable | random_variable_plus (random_variable a, random_variable b) |
random_variable + random_variable (gate_arith PLUS). | |
| random_variable | random_variable_minus (random_variable a, random_variable b) |
random_variable - random_variable (gate_arith MINUS). | |
| random_variable | random_variable_times (random_variable a, random_variable b) |
random_variable * random_variable (gate_arith TIMES). | |
| random_variable | random_variable_div (random_variable a, random_variable b) |
random_variable / random_variable (gate_arith DIV). | |
| random_variable | random_variable_neg (random_variable a) |
Unary -random_variable (gate_arith NEG). | |
| random_variable | random_variable_pow (random_variable a, random_variable b) |
random_variable ^ random_variable (gate_arith POW). | |
| random_variable | ln (random_variable a) |
Natural logarithm of a random_variable (gate_arith LN). | |
| random_variable | exp (random_variable a) |
e^x for a random_variable (gate_arith EXP). | |
| random_variable | pow (random_variable a, random_variable b) |
pow / power spellings of the ^ operator, mirroring PostgreSQL's NUMERIC surface. | |
| random_variable | power (random_variable a, random_variable b) |
| random_variable | sqrt (random_variable a) |
Square root of a random_variable: sugar for x ^ 0.5 (no gate or opcode of its own). | |
| oid | random_variable_cmp_oid (TEXT sym) |
| Internal helper: float8-comparator OID for a given symbol. | |
| BOOLEAN | random_variable_cmp_placeholder (random_variable a, random_variable b) |
| Placeholder body shared by every random_variable_* comparison procedure. | |
| BOOLEAN | random_variable_lt (random_variable a, random_variable b) |
| BOOLEAN | random_variable_le (random_variable a, random_variable b) |
| BOOLEAN | random_variable_eq (random_variable a, random_variable b) |
| BOOLEAN | random_variable_ne (random_variable a, random_variable b) |
| BOOLEAN | random_variable_ge (random_variable a, random_variable b) |
| BOOLEAN | random_variable_gt (random_variable a, random_variable b) |
| UUID | rv_cmp_lt (random_variable a, random_variable b) |
Build a gate_cmp for a < b and return its UUID. | |
| UUID | rv_cmp_le (random_variable a, random_variable b) |
Build a gate_cmp for a ≤ b and return its UUID. | |
| UUID | rv_cmp_eq (random_variable a, random_variable b) |
Build a gate_cmp for a = b and return its UUID. | |
| UUID | rv_cmp_ne (random_variable a, random_variable b) |
Build a gate_cmp for a <> b and return its UUID. | |
| UUID | rv_cmp_ge (random_variable a, random_variable b) |
Build a gate_cmp for a ≥ b and return its UUID. | |
| UUID | rv_cmp_gt (random_variable a, random_variable b) |
Build a gate_cmp for a > b and return its UUID. | |
| BOOLEAN | random_variable_op_random_variable (random_variable left, random_variable right) |
Prefix unary minus on random_variable. | |
| BOOLEAN | random_variable_lt_random_variable (random_variable left, random_variable right) |
| BOOLEAN | random_variable_le_random_variable (random_variable left, random_variable right) |
| BOOLEAN | random_variable_eq_random_variable (random_variable left, random_variable right) |
| BOOLEAN | random_variable_ne_random_variable (random_variable left, random_variable right) |
| BOOLEAN | random_variable_ge_random_variable (random_variable left, random_variable right) |
| BOOLEAN | random_variable_gt_random_variable (random_variable left, random_variable right) |
| INTEGER | random_variable_btree_cmp (random_variable a, random_variable b) |
btree comparison support for random_variable – always an error. | |
| random_variable | random_variable_cond (random_variable rv, UUID cond) |
Condition a random variable on an event: "X | C". | |
| BOOLEAN | random_variable_op_uuid (random_variable left, UUID right) |
| random_variable | random_variable_cond_predicate (random_variable rv, BOOLEAN predicate) |
Placeholder for "X | (predicate)" – conditioning a random variable on a Boolean comparison written naturally. | |
| BOOLEAN | random_variable_op_boolean (random_variable left, BOOLEAN right) |
| UUID | rv_conditioned_target (UUID token) |
| Unpack the target of a random-variable conditioning gate. | |
| UUID | rv_conditioned_prov (UUID token, UUID prov) |
Combine a conditioning gate's event with an explicit prov. | |
| UUID | evidence_as_observation (UUID ev) |
| Internal: rewrite a point-equality conditioning event into an observation. | |
| UUID | observe (random_variable x, DOUBLE PRECISION datum) |
Internal: bind an observed datum to a random-variable leaf – the likelihood-weighting evidence behind "X | (Y = d)". | |
| UUID | and_agg_sfunc (UUID state, UUID ev) |
Conjunction state function for and_agg (evidence gate_times). | |
| VOID | and_agg (UUID) |
| Conjoin per-row evidence tokens into one evidence circuit. | |
| DOUBLE PRECISION | evidence (UUID evidence) |
Marginal likelihood P(data) of an evidence circuit. | |
| UUID[] | observe_atoms (UUID evidence) |
The observe atoms of an evidence circuit. | |
| TABLE | shapley_observe (UUID target, UUID evidence, TEXT payoff='expected') |
| Shapley attribution of each observation to a posterior moment. | |
provsql schema
All types and functions introduced by ProvSQL are defined in the provsql schema, requiring prefixing them by provsql. or using PostgreSQL's search_path variable with a command such as
Provenance circuit gate types.
Each gate in the provenance circuit has a type that determines its semantics during semiring evaluation.
| TEXT provsql.setup_search_path | ( | ) |
Append provsql to this database's default search_path, if missing.
ProvSQL's operators and functions live in the provsql schema and are resolved through search_path. When provsql is absent from the path some surfaces fail with a clear error (RV/AGG_TOKEN arithmetic), but others can be silently misrouted by an implicit cross-domain cast. This helper makes the common case painless: it reads the current database-level search_path setting from pg_db_role_setting, appends provsql if not already present (never replacing or reordering the existing entries), and applies the result with ALTER DATABASE. It is idempotent and emits a NOTICE describing what it did.
Only new sessions pick up the change; the calling session keeps its current path. Role-level settings (if any) take precedence over the database-level setting and are left untouched. The caller must be the database owner or a superuser (the privilege model of ALTER DATABASE). Returns the resulting search_path value.