Documentation

Complexitylib.Classes.AverageCase.Heuristic

Errorless average-case heuristics #

This module exposes the exact errorless-heuristic semantics used in average-case complexity: globally sound yes/no/failure answers, polynomial runtime through a canonical FP output codec, and slice-wise failure probability over arbitrary finite uniform-seed ensembles. It also defines AvgPAt δ and the inverse-polynomial intersection AvgP for distributional problems.

@[simp]

Canonical heuristic answers round-trip through their binary codec.

The canonical three-answer encoding is injective.

Every canonical heuristic-answer code has length at most one.

@[simp]

Complementing an answer twice returns the original answer.

@[simp]

Complement preserves and reflects explicit failure.

theorem Complexity.HeuristicAnswer.CorrectFor.complement {answer : HeuristicAnswer} {truth : Prop} (hcorrect : answer.CorrectFor truth) :

Complementing a sound answer gives a sound answer for the negated truth value.

Complementing a globally errorless heuristic yields an errorless heuristic for the complement language.

@[simp]

Complementing a heuristic preserves its failure event pointwise.

Every answer probability is nonnegative.

Every answer probability is at most one.

An errorless heuristic correctly rejects mass at least one minus the language mass and its failure mass.

@[simp]

Complementing a heuristic preserves its failure probability exactly.

A failure guarantee remains true under a pointwise weaker bound.

Complementing a heuristic preserves every failure guarantee.

The decision-function adapter has its advertised pointwise semantics.

theorem Complexity.HeuristicAlgorithm.ofDecision_encoded (decide : List BoolBool) :
(ofDecision decide).encoded = fun (x : List Bool) => [decide x]

The canonical encoding of a decision adapter is its singleton Boolean output.

theorem Complexity.HeuristicAlgorithm.ofDecision_isPolynomialTime {decide : List BoolBool} (htime : (fun (x : List Bool) => [decide x]) FP) :

A decision adapter runs in polynomial time whenever its singleton Boolean output function belongs to FP.

theorem Complexity.HeuristicAlgorithm.ofDecision_isErrorlessFor {decide : List BoolBool} {L : Language} (hdecide : ∀ (x : List Bool), decide x = true x L) :

An exact Boolean decision function induces a globally errorless heuristic.

@[simp]

A total decision adapter has zero failure probability on every ensemble slice.

A total decision adapter meets the zero failure bound.

The total inverse-polynomial failure target is nonnegative.

The total inverse-polynomial failure target is at most one.

theorem Complexity.AvgPAt_mono {δ ε : } (hδε : ∀ (n : ), δ n ε n) :
AvgPAt δAvgPAt ε

AvgPAt is monotone in its allowed failure probability.

theorem Complexity.mem_AvgP_iff (problem : DistributionalProblem) :
problem AvgP ∀ (c : ), problem AvgPAt (inversePolynomialFailure c)

Membership in AvgP means meeting every total inverse-polynomial failure target.

theorem Complexity.DistributionalProblem.mem_AvgPAt_of_decision (problem : DistributionalProblem) (δ : ) (decide : List BoolBool) (htime : (fun (x : List Bool) => [decide x]) FP) (hdecide : ∀ (x : List Bool), decide x = true x problem.language) ( : ∀ (n : ), 0 δ n) :
problem AvgPAt δ

Any exact polynomial-time Boolean decision function gives a zero-failure member of AvgPAt δ for every nonnegative failure allowance.

theorem Complexity.DistributionalProblem.mem_AvgP_of_decision (problem : DistributionalProblem) (decide : List BoolBool) (htime : (fun (x : List Bool) => [decide x]) FP) (hdecide : ∀ (x : List Bool), decide x = true x problem.language) :
problem AvgP

Any exact polynomial-time Boolean decision function solves the same language errorlessly on every distribution ensemble, hence places the distributional problem in AvgP.