Categorical-block probability and deterministic-OR soundness #
This file is the categorical-block counterpart of Provenance.Circuit's
decomposable + deterministic weighted-model-counting correctness theorem
(Circuit.dD_funcProb_eq_probDD): the same result re-proved over
categorical block variables instead of free Boolean variables. It is
an independent development (it shares no code with Provenance.Circuit; the
Boolean case is the κ ≡ fun _ => Bool instance of this one).
It is the formal counterpart of the verified mulinput-OR certificate
correctness-hardening item for ProvSQL's bounded-treewidth route (the
repair_key / BID block consumed by evaluateCertifiedIsland): that
evaluator marks a block's plus(mulinputs) deterministic and trusts the
mark: it plain-sums the alternatives, registers the block key once, and
reads the none-branch as monus(one, plus(mulinputs)) = 1 - Σ pᵢ. The
determinism of those state ORs is a global property the C++ does not check
locally. This development is the spec backing that trust, in the
probability / weighted-model-counting semantics.
Modeling choice (the crux) #
A block is modeled as one categorical random variable, not as
independent Booleans with an at-most-one constraint. Concretely we work
over a finite index ι of blocks, each block b : ι carrying a finite
outcome type κ b; a CatAssignment gives, per block, a probability
distribution P.prob b : κ b → ℚ summing to 1. A valuation
v : (b : ι) → κ b draws one outcome per block, with the blocks
independent: valProb v = ∏ b, P.prob b (v b).
A mulinput mᵢ of a block b is the event {v | v b = i}; the
none-branch is {v | v b = o} for a designated outcome o : κ b. With
this model the three block facts the C++ relies on are near-immediate
(mulin_disjoint, mulin_or_prob, mulin_none), and the deterministic-OR
sum is exact (singleBlock_detOR_sound).
Main definitions #
CatAssignment κ– a per-block categorical probability distribution.CatAssignment.valProb–Pr(v)for a categorical valuation, blocks independent.CatAssignment.eventProb–Pr(E)for an eventE : ((b : ι) → κ b) → Bool.EventDependsOn– support of an event (aFinsetof blocks).CatCircuit ι κ– Boolean circuits whose leaves are block-outcome literalslit b i(the event{v b = i}).CatCircuit.Decomposable/Deterministic/probDD– the d-D structural predicates and the direct-summation evaluator, exactly as inProvenance.Circuitbut over categorical blocks.
Main results #
CatAssignment.eventProb_and_disjoint– independence:Pr(E ∧ F) = Pr(E)·Pr(F)whenE,Fdepend on disjoint block sets.CatAssignment.eventProb_or,eventProb_not– inclusion-exclusion and complement.CatAssignment.eventProb_lit,eventProb_block_mem– leaf / marginal:Pr(v b = i) = pᵢandPr(v b ∈ S) = Σ_{i∈S} pᵢ.CatCircuit.dD_eventProb_eq_probDD– the lifted d-D soundness theorem:Pr(⟦c⟧) = probDD cfor decomposable + deterministic categorical circuits.CatAssignment.mulin_disjoint,mulin_or_prob,mulin_none– the three block lemmas backing the deterministic-OR mark and the1 - Σ pᵢnone-branch.CatAssignment.singleBlock_detOR_sound– single-block soundness: the plain sum of a block's mulinput marginals equals the probability the block fires.
References #
- Sen, Maniu & Senellart (Section V-D)
- Amarilli, Bourhis & Senellart, Provenance Circuits for Trees and Treelike Instances (ICALP 2015)
A categorical assignment: for each block b : ι, a probability
distribution prob b : κ b → ℚ over that block's finite outcome type. This
is the categorical analogue of ProbAssignment (where every block would be
a single Bool).
- prob (b : ι) : κ b → ℚ
The probability assigned to each outcome of each block.
Probabilities are non-negative.
Each block's outcome probabilities sum to
1.
Instances For
Each individual outcome probability is at most 1 (it is one summand of
a sum of non-negatives equal to 1).
Probability of an event E over categorical valuations:
Pr(E) = ∑_{v ⊨ E} Pr(v).
Instances For
The categorical valuations form a probability distribution:
∑ v, Pr(v) = 1.
Pr(false) = 0.
Pr(true) = 1.
Pointwise-equal events have equal probabilities.
Support of an event #
E depends only on the blocks in S: any two valuations agreeing on
S give E the same value. The categorical analogue of
BoolFunc.DependsOn.
Equations
- EventDependsOn E S = ∀ (v₁ v₂ : (b : ι) → κ b), (∀ b ∈ S, v₁ b = v₂ b) → E v₁ = E v₂
Instances For
Leaf / marginal probabilities #
Marginal. The probability that block b's outcome lies in a finset
S of outcomes is the sum of the corresponding marginals. The categorical
analogue of funcProb_var, proved by the same Fintype.prod_sum
column-swap.
Leaf. Pr(v b = i) = pᵢ.
Independence, inclusion-exclusion, complement #
Independence lemma. If E depends on block set S and F on block
set T with S, T disjoint, then Pr(E ∧ F) = Pr(E) · Pr(F). The
categorical analogue of funcProb_mul_disjoint; the deterministic-AND /
decomposability soundness.
Inclusion-exclusion. Pr(E ∨ F) = Pr(E) + Pr(F) - Pr(E ∧ F), with no
disjointness hypothesis. The categorical analogue of funcProb_add_eq.
Complement. Pr(¬E) = 1 - Pr(E).
Categorical circuits and d-D soundness #
A Boolean circuit whose variable leaves are block-outcome literals:
lit b i denotes the event {v | v b = i}. Otherwise identical to
Circuit.
- const
{ι : Type}
{κ : ι → Type}
: Bool → CatCircuit ι κ
A Boolean constant.
- lit
{ι : Type}
{κ : ι → Type}
(b : ι)
: κ b → CatCircuit ι κ
The leaf event
{v | v b = i}. - not
{ι : Type}
{κ : ι → Type}
: CatCircuit ι κ → CatCircuit ι κ
Logical negation.
- and
{ι : Type}
{κ : ι → Type}
: CatCircuit ι κ → CatCircuit ι κ → CatCircuit ι κ
Logical conjunction.
- or
{ι : Type}
{κ : ι → Type}
: CatCircuit ι κ → CatCircuit ι κ → CatCircuit ι κ
Logical disjunction.
Instances For
Evaluate a categorical circuit under a categorical valuation.
Equations
Instances For
The event a circuit denotes.
Instances For
The set of blocks a circuit reads (the categorical "variable support").
Equations
Instances For
Decomposable: every AND gate has children reading disjoint block sets.
- const {ι : Type} [DecidableEq ι] {κ : ι → Type} (x : Bool) : (CatCircuit.const x).Decomposable
- lit {ι : Type} [DecidableEq ι] {κ : ι → Type} (b : ι) (i : κ b) : (CatCircuit.lit b i).Decomposable
- not {ι : Type} [DecidableEq ι] {κ : ι → Type} {c : CatCircuit ι κ} : c.Decomposable → c.not.Decomposable
- and {ι : Type} [DecidableEq ι] {κ : ι → Type} {c d : CatCircuit ι κ} : c.Decomposable → d.Decomposable → Disjoint c.blocks d.blocks → (c.and d).Decomposable
- or {ι : Type} [DecidableEq ι] {κ : ι → Type} {c d : CatCircuit ι κ} : c.Decomposable → d.Decomposable → (c.or d).Decomposable
Instances For
Deterministic: every OR gate has children that are mutually exclusive
as events (their conjunction is unsatisfiable). This is the categorical
deterministic-OR mark: for the mulinput-OR of one block it is supplied by
mulin_disjoint.
- const {ι : Type} {κ : ι → Type} [(b : ι) → DecidableEq (κ b)] (x : Bool) : (CatCircuit.const x).Deterministic
- lit {ι : Type} {κ : ι → Type} [(b : ι) → DecidableEq (κ b)] (b : ι) (i : κ b) : (CatCircuit.lit b i).Deterministic
- not {ι : Type} {κ : ι → Type} [(b : ι) → DecidableEq (κ b)] {c : CatCircuit ι κ} : c.Deterministic → c.not.Deterministic
- and {ι : Type} {κ : ι → Type} [(b : ι) → DecidableEq (κ b)] {c d : CatCircuit ι κ} : c.Deterministic → d.Deterministic → (c.and d).Deterministic
- or {ι : Type} {κ : ι → Type} [(b : ι) → DecidableEq (κ b)] {c d : CatCircuit ι κ} : c.Deterministic → d.Deterministic → (∀ (v : (b : ι) → κ b), (c.eval v && d.eval v) = false) → (c.or d).Deterministic
Instances For
The d-D direct-summation evaluator (categorical). Differs from a read-once evaluator only at OR gates, which sum directly.
Equations
- CatCircuit.probDD P (CatCircuit.const true) = 1
- CatCircuit.probDD P (CatCircuit.const false) = 0
- CatCircuit.probDD P (CatCircuit.lit b i) = P.prob b i
- CatCircuit.probDD P c.not = 1 - CatCircuit.probDD P c
- CatCircuit.probDD P (c.and d) = CatCircuit.probDD P c * CatCircuit.probDD P d
- CatCircuit.probDD P (c.or d) = CatCircuit.probDD P c + CatCircuit.probDD P d
Instances For
A circuit's event depends only on the blocks it reads.
Lifted d-D soundness theorem. For any decomposable + deterministic
categorical circuit c, the direct-summation evaluator c.probDD P agrees
with the weighted-model-counting semantics Pr(⟦c⟧). This is
Circuit.dD_funcProb_eq_probDD lifted from free Boolean variables to
categorical block variables: AND uses eventProb_and_disjoint
(decomposability), OR uses eventProb_or with the determinism hypothesis
collapsing the inclusion-exclusion term, NOT uses eventProb_not.
The three block lemmas and single-block soundness #
The payload backing evaluateCertifiedIsland's trust in the
deterministic-OR mark of a repair_key block. A block is b : ι; its
outcomes are κ b, with a designated none-outcome o : κ b and the
mulinputs being all other outcomes i ∈ univ.erase o, with marginals
pᵢ = P.prob b i.
mulin_disjoint. Distinct mulinputs of one block are mutually
exclusive events: this is what licenses marking the block's mulinput-OR
deterministic (CatCircuit.Deterministic.or).
mulin_or_prob. The probability that block b fires some mulinput
(its outcome is not the none-outcome o) is the exact sum of the mulinput
marginals: the plain sum evaluateCertifiedIsland computes is exact.
mulin_none. The none-branch probability is 1 - Σ pᵢ, the
monus(one, plus(mulinputs)) the evaluator reads.
Single-block soundness. Plain-summing the marginals of a block's
mulinputs (exactly what evaluateCertifiedIsland does for the marked
deterministic OR) equals the probability that the block fires. Combines
eventProb_lit and mulin_or_prob; it is the single-block instance of
CatCircuit.dD_eventProb_eq_probDD.