Documentation

Provenance.QueryRewriting

def Query.rewriting {T : Type} {n : } {K : Type} [ValueType T] (q : Query T n) (hq : q.noAgg) :
Query (T K) (n + 1)
Equations
Instances For
    theorem Query.rewriting_valid_prod_heqn {n₁ n₂ n : } (hn : n₁ + n₂ = n) :
    n₁ + 1 + (n₂ + 1) = n + 2
    theorem Query.rewriting_valid_prod0 {K T : Type} [Mul K] {n₁ n₂ n : } (hn : n₁ + n₂ = n) (heq : (Fin (n₁ + n₂)T) = (Fin nT)) (ar₁ : AnnotatedRelation T K n₁) (ar₂ : AnnotatedRelation T K n₂) :
    AnnotatedRelation.toComposite (Multiset.map (fun (x : AnnotatedTuple T K n₁ × AnnotatedTuple T K n₂) => (cast heq (Fin.append x.1.1 x.2.1), x.1.2 * x.2.2)) (Multiset.product ar₁ ar₂)) = Relation.cast (AnnotatedRelation.toComposite (Multiset.map (fun (x : AnnotatedTuple T K n₁ × AnnotatedTuple T K n₂) => (Fin.append x.1.1 x.2.1, x.1.2 * x.2.2)) (Multiset.product ar₁ ar₂)))
    theorem cast_apply {T : Type} {n : } {α : Sort u_1} {m : } (f : Tuple T nα) (t : Tuple T m) (hn : n = m) :
    cast f t = f (Tuple.cast t)
    theorem Query.rewriting_valid_prod1 {T K : Type} {n₂ n₁ n : } [ValueType (T K)] (hn : n₁ + 1 + (n₂ + 1) = n + 2) (f : Tuple (T K) (n + 2)Tuple (T K) (n + 1)) (r : Relation (T K) (n₁ + 1 + (n₂ + 1))) :
    Multiset.map f (Relation.cast hn r) = Multiset.map (fun (t : Tuple (T K) (n₁ + 1 + (n₂ + 1))) => f (Tuple.cast hn t)) r
    theorem Query.rewriting_append_left {T : Type} {n₁ n₂ n : } (t₁ : Tuple T n₁) (t₂ : Tuple T n₂) (hn : n₁ + n₂ = n) (k : Fin n) (hk : k < n₁) :
    Eq.rec (motive := fun (x : ) (h : n₁ + n₂ = x) => Fin xT) (Fin.append t₁ t₂) hn k = t₁ (k.castLT hk)
    theorem Query.rewriting_append_right {T : Type} {n₁ n₂ n : } (t₁ : Tuple T n₁) (t₂ : Tuple T n₂) (hn : n₁ + n₂ = n) (k : Fin n) (hk : ¬k < n₁) :
    Eq.rec (motive := fun (x : ) (h : n₁ + n₂ = x) => Fin xT) (Fin.append t₁ t₂) hn k = t₂ k - n₁,