First-order logic with least fixed points
Lax535992.LeastFixedPoint · concepts/Lax535992/LeastFixedPoint.lean · lax-535992
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
A definition in FO(LFP), in clausal normal form, over a vocabulary consists of a block of relation variables, a finite list of rules, which are Horn clauses over and the block with a head, and an output sentence, an arbitrary first-order sentence over expanded by the relation variables. On a linearly ordered -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 over is FO(LFP) definable when some definition holds, for every nonempty finite -structure and every linear order on , exactly when is a yes-instance of . 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
Lean source view on GitHub
| 1 | import Mathlib.ModelTheory.Order |
| 2 | import Mathlib.ModelTheory.Semantics |
| 3 | import Lax904597.Problems |
| 4 | import Lax904597.Interpretations |
| 5 | import Lax904597.SecondOrder |
| 6 | import Lax485149.SecondOrderAtoms |
| 7 | import Lax535992.HornFragment |
| 8 | |
| 9 | /-! |
| 10 | --- |
| 11 | title: First-order logic with least fixed points |
| 12 | type: definition |
| 13 | --- |
| 14 | A definition in FO(LFP), in clausal normal form, over a vocabulary |
| 15 | consists of a block of relation variables, a finite list of rules, which |
| 16 | are Horn clauses over and the block with a head, and an |
| 17 | output sentence, an arbitrary first-order sentence over |
| 18 | expanded by the relation variables. On a linearly ordered -structure the |
| 19 | rules define the least relations closed under them: a tuple is derived when |
| 20 | some rule, at some valuation satisfying its guard and whose body atoms are |
| 21 | already derived, has it as head. The definition holds on the structure when |
| 22 | the output sentence is true with the relation variables interpreted by |
| 23 | these least fixed points. The output may negate the fixed-point atoms. |
| 24 | |
| 25 | A decision problem over is FO(LFP) definable when some definition |
| 26 | holds, for every nonempty finite -structure and every linear order on |
| 27 | , exactly when is a yes-instance of . This is the logic FO(LFP) of |
| 28 | Immerman and Vardi on ordered structures, in the normal form of one |
| 29 | simultaneous induction under a first-order formula. |
| 30 | -/ |
| 31 | |
| 32 | namespace Lax535992.LeastFixedPoint |
| 33 | |
| 34 | open Lax485149.SecondOrderAtoms Lax535992.HornFragment Lax904597.Problems Lax904597.SecondOrder |
| 35 | |
| 36 | open FirstOrder |
| 37 | |
| 38 | open Language Structure |
| 39 | |
| 40 | section Derives |
| 41 | |
| 42 | variable {Lg : Language.{0, 0}} {B : SOBlock} {k : ℕ} |
| 43 | |
| 44 | variable {A : Type} [Lg.Structure A] |
| 45 | |
| 46 | /-- The tuples derivable by a system of rules: the least fixed point, as an |
| 47 | inductive predicate. A rule fires when its guard holds and all its body atoms |
| 48 | are already derived, and it derives its head atom. -/ |
| 49 | inductive 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. -/ |
| 57 | def lfpAssign (rules : List (HornClause Lg B k)) : B.Assignment A := |
| 58 | fun i x => Derives rules ⟨i, x⟩ |
| 59 | |
| 60 | end Derives |
| 61 | |
| 62 | /-- A definition in FO(LFP), in clausal normal form: a block of relation |
| 63 | variables, a list of rules defining them inductively, and a first-order output |
| 64 | sentence over the vocabulary expanded by the variables, read at the least fixed |
| 65 | point. -/ |
| 66 | structure 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 | |
| 77 | namespace LFPDef |
| 78 | |
| 79 | variable {L : Language.{0, 0}} (d : LFPDef L) |
| 80 | |
| 81 | /-- The value of a definition on a structure: the output read at the least |
| 82 | fixed point of the rules. -/ |
| 83 | def 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 | |
| 87 | end LFPDef |
| 88 | |
| 89 | /-- A decision problem is *FO(LFP) definable* if, on nonempty finite ordered |
| 90 | structures, it is the value of a definition in FO(LFP). The equivalence is |
| 91 | required for every linear order, so the notion is order-invariant. -/ |
| 92 | def 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 | |
| 96 | end Lax535992.LeastFixedPoint |
| 97 |
Builds on
Used by
Lax535992.CircuitValueInvarianceLax535992.CircuitValuePTIMECompleteLax535992.DeterministicMachineInvarianceLax535992.DeterministicMachinePTIMECompleteLax535992.GameInvarianceLax535992.GamePTIMECompleteLax535992.HornIsLeastFixedPointLax535992.HornSatInvarianceLax535992.HornSatPTIMECompleteLax535992.ImmermanVardiLax535992.InflationaryIsLeastFixedPointLax535992.LeastFixedPointComplementLax535992.NLSubsetPTIMELax535992.PTIMEClosureLax535992.PTIMEEqCoPTIMELax535992.PTIMESubsetNP
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments