Independent Boolean variables: probabilities, and weighted counts #
The concrete side of probabilistic query evaluation, with no logic in it: a
finite set X of independent Boolean variables – the uncertain facts of a
tuple-independent database – each true with its own rational probability.
The first part is taken from the library
provenance-lean
(Provenance.Probability), where it underlies the probabilistic semantics of
ProvSQL: DescriptiveComplexity.ProbAssignment, the probability
DescriptiveComplexity.ProbAssignment.valProb of a valuation (a possible
world), the fact that these form a distribution
(DescriptiveComplexity.ProbAssignment.sum_valProb_eq_one), and the
probability DescriptiveComplexity.ProbAssignment.funcProb of an event.
The second part is what the counting side needs. A probability a / (a + c)
is a pair of natural weights, a for “true” and c for “false”
(DescriptiveComplexity.ProbAssignment.ofWeights). The weighted count of
an event (DescriptiveComplexity.weightedCount) is the sum, over the
valuations in it, of the product of the weights each variable takes. Then
Pr(f) = weightedCount f / weightedCount ⊤
(DescriptiveComplexity.ProbAssignment.funcProb_ofWeights): a probability is
a ratio of two weighted counts, and those are natural numbers.
A probability assignment to a finite set X of Boolean variables: each
variable is assigned a rational probability in [0, 1].
- prob : X → ℚ
The probability assigned to each variable.
Probabilities are non-negative.
Probabilities are at most
1.
Instances For
Dependency graph
Probability of a single valuation v : X → Bool, under the independence
assumption: Pr(v) = ∏_{v(x)=⊤} Pr(x) · ∏_{v(x)=⊥} (1 - Pr(x)).
Instances For
Dependency graph
Dependency graph
Dependency graph
The valuations form a probability distribution: ∑ v, Pr(v) = 1.
Dependency graph
Probability of an event, a Boolean function of the valuation:
Pr(f) = ∑_{v ⊨ f} Pr(v).
Instances For
Dependency graph
Weights #
The weight of a valuation: the product, over the variables, of the weight
a of those it makes true and the weight c of those it makes false.
Instances For
Dependency graph
The weighted count of an event: the sum of the weights of the valuations in it.
Equations
- DescriptiveComplexity.weightedCount a c f = ∑ v : X → Bool, if f v = true then DescriptiveComplexity.valWeight a c v else 0
Instances For
Dependency graph
The probability assignment of a family of weights: the variable x is
true with probability a x / (a x + c x).
Equations
Instances For
Dependency graph
The probability of a valuation is its weight, over the product of the total weights.
Dependency graph
A probability is a ratio of two weighted counts: the probability of an event is its weighted count, divided by the weighted count of the sure event.