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
    theorem Why.ext_iff {α : Type} {x y : Why α} :
    theorem Why.ext {α : Type} {x y : Why α} (carrier : x.carrier = y.carrier) :
    x = y
    @[implicit_reducible]
    instance instCoeWhySet {α : Type} :
    Coe (Why α) (Set (Set α))
    Equations
    @[implicit_reducible]
    instance instZeroWhy {α : Type} :
    Zero (Why α)
    Equations
    @[implicit_reducible]
    instance instAddWhy {α : Type} :
    Add (Why α)
    Equations
    def why_mul {α : Type} (a b : Why α) :
    Why α
    Equations
    Instances For
      @[implicit_reducible]
      Equations
      • One or more equations did not get rendered due to their size.
      @[implicit_reducible]
      Equations
      • One or more equations did not get rendered due to their size.
      @[implicit_reducible]
      Equations
      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.

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

      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.

      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.

      theorem Why.counterexample_having :
      (t₁ : Why (Fin 2)), (t₂ : Why (Fin 2)), (t₃ : Why (Fin 2)), t₁ * t₂ * (1 - t₃) + t₁ * t₃ * (1 - t₂) + t₂ * t₃ * (1 - t₁) t₁ * t₂ + t₁ * t₃ + t₂ * t₃

      The two natural expansions of HAVING (count = 2) for a three-tuple group, (t₁ ⊗ t₂) ⊗ (𝟙 ⊖ t₃) ⊕ (t₁ ⊗ t₃) ⊗ (𝟙 ⊖ t₂) ⊕ (t₂ ⊗ t₃) ⊗ (𝟙 ⊖ t₁) and (t₁ ⊗ t₂) ⊕ (t₁ ⊗ t₃) ⊕ (t₂ ⊗ t₃), are inequivalent in Why[X]. With t₁ = ⟨{{0}}⟩, t₂ = ⟨{{1}}⟩, t₃ = ⟨{∅}⟩ = 𝟙 over X = Fin 2, the first expression has carrier {{0}, {1}} while the second has the strictly larger carrier {{0, 1}, {0}, {1}}. The witness set {0, 1} separates them.