ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
CaseCmpExpander.h
Go to the documentation of this file.
1
/**
2
* @file CaseCmpExpander.h
3
* @brief Expansion of a comparison one of whose operands is a guarded
4
* selection (@c gate_case) into the comparisons of its arms.
5
*
6
* A @c gate_case is the value of the first arm whose guard holds, and
7
* nothing in the semiring combines the value gates of its arms: a
8
* @c gate_cmp over one is what the Boolean translation meets and refuses
9
* ("This semiring does not support value gates"). The comparison it stands
10
* for is nonetheless an ordinary Boolean combination, since exactly one arm
11
* is selected in each world:
12
*
13
* @code
14
* CASE(g₁,v₁, …, g_k,v_k, d) ⋈ O
15
* = ⊕ᵢ (⊗ⱼ<ᵢ ¬gⱼ) ⊗ gᵢ ⊗ (vᵢ ⋈ O) ⊕ (⊗ⱼ ¬gⱼ) ⊗ (d ⋈ O)
16
* @endcode
17
*
18
* where @c ¬g is @c "𝟙 ⊖ g". The terms are mutually exclusive by the prefix
19
* of negated guards, so the @c ⊕ is a disjoint union in every semiring that
20
* reads these gates as Boolean events. Each arm comparison is then an
21
* ordinary one -- an aggregate against the other operand, which the
22
* closed-form pre-passes and the possible-world enumeration resolve as they
23
* always have -- and a comparison between two constants is decided here.
24
*
25
* The pass runs first in @c resolveComparators so the comparisons it creates
26
* are seen by every later pre-pass. A comparison of two guarded selections
27
* takes one round per side; nested ones, one round per level.
28
*/
29
#ifndef PROVSQL_CASE_CMP_EXPANDER_H
30
#define PROVSQL_CASE_CMP_EXPANDER_H
31
32
#include "
GenericCircuit.h
"
33
34
namespace
provsql
{
35
36
/**
37
* @brief Expand every @c gate_cmp with a @c gate_case operand in @p gc.
38
*
39
* @param gc Circuit to mutate in place.
40
* @return Number of comparisons expanded.
41
*/
42
unsigned
runCaseCmpExpander
(GenericCircuit &gc);
43
44
}
// namespace provsql
45
46
#endif
// PROVSQL_CASE_CMP_EXPANDER_H
GenericCircuit.h
Semiring-agnostic in-memory provenance circuit.
provsql
Definition
AggMarginalEvaluator.cpp:27
provsql::runCaseCmpExpander
unsigned runCaseCmpExpander(GenericCircuit &gc)
Expand every gate_cmp with a gate_case operand in gc.
Definition
CaseCmpExpander.cpp:141
Home
·
Documentation
·
Publications
·
Contributors
·
Source
·
Cite