Documentation

Provenance.Semirings.Why

Why-provenance m-semiring Why[X] #

This file defines the Why provenance semiring Why α = Set (Set α). Elements are sets of subsets of α (representing sets of witnesses). Addition is union of families, and multiplication is pairwise union of witnesses.

Why α is idempotent but not absorptive when α is nonempty. It also does not satisfy left-distributivity of multiplication over monus, contradicting a claim in Amsterdamer, Deutch & Tannen, On the limitations of provenance for queries with differences, Table on p. 4.

References #

structure Why (α : Type) :
Instances For
    Dependency graph
    theorem Why.ext {α : Type} {x y : Why α} (carrier : x.carrier = y.carrier) :
    x = y
    Dependency graph
    theorem Why.ext_iff {α : Type} {x y : Why α} :
    Dependency graph
    @[instance_reducible]
    instance instCoeWhySet {α : Type} :
    Coe (Why α) (Set (Set α))
    Equations
    Dependency graph
    @[instance_reducible]
    instance instZeroWhy {α : Type} :
    Zero (Why α)
    Equations
    Dependency graph
    @[instance_reducible]
    instance instAddWhy {α : Type} :
    Add (Why α)
    Equations
    Dependency graph
    def why_mul {α : Type} (a b : Why α) :
    Why α
    Equations
    Instances For
      Dependency graph
      @[instance_reducible]
      Equations
      • One or more equations did not get rendered due to their size.
      Dependency graph
      @[instance_reducible]

      Why-provenance is a semiring with monus: is set difference on the outer level, 2^(2^X) ordered by inclusion.

      Named explicitly, and not to be renamed: this name is published as a link target in Sen, Maniu & Senellart, ProvSQL: A General System for Keeping Track of the Provenance and Probability of Data, ICDE 2026.

      Equations
      • One or more equations did not get rendered due to their size.
      Dependency graph
      @[instance_reducible]
      Equations
      Dependency graph
      Dependency graph
      Dependency graph
      instance Why.instCharPZero {α : Type} :
      CharP (Why α) 0

      Why α has characteristic 0 in the CharP sense: it is idempotent and nontrivial (⟨∅⟩ ≠ ⟨{∅}⟩), so every positive natural-number cast equals 1.

      Dependency graph
      theorem Why.not_absorptive {α : Type} (hNotEmpty : (x : α), ) :
      Dependency graph
      theorem Why.not_isDelta_id {α : Type} (hNotEmpty : (x : α), ) :

      On Why[X] with a non-empty variable set, the identity is not an admissible δ: delta_absorb at a = 𝟙 is absorptivity, which Why[X] lacks. This is why the instance takes the support indicator rather than ProvSQL's historical witness-preserving Why::delta.

      Dependency graph

      In Why[X], as long as X is non-empty, times is not distributive over monus. Note that this contradicts Amsterdamer, Deutch & Tannen, On the limitations of provenance for queries with differences, table page 4, which claims this semiring satisfies axiom A13.

      Dependency graph
      theorem Why.no_hom_from_BoolFunc {α Y : Type} [Inhabited Y] [Inhabited α] :
      (ν : YWhy α), ¬ (φ : BoolFunc Y →+* Why α), ∀ (i : Y), φ (BoolFunc.var i) = ν i

      There is no semiring homomorphism from BoolFunc Y to Why α (with α inhabited) sending the variables to arbitrary values: Why α is not absorptive (Why.not_absorptive), which contradicts var i + 1 = 1 in BoolFunc Y.

      Dependency graph
      theorem Why.counterexample_having {α : Type} [Inhabited α] :
      (t₁ : Why α), (t₂ : Why α), (t₃ : Why α), t₁ * t₂ * (1 - t₃) + t₁ * t₃ * (1 - t₂) + t₂ * t₃ * (1 - t₁) t₁ * t₂ + t₁ * t₃ + t₂ * t₃ - t₁ * t₂ * t₃

      The =-comparison correspondence fails in Why[X]. For a three-tuple group with occurrence annotations t₁, t₂, t₃, the fused HAVING (COUNT(*) = 2) predicate provenance is (t₁ ⊗ t₂) ⊗ (𝟙 ⊖ t₃) ⊕ (t₁ ⊗ t₃) ⊗ (𝟙 ⊖ t₂) ⊕ (t₂ ⊗ t₃) ⊗ (𝟙 ⊖ t₁), while the join-based rewriting Q₂^{≥2} − Q₂^{≥3} annotates the key with ((t₁ ⊗ t₂) ⊕ (t₁ ⊗ t₃) ⊕ (t₂ ⊗ t₃)) ⊖ (t₁ ⊗ t₂ ⊗ t₃). In Why[X] – idempotent, but without distributivity of over (Why.not_mul_sub_left_distributive) – the two disagree: with t₁ = t₂ = t₃ = ⟨{{a}}⟩ for any witness a, every product equals ⟨{{a}}⟩ and every factor 𝟙 ⊖ tᵢ equals 𝟙 (as ∅ ∉ {{a}}), so the fused side keeps the witness, ⟨{{a}}⟩, while on the join side the difference of the two -chains cancels it: ⟨{{a}}⟩ ⊖ ⟨{{a}}⟩ = 𝟘.

      Dependency graph