The Horn fragment of existential second-order logic
Lax535992.HornFragment · concepts/Lax535992/HornFragment.lean · lax-535992
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
A Horn clause over a vocabulary , a block of second-order relation variables and first-order variables is an implication , where the guard is an arbitrary first-order formula over , the body atoms are atoms in the relation variables, and the head is such an atom or , 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 .
A decision problem over is SO-Horn definable when there are a block, a number and a Horn program over such that, for every nonempty finite -structure and every linear order on , is a yes-instance of if and only if some assignment satisfies the program on 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
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 | |
| 8 | /-! |
| 9 | --- |
| 10 | title: The Horn fragment of existential second-order logic |
| 11 | type: definition |
| 12 | --- |
| 13 | A Horn clause over a vocabulary , a block of second-order relation |
| 14 | variables and first-order variables is an implication |
| 15 | , |
| 16 | where the guard is an arbitrary first-order formula over , the |
| 17 | body atoms are atoms in the relation variables, and the head |
| 18 | is such an atom or , the clause being then a goal clause. A |
| 19 | Horn program is a finite list of such clauses, and an assignment of |
| 20 | relations to the block satisfies it on a structure when every clause holds |
| 21 | at every valuation of . |
| 22 | |
| 23 | A decision problem over is SO-Horn definable when there are a block, |
| 24 | a number and a Horn program over such that, for |
| 25 | every nonempty finite -structure and every linear order on , is |
| 26 | a yes-instance of if and only if some assignment satisfies the program |
| 27 | on with that order. This is the fragment SO-Horn of Grädel, existential |
| 28 | second-order logic whose first-order kernel is universal and Horn in the |
| 29 | second-order atoms. |
| 30 | -/ |
| 31 | |
| 32 | namespace Lax535992.HornFragment |
| 33 | |
| 34 | open Lax485149.SecondOrderAtoms Lax904597.Problems Lax904597.SecondOrder |
| 35 | |
| 36 | open FirstOrder |
| 37 | |
| 38 | open Language Structure |
| 39 | |
| 40 | /-- A Horn clause over the input vocabulary `L` and the block `B`, with `k` |
| 41 | universally quantified first-order variables: an arbitrary first-order guard |
| 42 | over `L` and a list of second-order body atoms imply the head atom – or `⊥`, |
| 43 | when the head is `none` (a *goal* clause). -/ |
| 44 | structure 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 |
| 53 | implicitly universally quantified over the same `k` first-order variables. -/ |
| 54 | abbrev HornProgram (L : Language.{0, 0}) (B : SOBlock) (k : ℕ) : Type := |
| 55 | List (HornClause L B k) |
| 56 | |
| 57 | section Semantics |
| 58 | |
| 59 | variable {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. -/ |
| 62 | def 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 |
| 67 | force its head. -/ |
| 68 | def 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 |
| 73 | valuation of the universally quantified variables. -/ |
| 74 | def HornProgram.Holds (prog : HornProgram L B k) (ρ : B.Assignment A) : Prop := |
| 75 | ∀ v : Fin k → A, ∀ c ∈ prog, c.Holds ρ v |
| 76 | |
| 77 | end Semantics |
| 78 | |
| 79 | /-- A decision problem is *SO-Horn definable* if, on nonempty finite *ordered* |
| 80 | structures, it is defined by an existential second-order sentence with a Horn |
| 81 | kernel: there is a block of relation variables and a Horn program over the |
| 82 | ordered expansion of the vocabulary such that the yes-instances are exactly |
| 83 | the structures admitting a satisfying assignment. A single block suffices, |
| 84 | since existential second-order quantifiers merge. |
| 85 | |
| 86 | The guards live over `L.sum Language.order`, and the equivalence is required |
| 87 | for *every* linear order on `A`: since the problem itself does not see the |
| 88 | order, this is order-invariant SO-Horn definability. -/ |
| 89 | def 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 | |
| 94 | end Lax535992.HornFragment |
| 95 |
Used by
Lax535992.CircuitValueInvarianceLax535992.CircuitValuePTIMECompleteLax535992.ClassPTIMELax535992.DeterministicMachineInvarianceLax535992.DeterministicMachinePTIMECompleteLax535992.GameInvarianceLax535992.GamePTIMECompleteLax535992.HornIsLeastFixedPointLax535992.HornSatInvarianceLax535992.HornSatPTIMECompleteLax535992.ImmermanVardiLax535992.InflationaryIsLeastFixedPointLax535992.LeastFixedPointLax535992.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