Equations
- (Term.const a).repr x✝ = reprArg a
- (#k).repr x✝ = Std.Format.text "#" ++ reprArg k
- (t₁.add t₂).repr x✝ = Repr.addAppParen (t₁.repr x✝ ++ Std.Format.text "+" ++ t₂.repr x✝) x✝
- (t₁.sub t₂).repr x✝ = Repr.addAppParen (t₁.repr x✝ ++ Std.Format.text "-" ++ t₂.repr x✝) x✝
- (t₁.mul t₂).repr x✝ = Repr.addAppParen (t₁.repr x✝ ++ Std.Format.text "*" ++ t₂.repr x✝) x✝
Instances For
Equations
- (Term.const c).castToAnnotatedTuple = Term.const (Sum.inl c)
- (#k).castToAnnotatedTuple = #(k.castLT ⋯)
- (t₁.add t₂).castToAnnotatedTuple = t₁.castToAnnotatedTuple.add t₂.castToAnnotatedTuple
- (t₁.sub t₂).castToAnnotatedTuple = t₁.castToAnnotatedTuple.sub t₂.castToAnnotatedTuple
- (t₁.mul t₂).castToAnnotatedTuple = t₁.castToAnnotatedTuple.mul t₂.castToAnnotatedTuple
Instances For
Equations
Instances For
theorem
Term.castToAnnotatedTuple_eval
{T : Type}
[ValueType T]
{K : Type}
{n : ℕ}
[HasAltLinearOrder K]
[SemiringWithMonus K]
(t : Term T n)
(tuple : Tuple T n)
(α : K)
:
Equations
- instCoeTerm = { coe := fun (a : T) => Term.const a }
Equations
- instOfNatTermNat = { ofNat := Term.const a }
Equations
- «term#_» = Lean.ParserDescr.node `«term#_» 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "#") (Lean.ParserDescr.cat `term 1024))
Instances For
- EQ {T : Sort u_1} {n : ℕ} : Term T n → Term T n → BoolTerm T n
- NE {T : Sort u_1} {n : ℕ} : Term T n → Term T n → BoolTerm T n
- LE {T : Sort u_1} {n : ℕ} : Term T n → Term T n → BoolTerm T n
- LT {T : Sort u_1} {n : ℕ} : Term T n → Term T n → BoolTerm T n
- GE {T : Sort u_1} {n : ℕ} : Term T n → Term T n → BoolTerm T n
- GT {T : Sort u_1} {n : ℕ} : Term T n → Term T n → BoolTerm T n
Instances For
Equations
- (BoolTerm.EQ t₁ t₂).repr x✝ = Repr.addAppParen (t₁.repr x✝ ++ Std.Format.text "==" ++ t₂.repr x✝) x✝
- (BoolTerm.NE t₁ t₂).repr x✝ = Repr.addAppParen (t₁.repr x✝ ++ Std.Format.text "!=" ++ t₂.repr x✝) x✝
- (BoolTerm.LE t₁ t₂).repr x✝ = Repr.addAppParen (t₁.repr x✝ ++ Std.Format.text "<=" ++ t₂.repr x✝) x✝
- (BoolTerm.LT t₁ t₂).repr x✝ = Repr.addAppParen (t₁.repr x✝ ++ Std.Format.text "<" ++ t₂.repr x✝) x✝
- (BoolTerm.GE t₁ t₂).repr x✝ = Repr.addAppParen (t₁.repr x✝ ++ Std.Format.text ">=" ++ t₂.repr x✝) x✝
- (BoolTerm.GT t₁ t₂).repr x✝ = Repr.addAppParen (t₁.repr x✝ ++ Std.Format.text ">" ++ t₂.repr x✝) x✝
Instances For
Equations
- instReprBoolTerm = { reprPrec := BoolTerm.repr }
Equations
- (BoolTerm.EQ a b).castToAnnotatedTuple = BoolTerm.EQ a.castToAnnotatedTuple b.castToAnnotatedTuple
- (BoolTerm.NE a b).castToAnnotatedTuple = BoolTerm.NE a.castToAnnotatedTuple b.castToAnnotatedTuple
- (BoolTerm.LE a b).castToAnnotatedTuple = BoolTerm.LE a.castToAnnotatedTuple b.castToAnnotatedTuple
- (BoolTerm.LT a b).castToAnnotatedTuple = BoolTerm.LT a.castToAnnotatedTuple b.castToAnnotatedTuple
- (BoolTerm.GE a b).castToAnnotatedTuple = BoolTerm.GE a.castToAnnotatedTuple b.castToAnnotatedTuple
- (BoolTerm.GT a b).castToAnnotatedTuple = BoolTerm.GT a.castToAnnotatedTuple b.castToAnnotatedTuple
Instances For
Equations
- «term_==__1» = Lean.ParserDescr.trailingNode `«term_==__1» 20 21 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " == ") (Lean.ParserDescr.cat `term 21))
Instances For
Equations
- «term_!=__1» = Lean.ParserDescr.trailingNode `«term_!=__1» 20 21 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " != ") (Lean.ParserDescr.cat `term 21))
Instances For
Equations
- «term_<=__1» = Lean.ParserDescr.trailingNode `«term_<=__1» 20 21 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " <= ") (Lean.ParserDescr.cat `term 21))
Instances For
Equations
- «term_<__1» = Lean.ParserDescr.trailingNode `«term_<__1» 20 21 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " < ") (Lean.ParserDescr.cat `term 21))
Instances For
Equations
- «term_>=__1» = Lean.ParserDescr.trailingNode `«term_>=__1» 20 21 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " >= ") (Lean.ParserDescr.cat `term 21))
Instances For
Equations
- «term_>__1» = Lean.ParserDescr.trailingNode `«term_>__1» 20 21 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " > ") (Lean.ParserDescr.cat `term 21))
Instances For
Equations
- (BoolTerm.EQ a b).eval tuple = (a.eval tuple = b.eval tuple)
- (BoolTerm.NE a b).eval tuple = (a.eval tuple ≠ b.eval tuple)
- (BoolTerm.LE a b).eval tuple = (a.eval tuple ≤ b.eval tuple)
- (BoolTerm.LT a b).eval tuple = (a.eval tuple < b.eval tuple)
- (BoolTerm.GE a b).eval tuple = (a.eval tuple ≥ b.eval tuple)
- (BoolTerm.GT a b).eval tuple = (a.eval tuple > b.eval tuple)
Instances For
theorem
BoolTerm.castToAnnotatedTuple_eval
{T : Type}
[ValueType T]
{K : Type}
{n : ℕ}
[HasAltLinearOrder K]
[SemiringWithMonus K]
(t : BoolTerm T n)
(tuple : Tuple T n)
(α : K)
:
t.castToAnnotatedTuple.eval (Fin.append (fun (k : Fin n) => Sum.inl (tuple k)) ![Sum.inr α]) = t.eval tuple
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- (Filter.BT t).repr x✝ = t.repr x✝
- f.Not.repr x✝ = Std.Format.text "¬" ++ Repr.addAppParen (f.repr x✝) x✝
- (t₁.And t₂).repr x✝ = Repr.addAppParen (t₁.repr x✝ ++ Std.Format.text "∧" ++ t₂.repr x✝) x✝
- (t₁.Or t₂).repr x✝ = Repr.addAppParen (t₁.repr x✝ ++ Std.Format.text "∨" ++ t₂.repr x✝) x✝
- Filter.True.repr x✝ = Std.Format.text "True"
Instances For
Equations
- instReprFilter = { reprPrec := Filter.repr }
Equations
- (Filter.BT t).castToAnnotatedTuple = Filter.BT t.castToAnnotatedTuple
- φ.Not.castToAnnotatedTuple = φ.castToAnnotatedTuple.Not
- (φ₁.And φ₂).castToAnnotatedTuple = φ₁.castToAnnotatedTuple.And φ₂.castToAnnotatedTuple
- (φ₁.Or φ₂).castToAnnotatedTuple = φ₁.castToAnnotatedTuple.Or φ₂.castToAnnotatedTuple
- Filter.True.castToAnnotatedTuple = Filter.True
Instances For
Equations
Instances For
theorem
Filter.castToAnnotatedTuple_eval
{T : Type}
[ValueType T]
{K : Type}
{n : ℕ}
[HasAltLinearOrder K]
[SemiringWithMonus K]
(φ : Filter T n)
(tuple : Tuple T n)
(α : K)
:
φ.castToAnnotatedTuple.eval (Fin.append (fun (k : Fin n) => Sum.inl (tuple k)) ![Sum.inr α]) = φ.eval tuple
Equations
- (Filter.BT t_1).evalDecidable t = t_1.evalDecidable t
- φ_1.Not.evalDecidable t = match φ_1.evalDecidable t with | isTrue h => isFalse ⋯ | isFalse h => isTrue ⋯
- (φ₁.And φ₂).evalDecidable t = match φ₁.evalDecidable t, φ₂.evalDecidable t with | isTrue h₁, isTrue h₂ => isTrue ⋯ | isFalse h, x => isFalse ⋯ | x, isFalse h => isFalse ⋯
- (φ₁.Or φ₂).evalDecidable t = match φ₁.evalDecidable t, φ₂.evalDecidable t with | isTrue h, x => isTrue ⋯ | x, isTrue h => isTrue ⋯ | isFalse h₁, isFalse h₂ => isFalse ⋯
- Filter.True.evalDecidable t = isTrue ⋯
Instances For
Equations
- instReprAggFunc.repr AggFunc.sum prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "AggFunc.sum")).group prec✝
Instances For
Equations
- instReprAggFunc = { reprPrec := instReprAggFunc.repr }
Equations
- AggFunc.sum.eval m = Multiset.fold addFn 0 m
Instances For
- Rel {T : Type} (n : ℕ) : String → Query T n
- Proj {T : Type} {n m : ℕ} : Tuple (Term T n) m → Query T n → Query T m
- Sel {T : Type} {n : ℕ} : Filter T n → Query T n → Query T n
- Prod {T : Type} {n₁ n₂ n : ℕ} {hn : n₁ + n₂ = n} : Query T n₁ → Query T n₂ → Query T n
- Sum {T : Type} {n : ℕ} : Query T n → Query T n → Query T n
- Dedup {T : Type} {n : ℕ} : Query T n → Query T n
- Diff {T : Type} {n : ℕ} : Query T n → Query T n → Query T n
- Agg {T : Type} {m n₁ n₂ : ℕ} : Tuple (Fin m) n₁ → Tuple (Term T m) n₂ → Tuple AggFunc n₂ → Query T m → Query T (n₁ + n₂)
Instances For
Equations
- One or more equations did not get rendered due to their size.
- (Query.Rel n s).repr x✝ = Std.Format.text s
- (Π ts q).repr x✝ = Std.Format.text "Π_" ++ Repr.addAppParen (ts.repr x✝) x✝ ++ Repr.addAppParen (q.repr x✝) x✝
- (σ φ q).repr x✝ = Std.Format.text "σ_" ++ Repr.addAppParen (φ.repr x✝) x✝ ++ Repr.addAppParen (q.repr x✝) x✝
- (q₁ × q₂).repr x✝ = Repr.addAppParen (q₁.repr x✝ ++ Std.Format.text "×" ++ q₂.repr x✝) x✝
- (q₁ ⊎ q₂).repr x✝ = Repr.addAppParen (q₁.repr x✝ ++ Std.Format.text "⊎" ++ q₂.repr x✝) x✝
- (ε q).repr x✝ = Std.Format.text "ε" ++ Repr.addAppParen (q.repr x✝) x✝
- (q₁ - q₂).repr x✝ = Repr.addAppParen (q₁.repr x✝ ++ Std.Format.text "-" ++ q₂.repr x✝) x✝
Instances For
Equations
- instReprQuery = { reprPrec := Query.repr }
Equations
Instances For
Equations
- (Query.Rel n s).noAggDecidable = isTrue True.intro
- (Π a q_2).noAggDecidable = match q_2.noAggDecidable with | isTrue h => isTrue ⋯ | isFalse h => isFalse ⋯
- (σ a q_2).noAggDecidable = match q_2.noAggDecidable with | isTrue h => isTrue ⋯ | isFalse h => isFalse ⋯
- (q₁ × q₂).noAggDecidable = match q₁.noAggDecidable, q₂.noAggDecidable with | isTrue h₁, isTrue h₂ => isTrue ⋯ | isFalse h₁, x => isFalse ⋯ | x, isFalse h₂ => isFalse ⋯
- (q₁ ⊎ q₂).noAggDecidable = match q₁.noAggDecidable, q₂.noAggDecidable with | isTrue h₁, isTrue h₂ => isTrue ⋯ | isFalse h₁, x => isFalse ⋯ | x, isFalse h₂ => isFalse ⋯
- (ε q_2).noAggDecidable = match q_2.noAggDecidable with | isTrue h => isTrue ⋯ | isFalse h => isFalse ⋯
- (q₁ - q₂).noAggDecidable = match q₁.noAggDecidable, q₂.noAggDecidable with | isTrue h₁, isTrue h₂ => isTrue ⋯ | isFalse h₁, x => isFalse ⋯ | x, isFalse h₂ => isFalse ⋯
- (Query.Agg a a_1 a_2 q_2).noAggDecidable = isFalse Query.noAggDecidable._proof_16
Instances For
Equations
- «termΠ_» = Lean.ParserDescr.node `«termΠ_» 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "Π ") (Lean.ParserDescr.cat `term 1024))
Instances For
Equations
- termσ_ = Lean.ParserDescr.node `termσ_ 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "σ ") (Lean.ParserDescr.cat `term 1024))
Instances For
Equations
- «term_×__2» = Lean.ParserDescr.trailingNode `«term_×__2» 80 81 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " × ") (Lean.ParserDescr.cat `term 81))
Instances For
Equations
- «term_⊎_» = Lean.ParserDescr.trailingNode `«term_⊎_» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊎ ") (Lean.ParserDescr.cat `term 51))
Instances For
Equations
- termε_ = Lean.ParserDescr.node `termε_ 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "ε ") (Lean.ParserDescr.cat `term 1024))
Instances For
Equations
- «term_-__1» = Lean.ParserDescr.trailingNode `«term_-__1» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " - ") (Lean.ParserDescr.cat `term 51))
Instances For
Equations
- «term_⋈_» = Lean.ParserDescr.trailingNode `«term_⋈_» 1020 1021 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⋈ ") (Lean.ParserDescr.cat `term 1021))
Instances For
Equations
- «term_∪__1» = Lean.ParserDescr.trailingNode `«term_∪__1» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ∪ ") (Lean.ParserDescr.cat `term 51))
Instances For
Equations
- (Query.Rel n s).aggdepth2_plus_depth = 0
- (Π a q_2).aggdepth2_plus_depth = q_2.aggdepth2_plus_depth + 1
- (σ a q_2).aggdepth2_plus_depth = q_2.aggdepth2_plus_depth + 1
- (q₁ × q₂).aggdepth2_plus_depth = max q₁.aggdepth2_plus_depth q₂.aggdepth2_plus_depth + 1
- (q₁ ⊎ q₂).aggdepth2_plus_depth = max q₁.aggdepth2_plus_depth q₂.aggdepth2_plus_depth + 1
- (ε q_2).aggdepth2_plus_depth = q_2.aggdepth2_plus_depth + 1
- (q₁ - q₂).aggdepth2_plus_depth = max q₁.aggdepth2_plus_depth q₂.aggdepth2_plus_depth + 1
- (Query.Agg a a_1 a_2 q_2).aggdepth2_plus_depth = q_2.aggdepth2_plus_depth + 3
Instances For
@[irreducible]
Equations
- One or more equations did not get rendered due to their size.
- (Query.Rel n s).evaluate d = match Database.find n s d with | none => ∅ | some rn => rn
- (Π a q_2).evaluate d = Multiset.map (fun (t : Tuple T n_3) (k : Fin n) => (a k).eval t) (q_2.evaluate d)
- (σ a q_2).evaluate d = Multiset.filter a.eval (q_2.evaluate d)
- (q₁ × q₂).evaluate d = Relation.cast hn (q₁.evaluate d * q₂.evaluate d)
- (q₁ ⊎ q₂).evaluate d = q₁.evaluate d + q₂.evaluate d
- (ε q_2).evaluate d = Multiset.dedup (q_2.evaluate d)
- (q₁ - q₂).evaluate d = q₁.evaluate d - q₂.evaluate d