The Krom fragment of existential second-order logic
Lax485149.KromFragment · concepts/Lax485149/KromFragment.lean · lax-485149
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
A Krom 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 and each is an atom in the relation variables or the negation of one; either literal may be absent, so a clause may be a unit clause or the goal clause . A Krom 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-Krom definable when there are a block, a number and a Krom 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. The guards may thus use the order, while the problem does not depend on it. This is the fragment SO-Krom of Grädel, existential second-order logic whose first-order kernel is universal with at most two second-order literals per clause.
Concept map
Lean source view on GitHub
| 1 | import Mathlib.ModelTheory.Order |
| 2 | import Mathlib.ModelTheory.Semantics |
| 3 | import Lax485149.SecondOrderAtoms |
| 4 | import Lax904597.Problems |
| 5 | import Lax904597.SecondOrder |
| 6 | import Lax904597.Interpretations |
| 7 | |
| 8 | /-! |
| 9 | --- |
| 10 | title: The Krom fragment of existential second-order logic |
| 11 | type: definition |
| 12 | --- |
| 13 | A Krom clause over a vocabulary , a block of second-order relation |
| 14 | variables and first-order variables is an implication |
| 15 | , where the guard is an |
| 16 | arbitrary first-order formula over and each is an atom in the |
| 17 | relation variables or the negation of one; either literal may be absent, so a |
| 18 | clause may be a unit clause or the goal clause . |
| 19 | A Krom 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 at |
| 21 | every valuation of . |
| 22 | |
| 23 | A decision problem over is SO-Krom definable when there are a block, |
| 24 | a number and a Krom 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. The guards may thus use the order, while the problem |
| 28 | does not depend on it. This is the fragment SO-Krom of Grädel, existential |
| 29 | second-order logic whose first-order kernel is universal with at most two |
| 30 | second-order literals per clause. |
| 31 | -/ |
| 32 | |
| 33 | namespace Lax485149.KromFragment |
| 34 | |
| 35 | open Lax485149.SecondOrderAtoms Lax904597.Problems Lax904597.SecondOrder |
| 36 | |
| 37 | open FirstOrder |
| 38 | |
| 39 | open Language Structure |
| 40 | |
| 41 | /-- A literal in the relation variables of a block: an atom together with a |
| 42 | sign (`positive = false` for a negated atom). -/ |
| 43 | structure KromLit (B : SOBlock) (k : ℕ) where |
| 44 | /-- The underlying second-order atom. -/ |
| 45 | atom : SOAtom B k |
| 46 | /-- The sign of the literal: `true` for the atom, `false` for its |
| 47 | negation. -/ |
| 48 | positive : Bool |
| 49 | |
| 50 | /-- A Krom clause over the input vocabulary `L` and the block `B`, with `k` |
| 51 | universally quantified first-order variables: an arbitrary first-order guard |
| 52 | over `L` implies the disjunction of at most two signed second-order literals. |
| 53 | A `none` literal is absent, so a clause with both literals absent is the goal |
| 54 | clause `guard → ⊥`. -/ |
| 55 | structure KromClause (L : Language.{0, 0}) (B : SOBlock) (k : ℕ) where |
| 56 | /-- The first-order guard, over the input vocabulary alone. -/ |
| 57 | guard : L.Formula (Fin k) |
| 58 | /-- The first literal of the clause, if any. -/ |
| 59 | lit₁ : Option (KromLit B k) |
| 60 | /-- The second literal of the clause, if any. -/ |
| 61 | lit₂ : Option (KromLit B k) |
| 62 | |
| 63 | /-- An SO-Krom kernel, as data: a finite conjunction of Krom clauses, each |
| 64 | implicitly universally quantified over the same `k` first-order variables. -/ |
| 65 | abbrev KromProgram (L : Language.{0, 0}) (B : SOBlock) (k : ℕ) : Type := |
| 66 | List (KromClause L B k) |
| 67 | |
| 68 | section Semantics |
| 69 | |
| 70 | variable {L : Language.{0, 0}} {B : SOBlock} {k : ℕ} {A : Type} [L.Structure A] |
| 71 | |
| 72 | /-- The truth value of a literal: its atom, or the negation of its atom. -/ |
| 73 | def KromLit.Holds (l : KromLit B k) (ρ : B.Assignment A) (v : Fin k → A) : Prop := |
| 74 | if l.positive then l.atom.Holds ρ v else ¬l.atom.Holds ρ v |
| 75 | |
| 76 | /-- The truth value of one of the two literal slots of a clause: `False` when |
| 77 | the literal is absent. -/ |
| 78 | def KromLit.slotHolds (o : Option (KromLit B k)) (ρ : B.Assignment A) (v : Fin k → A) : |
| 79 | Prop := |
| 80 | o.elim False fun l => l.Holds ρ v |
| 81 | |
| 82 | /-- A Krom clause holds at a valuation when its guard forces one of its (at |
| 83 | most two) literals. -/ |
| 84 | def KromClause.Holds (c : KromClause L B k) (ρ : B.Assignment A) (v : Fin k → A) : |
| 85 | Prop := |
| 86 | c.guard.Realize v → |
| 87 | (KromLit.slotHolds c.lit₁ ρ v ∨ KromLit.slotHolds c.lit₂ ρ v) |
| 88 | |
| 89 | /-- An assignment satisfies a program when every clause holds at every |
| 90 | valuation of the universally quantified variables. -/ |
| 91 | def KromProgram.Holds (prog : KromProgram L B k) (ρ : B.Assignment A) : Prop := |
| 92 | ∀ v : Fin k → A, ∀ c ∈ prog, c.Holds ρ v |
| 93 | |
| 94 | end Semantics |
| 95 | |
| 96 | variable {L : Language.{0, 0}} |
| 97 | |
| 98 | /-- A decision problem is *SO-Krom definable* if, on nonempty finite *ordered* |
| 99 | structures, it is defined by an existential second-order sentence with a Krom |
| 100 | kernel: there is a block of relation variables and a Krom program over the |
| 101 | ordered expansion of the vocabulary such that the yes-instances are exactly |
| 102 | the structures admitting a satisfying assignment. A single block suffices, |
| 103 | since existential second-order quantifiers merge. |
| 104 | |
| 105 | The guards live over `L.sum Language.order` and the equivalence is required |
| 106 | for *every* linear order on `A`, so this is order-invariant SO-Krom |
| 107 | definability. -/ |
| 108 | def SigmaSOKromDefinable [L.IsRelational] (P : DecisionProblem L) : Prop := |
| 109 | ∃ (B : SOBlock) (k : ℕ) (prog : KromProgram (L.sum Language.order) B k), |
| 110 | ∀ (A : Type) [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A], |
| 111 | P A ↔ ∃ ρ : B.Assignment A, prog.Holds ρ |
| 112 | |
| 113 | end Lax485149.KromFragment |
| 114 |
Used by
Lax485149.ClassNLLax485149.DeterministicReachabilityInvarianceLax485149.FirstOrderInTransitiveClosureLax485149.ImmermanSzelepcsenyiLax485149.KromAndTransitiveClosureLax485149.LByAutomataLax485149.LClosureLax485149.LEqCoLLax485149.LSubsetNLLax485149.NLByAutomataLax485149.NLClosureLax485149.NLEqCoNLLax485149.NLIsTransitiveClosureLax485149.NLSubsetNPLax485149.ReachabilityInvarianceLax485149.ReachdLCompleteLax485149.ReachNLCompleteLax485149.TransitiveClosureClosureLax485149.TwoSatInvarianceLax485149.TwoSatNLCompleteLax485149.UnreachdLCompleteLax485149.UnreachNLComplete
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments