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

The Horn fragment of existential second-order logic

Lax535992.HornFragment · concepts/Lax535992/HornFragment.lean · lax-535992

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 Horn clause over a vocabulary LL, a block of second-order relation variables and kk first-order variables xˉ\bar x is an implication γ(xˉ)∧α1∧⋯∧αm→η\gamma(\bar x) \wedge \alpha_1 \wedge \dots \wedge \alpha_m \to \eta, where the guard γ\gamma is an arbitrary first-order formula over LL, the body atoms αi\alpha_i are atoms in the relation variables, and the head η\eta is such an atom or ⊥\bot, the clause being then a goal clause. A Horn program is a finite list of such clauses, and an assignment of relations to the block satisfies it on a structure when every clause holds at every valuation of xˉ\bar x.

    A decision problem PP over LL is SO-Horn definable when there are a block, a number kk and a Horn program over L∪{≤}L \cup \{\le\} such that, for every nonempty finite LL-structure AA and every linear order on AA, AA is a yes-instance of PP if and only if some assignment satisfies the program on AA with that order. This is the fragment SO-Horn of Grädel, existential second-order logic whose first-order kernel is universal and Horn in the second-order atoms.

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

    Lean source view on GitHub

    1import Mathlib.ModelTheory.Order
    2import Mathlib.ModelTheory.Semantics
    3import Lax904597.Problems
    4import Lax904597.Interpretations
    5import Lax904597.SecondOrder
    6import Lax485149.SecondOrderAtoms
    7
    8/-!
    9---
    10title: The Horn fragment of existential second-order logic
    11type: definition
    12---
    13A Horn clause over a vocabulary LL, a block of second-order relation
    14variables and kk first-order variables xˉ\bar x is an implication
    15γ(xˉ)∧α1∧⋯∧αm→η\gamma(\bar x) \wedge \alpha_1 \wedge \dots \wedge \alpha_m \to \eta,
    16where the guard γ\gamma is an arbitrary first-order formula over LL, the
    17body atoms αi\alpha_i are atoms in the relation variables, and the head
    18η\eta is such an atom or ⊥\bot, the clause being then a goal clause. A
    19Horn program is a finite list of such clauses, and an assignment of
    20relations to the block satisfies it on a structure when every clause holds
    21at every valuation of xˉ\bar x.
    22
    23A decision problem PP over LL is SO-Horn definable when there are a block,
    24a number kk and a Horn program over L∪{≤}L \cup \{\le\} such that, for
    25every nonempty finite LL-structure AA and every linear order on AA, AA is
    26a yes-instance of PP if and only if some assignment satisfies the program
    27on AA with that order. This is the fragment SO-Horn of Grädel, existential
    28second-order logic whose first-order kernel is universal and Horn in the
    29second-order atoms.
    30-/
    31
    32namespace Lax535992.HornFragment
    33
    34open Lax485149.SecondOrderAtoms Lax904597.Problems Lax904597.SecondOrder
    35
    36open FirstOrder
    37
    38open Language Structure
    39
    40/-- A Horn clause over the input vocabulary `L` and the block `B`, with `k`
    41universally quantified first-order variables: an arbitrary first-order guard
    42over `L` and a list of second-order body atoms imply the head atom – or `⊥`,
    43when the head is `none` (a *goal* clause). -/
    44structure HornClause (L : Language.{0, 0}) (B : SOBlock) (k : ℕ) where
    45 /-- The first-order guard, over the input vocabulary alone. -/
    46 guard : L.Formula (Fin k)
    47 /-- The body: second-order atoms, all of them positive. -/
    48 body : List (SOAtom B k)
    49 /-- The head: a second-order atom, or `none` for a goal clause. -/
    50 head : Option (SOAtom B k)
    51
    52/-- An SO-Horn kernel, as data: a finite conjunction of Horn clauses, each
    53implicitly universally quantified over the same `k` first-order variables. -/
    54abbrev HornProgram (L : Language.{0, 0}) (B : SOBlock) (k : ℕ) : Type :=
    55 List (HornClause L B k)
    56
    57section Semantics
    58
    59variable {L : Language.{0, 0}} {B : SOBlock} {k : ℕ} {A : Type} [L.Structure A]
    60
    61/-- The truth value of the head of a clause: `False` for a goal clause. -/
    62def HornClause.HeadHolds (c : HornClause L B k) (ρ : B.Assignment A)
    63 (v : Fin k → A) : Prop :=
    64 c.head.elim False fun h => h.Holds ρ v
    65
    66/-- A Horn clause holds at a valuation when its guard and all its body atoms
    67force its head. -/
    68def HornClause.Holds (c : HornClause L B k) (ρ : B.Assignment A) (v : Fin k → A) :
    69 Prop :=
    70 (c.guard.Realize v ∧ ∀ a ∈ c.body, a.Holds ρ v) → c.HeadHolds ρ v
    71
    72/-- An assignment satisfies a program when every clause holds at every
    73valuation of the universally quantified variables. -/
    74def HornProgram.Holds (prog : HornProgram L B k) (ρ : B.Assignment A) : Prop :=
    75 ∀ v : Fin k → A, ∀ c ∈ prog, c.Holds ρ v
    76
    77end Semantics
    78
    79/-- A decision problem is *SO-Horn definable* if, on nonempty finite *ordered*
    80structures, it is defined by an existential second-order sentence with a Horn
    81kernel: there is a block of relation variables and a Horn program over the
    82ordered expansion of the vocabulary such that the yes-instances are exactly
    83the structures admitting a satisfying assignment. A single block suffices,
    84since existential second-order quantifiers merge.
    85
    86The guards live over `L.sum Language.order`, and the equivalence is required
    87for *every* linear order on `A`: since the problem itself does not see the
    88order, this is order-invariant SO-Horn definability. -/
    89def SigmaSOHornDefinable {L : Language.{0, 0}} [L.IsRelational] (P : DecisionProblem L) : Prop :=
    90 ∃ (B : SOBlock) (k : ℕ) (prog : HornProgram (L.sum Language.order) B k),
    91 ∀ (A : Type) [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A],
    92 P A ↔ ∃ ρ : B.Assignment A, prog.Holds ρ
    93
    94end Lax535992.HornFragment
    95

    Discussion

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

    Loading discussion…