Decision problems of the core on bit strings
Lax832283.StringProblems · concepts/Lax832283/StringProblems.lean · lax-832283
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
A vocabulary of the NP core, with finitely many relation symbols, is numbered by a list of arities. A table of the Immerman–Vardi entry, of that list of arities, then reads as a structure on an initial segment of the natural numbers, and a decision problem of the core reads as a property of tables and as a Boolean query. The empty table is a no-instance, the classes of the core being about nonempty structures. A word that encodes no table is in no language of the two entries, so nothing else needs care.
Concept map
Lean source view on GitHub
| 1 | import Mathlib.ModelTheory.Syntax |
| 2 | import Mathlib.Data.Fin.Tuple.Basic |
| 3 | import Mathlib.Logic.Equiv.Fin.Basic |
| 4 | import Mathlib.Data.List.OfFn |
| 5 | import Mathlib.Data.Finite.Card |
| 6 | import Mathlib.Algebra.BigOperators.Group.List.Basic |
| 7 | import Mathlib.Algebra.Group.Nat.Defs |
| 8 | import Mathlib.Algebra.Group.Action.Defs |
| 9 | import Mathlib.Data.List.FinRange |
| 10 | import Mathlib.ModelTheory.Semantics |
| 11 | import Mathlib.ModelTheory.Complexity |
| 12 | import Mathlib.Tactic.FinCases |
| 13 | import Lax751879.OrderedStructures |
| 14 | import Lax904597.Problems |
| 15 | import Lax988886.FiniteStructures |
| 16 | |
| 17 | /-! |
| 18 | --- |
| 19 | title: Decision problems of the core on bit strings |
| 20 | type: definition |
| 21 | --- |
| 22 | A vocabulary of the NP core, with finitely many relation symbols, is numbered by a |
| 23 | list of arities. A table of the Immerman–Vardi entry, of that list of arities, then reads |
| 24 | as a structure on an initial segment of the natural numbers, and a decision problem of |
| 25 | the core reads as a property of tables and as a Boolean query. The empty table is a |
| 26 | no-instance, the classes of the core being about nonempty structures. A word that encodes |
| 27 | no table is in no language of the two entries, so nothing else needs care. |
| 28 | -/ |
| 29 | |
| 30 | namespace Lax832283.StringProblems |
| 31 | |
| 32 | open Lax751879.OrderedStructures Lax904597.Problems Lax988886.FiniteStructures |
| 33 | |
| 34 | open FirstOrder |
| 35 | |
| 36 | /-- An enumeration of the relation symbols of `L`, listing their arities. -/ |
| 37 | structure FinVocab (L : Language.{0, 0}) where |
| 38 | /-- The arities of the symbols, in the order of the enumeration. -/ |
| 39 | σ : List ℕ |
| 40 | /-- The symbol of a given number, with its arity. -/ |
| 41 | sym : Fin σ.length ≃ Σ n, L.Relations n |
| 42 | /-- The list records the arity of each symbol. -/ |
| 43 | arity_sym : ∀ i, (sym i).1 = σ.get i |
| 44 | |
| 45 | namespace FinVocab |
| 46 | |
| 47 | variable {L : Language.{0, 0}} |
| 48 | |
| 49 | variable (V : FinVocab L) |
| 50 | |
| 51 | /-- The number of a given symbol. -/ |
| 52 | def toSym {n : ℕ} (R : L.Relations n) : Fin V.σ.length := |
| 53 | V.sym.symm ⟨n, R⟩ |
| 54 | |
| 55 | end FinVocab |
| 56 | |
| 57 | open FirstOrder Language Structure |
| 58 | |
| 59 | |
| 60 | |
| 61 | variable {L : Language.{0, 0}} |
| 62 | |
| 63 | /-- Read a table of the archive's formalism as a structure of the library. -/ |
| 64 | @[reducible] |
| 65 | def ofOrdered [L.IsRelational] (V : FinVocab L) (S : OrderedStructure V.σ) : |
| 66 | L.Structure (Fin S.size) where |
| 67 | funMap f := isEmptyElim f |
| 68 | RelMap {n} R v := S.relation (V.toSym R) (v ∘ Fin.cast |
| 69 | (show V.σ.get (V.toSym R) = n by rw [← V.arity_sym, FinVocab.toSym, Equiv.apply_symm_apply])) |
| 70 | = true |
| 71 | |
| 72 | /-- A decision problem of the library, as a property of the archive's structures. The |
| 73 | empty structure is a no-instance. -/ |
| 74 | def toProperty [L.IsRelational] (V : FinVocab L) (P : DecisionProblem L) : |
| 75 | Property V.σ := |
| 76 | fun S => 0 < S.size ∧ @DecisionProblem.Holds L _ P (Fin S.size) (ofOrdered V S) |
| 77 | |
| 78 | /-- A decision problem of the library, as a Boolean query on ordered structures. -/ |
| 79 | def toQuery [L.IsRelational] (V : FinVocab L) (P : DecisionProblem L) : Query V.σ 0 := |
| 80 | fun S => toProperty V P S.structureValue |
| 81 | |
| 82 | end Lax832283.StringProblems |
| 83 |
Used by
From Mathlib
Mathlib.Algebra.BigOperators.Group.List.BasicMathlib.Algebra.Group.Action.DefsMathlib.Algebra.Group.Nat.DefsMathlib.Data.Fin.Tuple.BasicMathlib.Data.Finite.CardMathlib.Data.List.FinRangeMathlib.Data.List.OfFnMathlib.Logic.Equiv.Fin.BasicMathlib.ModelTheory.ComplexityMathlib.ModelTheory.SemanticsMathlib.ModelTheory.SyntaxMathlib.Tactic.FinCases
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments