While this submission is a draft, it cannot be used by other submissions.

The queries h₀ and ∃x y, R(x) ∧ S(x, y)

Lax794877.Queries · concepts/Lax794877/Queries.lean · lax-794877

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    The schema has a unary relation RR, a binary relation SS, and a unary relation TT. The query h0=∃x y, R(x)∧S(x,y)∧T(y)h_0 = \exists x\, y,\ R(x) \wedge S(x, y) \wedge T(y) is the smallest query whose probability is hard to compute, after Dalvi and Suciu; the query ∃x y, R(x)∧S(x,y)\exists x\, y,\ R(x) \wedge S(x, y) is hierarchical, on the easy side of their dichotomy.

    Concept map
    1 concept; 8 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Mathlib.Tactic.FinCases
    2import Mathlib.Data.Fintype.BigOperators
    3import Mathlib.Order.Lattice.Nat
    4import Mathlib.Data.Set.Card
    5import Mathlib.ModelTheory.Order
    6import Mathlib.ModelTheory.Semantics
    7import Mathlib.ModelTheory.Complexity
    8import Mathlib.Order.PiLex
    9import Mathlib.Data.Prod.Lex
    10import Mathlib.Data.Fintype.EquivFin
    11import Mathlib.Logic.Equiv.Fin.Basic
    12import Mathlib.Data.Finite.Sigma
    13import Mathlib.Data.Fintype.Lattice
    14import Mathlib.Data.Fintype.Pigeonhole
    15import Mathlib.Dynamics.FixedPoints.Basic
    16import Mathlib.Algebra.BigOperators.Finprod
    17import Mathlib.Algebra.Order.BigOperators.Group.Finset
    18import Mathlib.ModelTheory.Syntax
    19import Mathlib.Data.Fintype.Card
    20import Mathlib.SetTheory.Cardinal.Finite
    21import Mathlib.Data.Finset.Max
    22import Mathlib.Logic.Equiv.Prod
    23import Mathlib.Algebra.BigOperators.Group.Finset.Basic
    24import Mathlib.Algebra.BigOperators.Pi
    25import Mathlib.Algebra.BigOperators.Ring.Finset
    26import Mathlib.Algebra.BigOperators.Field
    27import Mathlib.Algebra.Order.BigOperators.Ring.Finset
    28import Mathlib.Algebra.Order.Ring.Rat
    29import Mathlib.Algebra.Order.Field.Basic
    30import Mathlib.Data.Fintype.Pi
    31import Mathlib.Tactic.Linarith
    32import Mathlib.Tactic.FieldSimp
    33import Mathlib.Tactic.Ring
    34import Mathlib.Data.Set.Finite.Lemmas
    35import Mathlib.Algebra.Group.Action.Defs
    36import Mathlib.ModelTheory.Graph
    37import Mathlib.Data.Fintype.Sort
    38import Mathlib.Order.Hom.Set
    39import Mathlib.Algebra.BigOperators.Fin
    40import Mathlib.Data.Nat.Bitwise
    41
    42/-!
    43---
    44title: The queries h₀ and ∃x y, R(x) ∧ S(x, y)
    45type: definition
    46---
    47The schema has a unary relation RR, a binary relation SS, and a unary
    48relation TT. The query h0=∃x y, R(x)∧S(x,y)∧T(y)h_0 = \exists x\, y,\ R(x) \wedge S(x, y) \wedge T(y)
    49 is the smallest query whose probability is hard to compute, after
    50Dalvi and Suciu; the query ∃x y, R(x)∧S(x,y)\exists x\, y,\ R(x) \wedge S(x, y) is
    51hierarchical, on the easy side of their dichotomy.
    52-/
    53
    54namespace Lax794877.Queries
    55
    56open FirstOrder
    57
    58open FirstOrder.Language
    59
    60/-- The relation symbols of the language. -/
    61inductive rstRel : ℕ → Type where
    62/-- `r a`. -/
    63 | r : rstRel 1
    64/-- `s a b`. -/
    65 | s : rstRel 2
    66/-- `t b`. -/
    67 | t : rstRel 1
    68 deriving DecidableEq
    69
    70/-- The schema of the example: two unary relations and a binary one. -/
    71def rst : FirstOrder.Language :=
    72 ⟨fun _ => Empty, rstRel⟩
    73
    74instance instIsRelationalRst : FirstOrder.Language.IsRelational rst := fun _ =>
    75 (inferInstance : IsEmpty Empty)
    76
    77/-- `r a`. -/
    78abbrev rstR : rst.Relations 1 :=
    79 .r
    80
    81/-- `s a b`. -/
    82abbrev rstS : rst.Relations 2 :=
    83 .s
    84
    85/-- `t b`. -/
    86abbrev rstT : rst.Relations 1 :=
    87 .t
    88
    89open FirstOrder
    90
    91open Language Structure
    92
    93instance instFiniteSigmaNatRelationsRst : Finite (Σ n, rst.Relations n) :=
    94 Finite.of_surjective
    95 (fun i : Fin 3 => match i with
    96 | 0 => (⟨1, rstR⟩ : Σ n, rst.Relations n)
    97 | 1 => ⟨2, rstS⟩
    98 | 2 => ⟨1, rstT⟩)
    99 (by
    100 rintro ⟨n, R⟩
    101 cases R
    102 · exact ⟨0, rfl⟩
    103 · exact ⟨1, rfl⟩
    104 · exact ⟨2, rfl⟩)
    105
    106/-- The query `h₀ = ∃ x y, R(x) ∧ S(x, y) ∧ T(y)`. -/
    107noncomputable def h0 : rst.Sentence :=
    108 FirstOrder.Language.Formula.iExs (Fin 2)
    109 (FirstOrder.Language.Relations.formula₁ rstR (FirstOrder.Language.Term.var (Sum.inr 0)) ⊓
    110 (FirstOrder.Language.Relations.formula₂ rstS (FirstOrder.Language.Term.var (Sum.inr 0))
    111 (FirstOrder.Language.Term.var (Sum.inr 1)) ⊓
    112 FirstOrder.Language.Relations.formula₁ rstT (FirstOrder.Language.Term.var (Sum.inr 1))))
    113
    114/-- The query `∃ x y, R(x) ∧ S(x, y)`. -/
    115noncomputable def rs : rst.Sentence :=
    116 FirstOrder.Language.Formula.iExs (Fin 2)
    117 (FirstOrder.Language.Relations.formula₁ rstR (FirstOrder.Language.Term.var (Sum.inr 0)) ⊓
    118 FirstOrder.Language.Relations.formula₂ rstS (FirstOrder.Language.Term.var (Sum.inr 0))
    119 (FirstOrder.Language.Term.var (Sum.inr 1)))
    120
    121end Lax794877.Queries
    122

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…