Documentation

DescriptiveComplexity.Problems.Machine.CountingHardness

Counting accepting runs is parsimoniously #P-complete #

The machine bridge of the counting world. The machine M_φ of a CNF instance (DescriptiveComplexity.satMachine) has exactly as many accepting runs as φ has models (DescriptiveComplexity.card_haltWalk_satMachine), so the reduction of DescriptiveComplexity.Problems.Machine.Interp is parsimonious (DescriptiveComplexity.SatTM.sharpSat_ordered_parsimonious_sharpNtmAccept). With membership (DescriptiveComplexity.sharpNtmAccept_mem_sharpP) this gives

Why the counts agree #

The machine branches only at the guess, and it guesses only at the variables of the formula, writing “false” at every other element. So:

The assignments the machine can guess and accept: true only at variables of the instance, and satisfying every clause.

Equations
Instances For
    Dependency graph
    theorem DescriptiveComplexity.symV_injective {A : Type} [LinearOrder A] [Finite A] [Nonempty A] {v v' : Bool} {x : A} (h : symV v x = symV v' x) :
    v = v'
    Dependency graph
    theorem DescriptiveComplexity.symV_ne_symU {A : Type} [LinearOrder A] [Finite A] [Nonempty A] {v : Bool} {x y : A} :
    symV v x ≠ symU y
    Dependency graph
    theorem DescriptiveComplexity.exists_haltWalk_of_good {A : Type} [FirstOrder.Language.sat.Structure A] [LinearOrder A] [Finite A] [Nonempty A] (ν : A → Bool) (h : SatGood ν) :
    ∃ (conf : SatV A → Config (SatV A)), (satMachine A).IsHaltWalk conf ∧ ∀ (p : SatTag × (Fin 2 → A)), MaxPos tagTupleLe SatPosn p → (conf p).tape = doneTape ν

    Every model has a run: a halting walk ending on its tape.

    Dependency graph
    theorem DescriptiveComplexity.good_of_haltWalk {A : Type} [FirstOrder.Language.sat.Structure A] [LinearOrder A] [Finite A] [Nonempty A] {conf : SatV A → Config (SatV A)} (h : (satMachine A).IsHaltWalk conf) :
    ∃ (ν : A → Bool), SatGood ν ∧ ∀ (p : SatTag × (Fin 2 → A)), MaxPos tagTupleLe SatPosn p → (conf p).tape = doneTape ν

    Every run is the run of a model: a halting walk ends on the tape of an assignment the machine can guess and accept.

    Dependency graph
    theorem DescriptiveComplexity.haltWalk_ext {A : Type} [FirstOrder.Language.sat.Structure A] [LinearOrder A] [Finite A] [Nonempty A] {conf conf' : SatV A → Config (SatV A)} (h : (satMachine A).IsHaltWalk conf) (h' : (satMachine A).IsHaltWalk conf') {p₁ : SatV A} (hp₁ : MaxPos tagTupleLe SatPosn p₁) (htape : (conf p₁).tape = (conf' p₁).tape) :
    conf = conf'

    Two runs ending on the same tape are the same run.

    Dependency graph
    theorem DescriptiveComplexity.doneTape_injective {A : Type} [LinearOrder A] [Finite A] [Nonempty A] {ν ν' : A → Bool} (h : doneTape ν = doneTape ν') :
    ν = ν'
    Dependency graph

    The machine of a CNF instance has as many accepting runs as the assignments it can guess and accept.

    Dependency graph

    The machine characterization of #P #

    Counting the accepting runs of a machine is parsimoniously #P-hard.

    Dependency graph

    Counting the accepting runs of a nondeterministic machine is parsimoniously #P-complete. The class of this library is defined in logic; this theorem is the bridge saying it is the machine one. Registered in the Lax archive as Lax366625.CountingRunsComplete.sharpNtmAccept_sharpP_parsimoniousComplete.

    Dependency graph

    SharpNTMAccept is #P-complete: parsimoniously, hence under subtractive reductions.

    Dependency graph

    The machine characterization of #P: a counting problem counts the witnesses of an existential second-order sentence exactly when it reduces parsimoniously to counting the accepting runs of a nondeterministic machine. Registered in the Lax archive as Lax366625.CountingRunsComplete.mem_sharpP_iff_le_sharpNtmAccept.

    Dependency graph

    Counting accepting runs and counting models reduce to each other, parsimoniously: the counting form of the Cook–Levin correspondence.

    Dependency graph