Finite Relational Structures

Lax496464.WH_B1_Structures · concepts/Lax496464/WH_B1_Structures.lean · lax-496464

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

    A relational structure A\mathcal A consists of a finite universe AA and, for each symbol of a finite vocabulary τ\tau, a relation on AA of the symbol's arity [FG06, Section 4.2]. The parameterized problems that define the W- and A-hierarchies take structures as input.

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

    Lean source view on GitHub

    1import Mathlib.Data.Finset.Card
    2import Mathlib.Algebra.BigOperators.Group.Finset.Defs
    3
    4/-!
    5---
    6title: Finite Relational Structures
    7type: definition
    8---
    9A *relational structure* A\mathcal A consists of a finite universe AA and, for each symbol of a
    10finite vocabulary τ\tau, a relation on AA of the symbol's arity [FG06, Section 4.2]. The
    11parameterized problems that define the W- and A-hierarchies take structures as input.
    12
    13# Formalization Notes
    14
    15**Structures.** The universe is {0,…,size−1}\{0, \dots, \mathrm{size}-1\}; the vocabulary is the list
    16`arities`, symbol ii having arity `arities[i]` ≥1\ge 1. Both the universe and the vocabulary may
    17be empty. A relation is a finite set of tuples, each a list of elements. A formula that mentions a
    18symbol outside the vocabulary does not fit the structure (`WH_B2_FirstOrder.Formula.Fits`) and is
    19false in it [FG06, p. 76].
    20
    21**Words.** The word of a structure (`Encodes`) lists the number of symbols, the arities, the size
    22of the universe, and then, for each symbol, the number of its tuples followed by their entries.
    23The tuples of a relation may be listed in any order without repetition; the yes-instances of every
    24problem are independent of the order. The encoding is self-delimiting, so a structure may be
    25followed by further entries, as in an instance (A,k)(\mathcal A, k).
    26
    27**Size.** The size of the universe is written as a single number. The word therefore has
    28O(∣τ∣+∑R∣R∣⋅arity(R))O(|\tau| + \sum_R |R|\cdot\mathrm{arity}(R)) entries, whereas the size ∥A∥\|\mathcal A\|
    29[FG06, p. 74] (`Structure.norm`) counts the universe in unary. A reduction that ranges over the
    30universe first restricts it to the elements occurring in the relations together with a bounded
    31number of further elements. This preserves the answer, since elements that occur in no relation
    32are interchangeable.
    33-/
    34
    35namespace Lax496464.WH_B1_Structures
    36
    37open scoped BigOperators
    38
    39/-- A finite relational structure. -/
    40structure Structure where
    41 /-- The vocabulary: the arities of the relation symbols `0, 1, …`. -/
    42 arities : List ℕ
    43 /-- The universe is `{0, …, size - 1}`. -/
    44 size : ℕ
    45 /-- The relation of each symbol, as a set of tuples. -/
    46 rel : ℕ → Finset (List ℕ)
    47 /-- Every arity is at least one. -/
    48 arity_pos : ∀ a ∈ arities, 1 ≤ a
    49 /-- The tuples of symbol `i` have its arity and entries in the universe; other symbols have no
    50 tuples. -/
    51 wf : ∀ i, ∀ t ∈ rel i, i < arities.length ∧ t.length = arities.getD i 0 ∧ ∀ a ∈ t, a < size
    52
    53/-- The size `‖A‖ = |τ| + |A| + Σ_R |R^A| · arity(R)` of a structure [FG06, p. 74]. -/
    54def Structure.norm (A : Structure) : ℕ :=
    55 A.arities.length + A.size +
    56 ∑ i ∈ Finset.range A.arities.length, (A.rel i).card * A.arities.getD i 0
    57
    58/-- The block of one relation: the number of its tuples, then the tuples, in some order without
    59repetition. -/
    60def EncodesRel (R : Finset (List ℕ)) (blk : List ℕ) : Prop :=
    61 ∃ ts : List (List ℕ), ts.Nodup ∧ ts.toFinset = R ∧ blk = ts.length :: ts.flatten
    62
    63/-- The word `x` is an encoding of the structure `A`: the number of symbols, the arities, the size
    64of the universe, and one block per symbol. -/
    65def Encodes (x : List ℕ) (A : Structure) : Prop :=
    66 ∃ blocks : List (List ℕ), blocks.length = A.arities.length ∧
    67 (∀ i < A.arities.length, EncodesRel (A.rel i) (blocks.getD i [])) ∧
    68 x = A.arities.length :: (A.arities ++ A.size :: blocks.flatten)
    69
    70end Lax496464.WH_B1_Structures
    71
    Formalization Notes

    Structures. The universe is {0,…,size−1}\{0, \dots, \mathrm{size}-1\}; the vocabulary is the list aritiesarities, symbol ii having arity arities[i]arities[i] ≥1\ge 1. Both the universe and the vocabulary may be empty. A relation is a finite set of tuples, each a list of elements. A formula that mentions a symbol outside the vocabulary does not fit the structure (WHB2FirstOrder.Formula.FitsWH_B2_FirstOrder.Formula.Fits) and is false in it [FG06, p. 76].

    Words. The word of a structure (EncodesEncodes) lists the number of symbols, the arities, the size of the universe, and then, for each symbol, the number of its tuples followed by their entries. The tuples of a relation may be listed in any order without repetition; the yes-instances of every problem are independent of the order. The encoding is self-delimiting, so a structure may be followed by further entries, as in an instance (A,k)(\mathcal A, k).

    Size. The size of the universe is written as a single number. The word therefore has O(∣τ∣+∑R∣R∣⋅arity(R))O(|\tau| + \sum_R |R|\cdot\mathrm{arity}(R)) entries, whereas the size ∥A∥\|\mathcal A\| [FG06, p. 74] (Structure.normStructure.norm) counts the universe in unary. A reduction that ranges over the universe first restricts it to the elements occurring in the relations together with a bounded number of further elements. This preserves the answer, since elements that occur in no relation are interchangeable.

    Discussion

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

    Loading discussion…