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

First-order logic with least fixed points

Lax535992.LeastFixedPoint · concepts/Lax535992/LeastFixedPoint.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 definition in FO(LFP), in clausal normal form, over a vocabulary LL consists of a block of relation variables, a finite list of rules, which are Horn clauses over L∪{≤}L \cup \{\le\} and the block with a head, and an output sentence, an arbitrary first-order sentence over L∪{≤}L \cup \{\le\} expanded by the relation variables. On a linearly ordered LL-structure the rules define the least relations closed under them: a tuple is derived when some rule, at some valuation satisfying its guard and whose body atoms are already derived, has it as head. The definition holds on the structure when the output sentence is true with the relation variables interpreted by these least fixed points. The output may negate the fixed-point atoms.

    A decision problem PP over LL is FO(LFP) definable when some definition holds, for every nonempty finite LL-structure AA and every linear order on AA, exactly when AA is a yes-instance of PP. This is the logic FO(LFP) of Immerman and Vardi on ordered structures, in the normal form of one simultaneous induction under a first-order formula.

    Concept map
    6 concepts; 16 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
    7import Lax535992.HornFragment
    8
    9/-!
    10---
    11title: First-order logic with least fixed points
    12type: definition
    13---
    14A definition in FO(LFP), in clausal normal form, over a vocabulary LL
    15consists of a block of relation variables, a finite list of rules, which
    16are Horn clauses over L∪{≤}L \cup \{\le\} and the block with a head, and an
    17output sentence, an arbitrary first-order sentence over L∪{≤}L \cup \{\le\}
    18expanded by the relation variables. On a linearly ordered LL-structure the
    19rules define the least relations closed under them: a tuple is derived when
    20some rule, at some valuation satisfying its guard and whose body atoms are
    21already derived, has it as head. The definition holds on the structure when
    22the output sentence is true with the relation variables interpreted by
    23these least fixed points. The output may negate the fixed-point atoms.
    24
    25A decision problem PP over LL is FO(LFP) definable when some definition
    26holds, for every nonempty finite LL-structure AA and every linear order on
    27AA, exactly when AA is a yes-instance of PP. This is the logic FO(LFP) of
    28Immerman and Vardi on ordered structures, in the normal form of one
    29simultaneous induction under a first-order formula.
    30-/
    31
    32namespace Lax535992.LeastFixedPoint
    33
    34open Lax485149.SecondOrderAtoms Lax535992.HornFragment Lax904597.Problems Lax904597.SecondOrder
    35
    36open FirstOrder
    37
    38open Language Structure
    39
    40section Derives
    41
    42variable {Lg : Language.{0, 0}} {B : SOBlock} {k : ℕ}
    43
    44variable {A : Type} [Lg.Structure A]
    45
    46/-- The tuples derivable by a system of rules: the least fixed point, as an
    47inductive predicate. A rule fires when its guard holds and all its body atoms
    48are already derived, and it derives its head atom. -/
    49inductive Derives (rules : List (HornClause Lg B k)) :
    50 (Σ i : B.ι, Fin (B.arity i) → A) → Prop
    51 | rule {c : HornClause Lg B k} (hc : c ∈ rules) {a : SOAtom B k}
    52 (ha : c.head = some a) {v : Fin k → A} (hg : c.guard.Realize v)
    53 (hb : ∀ b ∈ c.body, Derives rules ⟨b.idx, fun j => v (b.args j)⟩) :
    54 Derives rules ⟨a.idx, fun j => v (a.args j)⟩
    55
    56/-- The least fixed point of a rule system, as an assignment of the block. -/
    57def lfpAssign (rules : List (HornClause Lg B k)) : B.Assignment A :=
    58 fun i x => Derives rules ⟨i, x⟩
    59
    60end Derives
    61
    62/-- A definition in FO(LFP), in clausal normal form: a block of relation
    63variables, a list of rules defining them inductively, and a first-order output
    64sentence over the vocabulary expanded by the variables, read at the least fixed
    65point. -/
    66structure LFPDef (L : Language.{0, 0}) : Type 1 where
    67 /-- The relation variables computed by the fixed point. -/
    68 B : SOBlock
    69 /-- The number of first-order variables shared by the rules. -/
    70 k : ℕ
    71 /-- The rules defining the variables. Rules with no head derive nothing. -/
    72 rules : List (HornClause (L.sum Language.order) B k)
    73 /-- The first-order output, over the expanded vocabulary – *unrestricted*,
    74 in particular free to negate fixed-point atoms. -/
    75 out : ((L.sum Language.order).sum B.lang).Sentence
    76
    77namespace LFPDef
    78
    79variable {L : Language.{0, 0}} (d : LFPDef L)
    80
    81/-- The value of a definition on a structure: the output read at the least
    82fixed point of the rules. -/
    83def Holds (A : Type) [L.Structure A] [LinearOrder A] : Prop :=
    84 @Sentence.Realize ((L.sum Language.order).sum d.B.lang) A
    85 (@sumStructure _ _ A _ (d.B.structure (lfpAssign d.rules))) d.out
    86
    87end LFPDef
    88
    89/-- A decision problem is *FO(LFP) definable* if, on nonempty finite ordered
    90structures, it is the value of a definition in FO(LFP). The equivalence is
    91required for every linear order, so the notion is order-invariant. -/
    92def LFPDefinable {L : Language.{0, 0}} [L.IsRelational] (P : DecisionProblem L) : Prop :=
    93 ∃ d : LFPDef L, ∀ (A : Type) [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A],
    94 P A ↔ d.Holds A
    95
    96end Lax535992.LeastFixedPoint
    97

    Discussion

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

    Loading discussion…