Encoding finite structures as bit strings #
To connect descriptive complexity to the machine model, a finite structure must be
presented as an input to a Turing machine — a bit string. The standard encoding
(for an ordered universe Fin card) lists, for each relation, its truth
table: the values over all tuples in the canonical order. This module builds the
relational part of that encoding and computes its length; it is step 5 (structure
→ bit-string encoding) of the Fagin decomposition on roadmap track L6.
Main definitions and results #
DescriptiveComplexity.encodeRel,encodeRel_length— a relation's truth table (lengthcard ^ arity).DescriptiveComplexity.encodeRels,encodeRels_length— the relational part of a structure's encoding, and its total length.DescriptiveComplexity.allTuples,encodeRelC— a computable tuple enumeration and a computable truth-table encoding (needed for the machine-side Fagin bridge).
The computable encoding also has length card ^ k.
The computable relational encoding of a decidable structure: the computable truth tables of all its relations, concatenated.
Equations
- Complexity.DescriptiveComplexity.encodeRelsC A = List.flatMap (fun (i : Fin V.numRels) => Complexity.DescriptiveComplexity.encodeRelC (A.rel i)) (List.finRange V.numRels)
Instances For
The computable relational encoding has the expected total length.
The full computable encoding of a decidable structure: the cardinality in
unary (a block of card trues terminated by a false), followed by the
relational encoding. The unary prefix makes card self-delimiting.
Equations
Instances For
The cardinality is recoverable from the encoding as the length of the leading
run of trues.
The relational part of a decidable structure's encoding: the truth tables of all its relations, concatenated.
Equations
- Complexity.DescriptiveComplexity.encodeRels A = List.flatMap (fun (i : Fin V.numRels) => Complexity.DescriptiveComplexity.encodeRel (A.rel i)) (List.finRange V.numRels)
Instances For
The relational encoding's length is the sum of the per-relation truth-table
sizes card ^ (arity).