Documentation

CslibFrontier.Computability.Complexity.Fagin.Witness

Materializing existential relation witnesses #

The certificate layout of an existential second-order sentence already reads a polynomial-length word as a family of relation tables. This module materializes those tables and appends them to the original encoded structure. The transformation has a native polynomial-time certificate and its decoded structure is exactly the expansion by the guessed relations. Missing witness bits read as false; nullary relations have one table entry, and an empty family adds no tables.

Main definitions #

Main results #

References #

A relation table materialized from the certificate, in tuple-index order.

Append the materialized witness relations to the original relation tables. The sentence and its enumeration are fixed parameters, not parts of the machine input.

@[simp]
theorem Cslib.Logic.ESO.Sentence.Layout.witnessInput_card {L : FirstOrder.Language} {Φ : Sentence L} (ℓ : Φ.Layout) {m : ℕ} (e : Fin m ≃ Φ.Var) (p : EncodedStructure × List Bool) :
(ℓ.witnessInput e p).1 = p.1.1

Materialization does not change the universe.

@[simp]

A materialized relation table has one entry for each tuple, including one for arity zero.

theorem Cslib.Logic.ESO.Sentence.Layout.getD_witnessTable {L : FirstOrder.Language} {Φ : Sentence L} (ℓ : Φ.Layout) (a : EncodedStructure) (w : List Bool) (i : Φ.Var) (x : Fin (Φ.arity i) → Fin a.1) :

Reading a materialized table returns the corresponding certificate bit.

The materialized witness tables always have the declared shapes, even for short certificates. Short certificates supply false bits to the missing positions.

Appending witness tables preserves and reflects source shape validity; it cannot repair a missing, extra, or incorrectly sized source relation table.

The output decodes to exactly the input structure expanded by the certificate relations.

theorem Cslib.Logic.ESO.Sentence.Layout.length_encStructure_witnessInput {L : FirstOrder.Language} {Φ : Sentence L} (ℓ : Φ.Layout) {m : ℕ} (e : Fin m ≃ Φ.Var) (a : EncodedStructure) (w : List Bool) :
(encStructure (ℓ.witnessInput e (a, w))).length = (encStructure a).length + ∑ j : Fin m, (2 * a.1 ^ Φ.arity (e j) + 1)

The exact additional encoding cost is the sum of the framed witness-table lengths.

A uniform polynomial bound in the original encoded input length, independent of witness contents and length. The sentence and layout determine the constants and degree.

The entire witness expansion is computed by an actual polynomial-time machine on the input and certificate. No well-formedness or certificate-length premise is needed for its running time.