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

The quantitative logic ΣQSO(FO)

Lax366625.SecondOrderCounting · concepts/Lax366625/SecondOrderCounting.lean · lax-366625

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 terms of ΣQSO(FO), after Arenas, Muñoz, and Riveros, are built from first-order formulas, read as 11 when they hold and 00 otherwise, and from constants, by addition, multiplication, sums and products over tuples of elements, and sums over the assignments of a block of relation variables. Their value on a structure is computed accordingly. A counting problem CC over LL is ΣQSO(FO)-definable when some closed term over L∪{≤}L \cup \{\le\} has value C(A)C(A) on every nonempty finite LL-structure AA, for every linear order on AA.

    Concept map
    6 concepts; 12 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Mathlib.Algebra.BigOperators.Finprod
    2import Mathlib.Data.Fintype.Lattice
    3import Mathlib.ModelTheory.Order
    4import Mathlib.ModelTheory.Semantics
    5import Mathlib.ModelTheory.Complexity
    6import Mathlib.Tactic.FinCases
    7import Mathlib.SetTheory.Cardinal.Finite
    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.Order.Lattice.Nat
    14import Mathlib.Data.Set.Card
    15import Mathlib.Data.Fintype.Pigeonhole
    16import Mathlib.Dynamics.FixedPoints.Basic
    17import Mathlib.ModelTheory.Syntax
    18import Mathlib.Algebra.Order.BigOperators.Group.Finset
    19import Mathlib.Data.Fintype.Card
    20import Lax366625.CountingProblems
    21import Lax904597.SecondOrder
    22
    23/-!
    24---
    25title: The quantitative logic ΣQSO(FO)
    26type: definition
    27---
    28The terms of ΣQSO(FO), after Arenas, Muñoz, and Riveros, are built from
    29first-order formulas, read as 11 when they hold and 00 otherwise, and from
    30constants, by addition, multiplication, sums and products over tuples of
    31elements, and sums over the assignments of a block of relation variables.
    32Their value on a structure is computed accordingly. A counting problem CC
    33over LL is ΣQSO(FO)-definable when some closed term over
    34L∪{≤}L \cup \{\le\} has value C(A)C(A) on every nonempty finite LL-structure
    35AA, for every linear order on AA.
    36-/
    37
    38namespace Lax366625.SecondOrderCounting
    39
    40open Lax366625.CountingProblems Lax904597.SecondOrder
    41
    42open FirstOrder
    43
    44open Language Structure
    45
    46/-- **The terms of ΣQSO(FO)** over the vocabulary `L`, with free first-order
    47variables in `α`. A first-order quantifier binds a block of `n` variables at
    48once, the variables `Sum.inr i` of `α ⊕ Fin n`; a second-order sum binds the
    49relation variables of a block, the term under it being over the vocabulary
    50expanded by the block. -/
    51inductive SQTerm : Language.{0, 0} → Type → Type 1
    52 /-- A formula: `1` when it holds, `0` when it does not. -/
    53 | ind {L : Language.{0, 0}} {α : Type} (φ : L.Formula α) : SQTerm L α
    54 /-- A constant. -/
    55 | const {L : Language.{0, 0}} {α : Type} (s : ℕ) : SQTerm L α
    56 /-- A sum. -/
    57 | add {L : Language.{0, 0}} {α : Type} (s t : SQTerm L α) : SQTerm L α
    58 /-- A product. -/
    59 | mul {L : Language.{0, 0}} {α : Type} (s t : SQTerm L α) : SQTerm L α
    60 /-- `Σx̄. t`: the sum over the `n`-tuples of elements. -/
    61 | sum {L : Language.{0, 0}} {α : Type} (n : ℕ) (t : SQTerm L (α ⊕ Fin n)) : SQTerm L α
    62 /-- `Πx̄. t`: the product over the `n`-tuples of elements. -/
    63 | prod {L : Language.{0, 0}} {α : Type} (n : ℕ) (t : SQTerm L (α ⊕ Fin n)) : SQTerm L α
    64 /-- `ΣX̄. t`: the sum over the assignments of a block of relation
    65 variables. -/
    66 | sosum {L : Language.{0, 0}} {α : Type} (B : SOBlock) (t : SQTerm (L.sum B.lang) α) :
    67 SQTerm L α
    68
    69namespace SQTerm
    70
    71open Classical in
    72/-- The value of a term in a structure, under a valuation. -/
    73noncomputable def eval : ∀ {L : Language.{0, 0}} {α : Type}, SQTerm L α →
    74 ∀ (A : Type) [L.Structure A], (α → A) → ℕ
    75 | _, _, ind φ, _, _, v => if φ.Realize v then 1 else 0
    76 | _, _, const s, _, _, _ => s
    77 | _, _, add s t, A, _, v => s.eval A v + t.eval A v
    78 | _, _, mul s t, A, _, v => s.eval A v * t.eval A v
    79 | _, _, sum _ t, A, _, v => ∑ᶠ w : Fin _ → A, t.eval A (Sum.elim v w)
    80 | _, _, prod _ t, A, _, v => ∏ᶠ w : Fin _ → A, t.eval A (Sum.elim v w)
    81 | L, _, sosum B t, A, inst, v =>
    82 ∑ᶠ ρ : B.Assignment A, @eval (L.sum B.lang) _ t A (@sumStructure L _ A inst (B.structure ρ)) v
    83
    84/-- The value of a closed term. -/
    85noncomputable def value {L : Language.{0, 0}} (t : SQTerm L Empty) (A : Type) [L.Structure A] : ℕ :=
    86 t.eval A default
    87
    88end SQTerm
    89
    90open FirstOrder
    91
    92open Language Structure
    93
    94variable {L : Language.{0, 0}} [L.IsRelational]
    95
    96/-- **A counting problem is ΣQSO(FO)-definable** when, on nonempty finite
    97ordered structures, it is the value of a closed term of ΣQSO(FO) over the
    98ordered expansion, whatever the linear order. -/
    99def SQDefinable (C : CountingProblem L) : Prop :=
    100 ∃ t : SQTerm (L.sum Language.order) Empty,
    101 ∀ (A : Type) [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A], C A = t.value A
    102
    103end Lax366625.SecondOrderCounting
    104

    Discussion

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

    Loading discussion…