Existential second-order definable classes are in NP #
The easy direction of Fagin's theorem Fagin, Theorem 6,
Immerman, Proposition 7.6: for a fixed existential second-order sentence
Φ = ∃ R₁ … Rₖ, φ over a vocabulary, the inputs encoding the finite structures satisfying Φ
form a problem in NP. The certificate for an input of encoded length N is a bit string of
length blocks * N ^ degree, where a layout (Cslib.Logic.ESO.Sentence.Layout) gives each
relation variable its own block of N ^ degree bits and degree bounds the arities. The block
of a relation variable is its truth table, indexed like the tables of the input by
Cslib.Logic.tupleIndex; since the cardinality n of the structure is at most N, every tuple
has a bit, and the unused bits of a block are ignored. Reading the blocks as relations
(Cslib.Logic.ESO.Sentence.Layout.certRel) expands the decoded structure by the relation
variables, and the verifier (Cslib.Logic.ESO.Sentence.Layout.verifier) checks that the input is
well formed and evaluates the first-order part in the expansion. The evaluator
(Cslib.Logic.ESO.Sentence.Layout.eval) recurses on the fixed formula and ranges over the n
elements at each quantifier, so it is a polynomial-time program for each fixed sentence;
fun_prop certifies it with the closure rules of Turing.MultiTapeTM.ComputableInPolyTime.
The sentence and the vocabulary are fixed parameters: the degree of the polynomial time bound
depends on the quantifier depth and the arities of the sentence, and the number of relation symbols
enters the length of the input. Malformed inputs are rejected by the verifier and are not in the
problem. Which certificates are accepted depends on the layout; the problem does not. The converse
direction, that every isomorphism-closed problem in NP is existential second-order definable,
is not proved here.
Main definitions #
Cslib.Logic.ESO.Sentence.Layout: a certificate layout for a sentence, with its polynomialLayout.polynomialof certificate lengths.Cslib.Logic.ESO.Sentence.Layout.eval: the evaluator of the first-order part on an input and a certificate.Cslib.Logic.ESO.Sentence.Layout.verifier: the verifier.
Main results #
Cslib.Logic.ESO.Sentence.Layout.eval_eq_true_iff: the evaluator decides truth in the expansion of the decoded structure by the certificate relations.Cslib.Logic.ESO.Sentence.Layout.exists_certificate: every family of witness relations is represented by a certificate of the prescribed polynomial length.Cslib.Logic.ESO.Sentence.Layout.realize_iff_exists_certificate: a decoded structure satisfies the sentence exactly when some certificate is accepted.Cslib.Logic.ESO.Sentence.Layout.computableInPolyTime_verifier: the verifier is polynomial-time.Cslib.Logic.ESO.Sentence.queryLanguage_mem_NP,Cslib.Logic.ESO.Definable.queryLanguage_mem_NP: the problem of a sentence, and the query language of a definable class, are inNP.
References #
Layouts #
A certificate layout for Φ: a block number for each relation variable, and a bound on
their arities. A certificate for an input of encoded length N has blocks * N ^ degree bits,
block i holding the truth table of relation variable i.
- blocks : ℕ
The number of blocks.
The block of each relation variable.
- degree : ℕ
A bound on the arities of the relation variables.
Instances For
The polynomial giving the length of certificates in the encoded length of the input.
The position of the bit of relation variable i at the tuple of index idx, in a certificate
for an input of encoded length N.
Positions determine the relation variable and the index of the tuple.
The relations read from a certificate: relation variable i holds of a tuple when the bit at
its position is set; missing bits read as false.
Every family of witness relations has a certificate of the prescribed polynomial length, provided the input-length parameter is positive and bounds the universe size. This is independent of the base language, so it also applies when the base has canonical numeric constants.
The evaluator #
The expansion of the decoded structure by the relations read from a certificate.
The value of a term in an environment of bound variables; in a relational language, a term is a variable.
The index of the tuple of values of a sequence of terms, by recursion on its length.
The bit of a relation symbol at a tuple index: read from the input for a symbol of the vocabulary, from the certificate for a relation variable.
The evaluator of the first-order part on an input a of encoded length N, a certificate
w, and an environment of bound variables: quantifiers range over the a.1 elements.
The verifier: the input is well formed and the first-order part holds in the expansion of the decoded structure by the certificate relations.
Correctness #
The evaluator decides truth of the first-order part in the expansion of the decoded structure by the certificate relations.
The first-order part holds in the expansion by the certificate relations exactly when the evaluator accepts.
A decoded structure satisfies the sentence exactly when some certificate is accepted, for
certificate lengths computed from any positive N at least the cardinality.
The verifier accepts an input with some certificate of the prescribed length exactly when the input is well formed and its decoded structure satisfies the sentence.
The verifier, with the certificate lengths of the layout, verifies the query language of a class defined by the sentence.
Polynomial time #
The evaluator is polynomial-time for each fixed formula, by induction on the formula. The input type is generalized, as the body of a quantifier takes the current element as well.
The verifier is polynomial-time.
Membership in NP #
The problem of a fixed existential second-order sentence is in NP: the inputs encoding
the finite structures satisfying Φ, with respect to the encoding of structures of the
vocabulary.
Existential second-order definable classes are in NP (the easy direction of Fagin's
theorem): the query language of a definable class of finite structures is in NP, with respect
to the encoding of structures of any vocabulary of the language
Fagin, Theorem 6, Immerman, Proposition 7.6.