ProvSQL 1.7.0
What's new in 1.7.0
Major release headlining two additions: a knowledge-compilation
surface that opens up ProvSQL's probability backend to a wide
range of external compilers and model counters with full
introspection of every intermediate artifact, and provenance for
recursive queries (WITH RECURSIVE) lowered transparently to a
provenance fixpoint on PostgreSQL 15+.
This is a pure SQL-surface release on the upgrade path: no new gate
types (the persisted provenance_gate enum is unchanged), no mmap
circuit-format change, and no in-place migration of existing tracked
relations. ALTER EXTENSION provsql UPDATE from 1.6.0 only installs
the new functions and replaces the body of the circuit_subgraph
introspection helper.
Knowledge compilation
A new family of functions exposes every stage of the pipeline behind
probability_evaluate, so a query's Boolean provenance can be
compiled, inspected, and round-tripped against external tools:
- CNF / d-DNNF introspection.
tseytin_cnf(token)returns the
exact DIMACS CNF (Tseytin transformation) the extension feeds to
external counters, with optional weight lines andc input
comments;tseytin_cnf_mapping/tseytin_cnf_mapping_jsonmap
each DIMACS variable back to its provenance input.
compile_to_ddnnf(token, compiler)returns the compiled d-DNNF in
the c2d / d4.nnfinterchange format (same variable numbering as
the CNF),compile_to_ddnnf_dotrenders it as GraphViz DOT, and
ddnnf_statsreports its structural statistics (node / edge / gate
counts, smoothness, depth, treewidth, compile time) asjsonb. - Tree-decomposition introspection.
tree_decomposition_dot(token)
renders the min-fill decomposition used by the in-process compiler,
annotated with its treewidth. - More compilers and counting backends. New external d-DNNF
compilersd4v2and Panini (KCBox) with target languages OBDD,
OBDD[AND], and Decision-DNNF (R2-D2 / CCDD were evaluated and
dropped: their kernelize nodes break d-DNNF decomposability). New
weighted-model-counting backends Ganak, SharpSAT-TD, and
DPMC joinweightmcunder thewmcumbrella. In-process
production routestree-decomposition,interpret-as-dd, and
defaultround out the choices. provsql.fallback_compilerGUC. Selects the compilermakeDD
falls back to afterinterpretAsDDand tree-decomposition both
decline (defaultd4).tool_available(name). Reports whether an external tool
resolves on the backend's PATH, honouringprovsql.tool_search_path
and using the same resolver the compilers and counters consult, so
the answer matches what a subsequentprobability_evaluatewould
see.probability_benchmark(token). Times every probability-
evaluation method on one circuit (independent, possible-worlds,
tree-decomposition, Monte-Carlo, each compiler, each WMC backend),
capturing per-method errors so the comparison table is always
complete.- Backend hardening. The compiled d-DNNF is simplified after
external compilation, gates are iterated in a deterministic order,
WMC result-line parsing scans right-to-left to tolerate trailing
diagnostics, andcircuit_subgraphnow reports the longest-path
(canonical circuit) depth rather than the shortest-path distance.
Recursive queries (WITH RECURSIVE)
The planner hook now lowers a recursive CTE whose body touches
provenance-tracked relations into a naive bottom-up provenance
fixpoint (the eval_recursive driver), evaluated through ProvSQL's
normal rewriting so the recursive join yields times, the untracked
base yields gate_one, and the UNION yields the plus merge of
alternative derivations.
- On acyclic input the structural fixpoint is reached and the
circuit is the universal provenance, sound for any semiring. - On cyclic input under
provsql.boolean_provenance(an
absorptive setting) evaluation stops at the value-fixpoint bound,
yielding a circuit sound for absorptive evaluation; otherwise a
max_iterguard trips. - Gated to PostgreSQL 15+ (the lowering uses
pg_get_querydefand
pg_analyze_and_rewrite_fixedparams); on earlier majors recursive
CTEs over tracked relations keep raising the unsupported error. - Unsupported recursion shapes are rejected cleanly: a recursive term
carrying a set-returning function in its target list now raises the
unsupported error instead of crashing the planner.
Correctness and robustness fixes
- MMap worker out-of-bounds. The background worker's
getChildrenhandler took&children[0]on a leaf gate's empty
child vector (undefined behaviour, fatal under a libstdc++
assertions build); it now useschildren.data(). foldSemiringIdentitiessingle-wire collapse. Parents are
rewired instead of duplicating a shared input leaf, fixing
over-counting of non-read-once probabilities under
provsql.boolean_provenance.- Safe-query PK-FD key collision. PK-FD safe queries now group on
the FD-determined value, so colliding keys stay read-once. - UNION mixing untracked and tracked branches. The untracked
branch synthesisesgate_one()instead of raising. count_cmpPoisson-binomial pre-pass generalised to product /
monus contributors with disjoint private leaves, not just single
input leaves.- External-tool cancellation. Tools run in their own process
group and areSIGKILLed on cancel, sostatement_timeoutis
honoured; an RAII guard removes the temp directory on throw (no
/tmpleak).
Continuous random variables
expected / variance / moment / central_moment / support /
rv_sample now also apply to agg and semimod gates, extending the
moment / sample / profile surface over aggregated random variables.
Window functions (documented limitation)
Window functions remain unsupported: they execute and carry tuple
provenance through, but the windowed computation gets no aggregate-
provenance semantics. process_query now emits a warning once per
rewritten query level that uses window functions over tracked
relations, and a top-level window function forces the
classify_top_level verdict to OPAQUE.
Documentation
New knowledge-compilation user-manual chapter walking the full
SQL → circuit → CNF → d-DNNF → probability pipeline, and Case
Study 7 (peer-review assignment and knowledge compilation, with a
PG15+ recursive-reachability section) with a pg_regress fixture. A
case-study overview page surfaces the up-to-date feature-coverage
matrix.
Upgrade
ALTER EXTENSION provsql UPDATE from 1.6.0 installs the new functions
and replaces circuit_subgraph; no enum or mmap-format change, and no
metadata migration. The extension_upgrade regression canary now
exercises the 1.7.0 surface (tseytin_cnf_mapping, tool_available)
on the full 1.0.0 → 1.7.0 upgrade chain.