Documentation

Complexitylib.Classes.EventProb

Finite event probability #

The uniform probability of a finite event over T random bits, |E| / 2^T, defined once as eventProb and related to Finset.card and to the existing rational PTM acceptance probability NTM.acceptProb (roadmap track N2).

Main results #

def Complexity.eventProb {T : } (E : Finset (Fin TBool)) :

The uniform probability of a finite event E ⊆ (Fin T → Bool): the fraction of the 2^T random bit strings that lie in E.

Equations
Instances For
    theorem Complexity.card_le_pow {T : } (E : Finset (Fin TBool)) :
    E.card 2 ^ T

    Every finite event has cardinality at most the size of the sample space.

    Good seeds from probability bounds #

    theorem Complexity.exists_good_seed_of_sum_eventProb_lt_one {S : } {ι : Type u_1} (inputs : Finset ι) (bad : ιFinset (Fin SBool)) (h : iinputs, eventProb (bad i) < 1) :
    ∃ (seed : Fin SBool), iinputs, seedbad i

    The probabilistic method in probability form. If the sum, over a finite input set, of the probabilities of the corresponding bad-seed events is strictly below one, then one seed avoids every bad event.

    theorem Complexity.exists_good_seed_of_eventProb_le_two_pow_succ (n S : ) (bad : (Fin nBool)Finset (Fin SBool)) (hbad : ∀ (x : Fin nBool), eventProb (bad x) 1 / 2 ^ (n + 1)) :
    ∃ (seed : Fin SBool), ∀ (x : Fin nBool), seedbad x

    A 2^-(n+1) bad-seed bound for each n-bit input leaves a single seed that is good for all inputs simultaneously. The strict slack of one bit makes the argument uniform even when n = 0 or S = 0.

    The probability of the complement of an event is one minus its probability.

    theorem Complexity.eventProb_filter_bool_true (T : ) (f : (Fin TBool)Bool) :
    eventProb {w : Fin TBool | f w = true} = 1 - eventProb {w : Fin TBool | f w = false}

    For a Boolean-valued experiment, success probability is one minus failure probability.

    The union bound in probability form: the probability of E ∪ F is at most the sum of their probabilities.

    theorem Complexity.eventProb_biUnion_le {T : } {ι : Type u_1} [DecidableEq ι] (s : Finset ι) (E : ιFinset (Fin TBool)) :
    eventProb (s.biUnion E) is, eventProb (E i)

    The union bound over a finite family of events: the probability of the union ⋃ᵢ Eᵢ is at most the sum of the individual probabilities. The amplification workhorse — bounding the failure probability across many bad events.

    theorem Complexity.eventProb_biUnion {T : } {ι : Type u_1} [DecidableEq ι] (s : Finset ι) (E : ιFinset (Fin TBool)) (h : (↑s).PairwiseDisjoint E) :
    eventProb (s.biUnion E) = is, eventProb (E i)

    Finite additivity: the probability of a disjoint finite union is the sum of the probabilities of its events.

    theorem Complexity.eventProb_eq_sum_fiberwise {T : } {ι : Type u_1} [DecidableEq ι] (E : Finset (Fin TBool)) (s : Finset ι) (f : (Fin TBool)ι) (h : Set.MapsTo f E s) :
    eventProb E = is, eventProb ({wE | f w = i})

    Conditioning by a finite partition. If the statistic f maps every point of E into the finite index set s, then E is the disjoint union of its fibers and its probability is the sum of their probabilities.

    theorem Complexity.eventProb_filter_of_constant_fibers {total compact ignored : } (htotal : total = compact + ignored) (randomSeed : (Fin totalBool)Fin compactBool) (Accept : (Fin totalBool)Prop) (Good : (Fin compactBool)Prop) [DecidablePred Accept] [DecidablePred Good] (hfactor : ∀ (w : Fin totalBool), Accept w Good (randomSeed w)) (hfiber : ∀ (seed : Fin compactBool), {w : Fin totalBool | randomSeed w = seed}.card = 2 ^ ignored) :

    Uniformly ignored random bits cancel from event probability. If an event on total = compact + ignored bits factors through a compact-seed projection whose fibers all have size 2 ^ ignored, its probability is exactly the probability of the corresponding compact event.

    theorem Complexity.eventProb_repeatRandomSeed (k T : ) (P : (Fin (k * T)Bool)Prop) [DecidablePred P] :
    eventProb {w : Fin (2 + k * (2 * T + 2))Bool | P (repeatRandomSeed k T w)} = eventProb (Finset.filter P Finset.univ)

    The fixed-time repetition schedule's administrative choices do not change the probability of an event depending only on its k * T simulation bits.

    theorem Complexity.eventProb_block {a b : } (P : (Fin aBool)Prop) (Q : (Fin bBool)Prop) [DecidablePred P] [DecidablePred Q] :

    Independence across blocks (probability form). For an event that constrains the prefix and suffix of a length-a + b random string separately, the joint probability is the product of the two block probabilities. This is the probability-level counterpart of card_filter_block and the quantitative engine behind error amplification: k independent runs multiply their success probabilities.

    theorem Complexity.eventProb_blockMajority_eq_false (T r : ) (E : Finset (Fin TBool)) :
    eventProb {w : Fin ((2 * r + 1) * T)Bool | blockMajority E w = false} = jFinset.range (r + 1), ((2 * r + 1).choose j) * eventProb E ^ j * (1 - eventProb E) ^ (2 * r + 1 - j)

    Exact majority-failure probability across independent blocks. Splitting a uniform long seed into 2r + 1 blocks makes block-event membership independent, so the failure probability is the lower tail of the binomial distribution with success probability eventProb E.

    theorem Complexity.binomial_lower_tail_le (r : ) (p : ) (hp_lower : 2 / 3 p) (hp_upper : p 1) :
    jFinset.range (r + 1), ((2 * r + 1).choose j) * p ^ j * (1 - p) ^ (2 * r + 1 - j) 1 / 3 * (8 / 9) ^ r

    The lower tail of an odd binomial distribution with success probability at least 2/3 is at most (1/3) * (8/9)^r. This deliberately uses a coarse elementary bound rather than a Chernoff inequality: each failure term is bounded by (1/3) * (2/9)^r, and the lower-half binomial coefficients sum to 4^r.

    theorem Complexity.eventProb_blockMajority_false_le_two_pow (T k : ) (E : Finset (Fin TBool)) (hE : 2 / 3 eventProb E) :
    eventProb {w : Fin ((12 * k + 1) * T)Bool | blockMajority E w = false} 1 / 2 ^ k

    Concrete error amplification. If one T-bit trial succeeds with probability at least 2/3, then the strict majority of 12k + 1 independent trials fails with probability at most 1 / 2^k. The explicit odd repetition count avoids ties and is sufficient for later BPP and protocol amplification.

    theorem Complexity.eventProb_blockMajority_true_ge_one_sub_two_pow (T k : ) (E : Finset (Fin TBool)) (hE : 2 / 3 eventProb E) :
    1 - 1 / 2 ^ k eventProb {w : Fin ((12 * k + 1) * T)Bool | blockMajority E w = true}

    Majority amplification on yes-instances: a source success probability at least 2/3 becomes at least 1 - 2^-k after 12k + 1 trials.

    theorem Complexity.eventProb_blockMajority_true_le_two_pow (T k : ) (E : Finset (Fin TBool)) (hE : eventProb E 1 / 3) :
    eventProb {w : Fin ((12 * k + 1) * T)Bool | blockMajority E w = true} 1 / 2 ^ k

    Majority amplification on no-instances: a source success probability at most 1/3 becomes at most 2^-k after 12k + 1 trials.

    theorem Complexity.eventProb_map {T : } (e : (Fin TBool) (Fin TBool)) (E : Finset (Fin TBool)) :

    Event probability is invariant under any relabeling of the sample space — in particular under permuting the bit positions (Equiv.arrowCongr σ) — since a bijection preserves cardinality.

    theorem Complexity.NTM.acceptProb_eq_eventProb {n : } (tm : NTM n) (x : List Bool) (T : ) :
    tm.acceptProb x T = eventProb {choices : Fin TBool | have c' := tm.trace T choices (tm.initCfg x); c'.state = tm.qhalt c'.output.cells 1 = Γ.one}

    The PTM acceptance probability is exactly the event probability of the set of accepting choice sequences: this ties NTM.acceptProb to the abstract eventProb / Finset.card layer.

    theorem Complexity.NTM.acceptProb_eq_eventProb_repeatRandomSeed {n : } (tm : NTM n) (x : List Bool) (k T : ) (P : (Fin (k * T)Bool)Prop) [DecidablePred P] (hfactor : ∀ (choices : Fin (2 + k * (2 * T + 2))Bool), (have c' := tm.trace (2 + k * (2 * T + 2)) choices (tm.initCfg x); c'.state = tm.qhalt c'.output.cells 1 = Γ.one) P (repeatRandomSeed k T choices)) :

    A repeated machine's administrative random choices cancel from its acceptance probability whenever its accepting-path predicate factors through repeatRandomSeed. The result is the event probability on only the k * T simulation choices.