Documentation

Complexity.Crypto.Computational.Pseudoentropy.Boosting.Program

A clocked hard-core boosting program #

The state stores a threshold, a list of predictor descriptions, and a stopping flag. A fixed certified evaluator interprets each description on an observation. Each active round tests the majority guard, optionally raises the threshold, and requests one new predictor.

The supplied learner is an explicit program with its own efficiency and correctness obligations. We truncate its output to the declared description bound on every execution, including failures. The analysis must therefore certify the truncated predictor. This gives a polynomial bound on the complete state throughout the clocked loop without a probabilistic runtime exception.

Main definitions #

Main results #

References #

[Hol05], Section 2.2, Figure 2 and Lemma 2.14. The proved polynomial clock replaces the worst-dense-set stopping test. The majority test remains explicit and uses finite fair-bit sampling. Adapted from the cslib crypto branch at 5ff69ca93402e7c947208dc56396d6d86203ccd8.

The executable state of the boosting loop. Predictor descriptions are ordinary binary words.

  • stopped : Bool

    Once true, all remaining clock ticks preserve this state.

  • threshold : ℕ

    The number of shifts subtracted from the raw vote margin.

  • predictors : List (List Bool)

    Predictor descriptions, newest first.

Instances For

    Reuse the standard Boolean, unary, and list encodings.

    Instances For

      Start before any learned predictors or threshold shifts.

      Instances For
        def Cslib.Crypto.Pseudoentropy.Boosting.State.votes (evaluate : List Bool → List Bool → Bool) (state : State) (observation : List Bool) :

        Evaluate the current collection on an observation. The truth label is not an input.

        Instances For

          Move the threshold according to the sampled shift decision.

          Instances For

            Add a bounded predictor description.

            Instances For
              @[simp]
              theorem Cslib.Crypto.Pseudoentropy.Boosting.State.votes_initial (evaluate : List Bool → List Bool → Bool) (observation : List Bool) :
              votes evaluate initial observation = []
              @[simp]
              theorem Cslib.Crypto.Pseudoentropy.Boosting.State.votes_shift (evaluate : List Bool → List Bool → Bool) (state : State) (yes : Bool) (observation : List Bool) :
              votes evaluate (state.shift yes) observation = votes evaluate state observation
              @[simp]
              theorem Cslib.Crypto.Pseudoentropy.Boosting.State.votes_add (evaluate : List Bool → List Bool → Bool) (state : State) (bound : ℕ) (code observation : List Bool) :
              votes evaluate (state.add bound code) observation = evaluate (List.take bound code) observation :: votes evaluate state observation

              After rounds rounds there are at most that many shifts and bounded descriptions.

              Instances For
                theorem Cslib.Crypto.Pseudoentropy.Boosting.State.Bounded.mono {rounds more codeBound : ℕ} {state : State} (h : Bounded rounds codeBound state) (hmore : rounds ≤ more) :
                Bounded more codeBound state

                A bound remains valid when more rounds are allowed.

                theorem Cslib.Crypto.Pseudoentropy.Boosting.State.Bounded.shift_add {rounds codeBound : ℕ} {state : State} (h : Bounded rounds codeBound state) (yes : Bool) (code : List Bool) :
                Bounded (rounds + 1) codeBound ((state.shift yes).add codeBound code)

                An optional shift and a truncated description preserve the resource invariant.

                theorem Cslib.Crypto.Pseudoentropy.Boosting.State.Bounded.length_encoding_le {rounds codeBound : ℕ} {state : State} (h : Bounded rounds codeBound state) :
                (encoding state).length ≤ rounds * (2 * codeBound + 3) + 4

                The semantic resource invariant bounds the complete encoded state.

                theorem Cslib.Crypto.Pseudoentropy.Boosting.State.isPolyTime_mk {α : Type} {input : α ↪ List Bool} {stopped : α → Bool} {threshold : α → ℕ} {predictors : α → List (List Bool)} (hstopped : Turing.MultiTapeTM.ComputableTidilyInPolyTime stopped input Turing.MultiTapeTM.encBool) (hthreshold : Turing.MultiTapeTM.ComputableTidilyInPolyTime threshold input Turing.MultiTapeTM.encUnary) (hpredictors : Turing.MultiTapeTM.ComputableTidilyInPolyTime predictors input (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits)) :
                Turing.MultiTapeTM.ComputableTidilyInPolyTime (fun (a : α) => { stopped := stopped a, threshold := threshold a, predictors := predictors a }) input encoding

                Efficient field values construct an efficient state.

                Project the stopping flag through the shared pair implementation.

                Project the threshold through the shared pair implementation.

                Project the predictor collection through the shared pair implementation.

                Evaluating a list of descriptions is an ordinary captured map.

                Updating the threshold uses its field certificate and the efficient Boolean decision.

                Truncation and list insertion charge for the complete stored predictor description.

                Natural parameters for exact dyadic weights and polynomial sampling budgets.

                • confidence : ℕ

                  Each sampled guard has failure probability at most 2⁻confidence.

                • densityNumerator : ℕ

                  The numerator of the target density.

                • densityBound : ℕ

                  The parameter whose dyadicSize is the density denominator.

                • rateBound : ℕ

                  The parameter whose dyadicSize is the reciprocal weight rate.

                • codeBound : ℕ

                  Maximum length of each stored predictor description.

                Instances For

                  Store all five resource parameters in unary using the shared product encoding.

                  Instances For
                    theorem Cslib.Crypto.Pseudoentropy.Boosting.Parameters.isPolyTime_mk {α : Type} {input : α ↪ List Bool} {confidence densityNumerator densityBound rateBound codeBound : α → ℕ} (hconfidence : Turing.MultiTapeTM.ComputableTidilyInPolyTime confidence input Turing.MultiTapeTM.encUnary) (hdensityNumerator : Turing.MultiTapeTM.ComputableTidilyInPolyTime densityNumerator input Turing.MultiTapeTM.encUnary) (hdensityBound : Turing.MultiTapeTM.ComputableTidilyInPolyTime densityBound input Turing.MultiTapeTM.encUnary) (hrateBound : Turing.MultiTapeTM.ComputableTidilyInPolyTime rateBound input Turing.MultiTapeTM.encUnary) (hcodeBound : Turing.MultiTapeTM.ComputableTidilyInPolyTime codeBound input Turing.MultiTapeTM.encUnary) :
                    Turing.MultiTapeTM.ComputableTidilyInPolyTime (fun (a : α) => { confidence := confidence a, densityNumerator := densityNumerator a, densityBound := densityBound a, rateBound := rateBound a, codeBound := codeBound a }) input encoding

                    Computing the five fields suffices to construct the encoded parameter record.

                    Project the confidence through the shared product implementation.

                    Project the density numerator through the shared product implementation.

                    Project the density parameter through the shared product implementation.

                    Project the rate parameter through the shared product implementation.

                    Project the description bound through the shared product implementation.

                    The density denominator is a positive power of two.

                    Instances For

                      The reciprocal weight rate is a positive power of two.

                      Instances For

                        A sufficient majority-test precision for every positive density numerator.

                        Instances For

                          A sufficient density-test precision at weight rate 1 / inverseRate.

                          Instances For

                            A polynomial clock whenever 0 < densityNumerator ≤ denominator.

                            Instances For

                              Draw a fresh labeled observation and evaluate the current predictor collection on it.

                              Instances For
                                noncomputable def Cslib.Crypto.Pseudoentropy.Boosting.round (evaluate : List Bool → List Bool → Bool) (source : ProbComp (List Bool × Bool)) (learn : State → ProbComp (List Bool)) (params : Parameters) (state : State) :

                                One round of boosting. A previously stopped state is returned unchanged.

                                Instances For
                                  noncomputable def Cslib.Crypto.Pseudoentropy.Boosting.run (evaluate : List Bool → List Bool → Bool) (source : ProbComp (List Bool × Bool)) (learn : State → ProbComp (List Bool)) (params : Parameters) :

                                  Run the sampled boosting body for the proved polynomial clock.

                                  Instances For
                                    theorem Cslib.Crypto.Pseudoentropy.Boosting.round_bounded (evaluate : List Bool → List Bool → Bool) (source : ProbComp (List Bool × Bool)) (learn : State → ProbComp (List Bool)) (params : Parameters) {rounds : ℕ} {state : State} (hstate : State.Bounded rounds params.codeBound state) (next : State) :
                                    next ∈ (round evaluate source learn params state).eval.support → State.Bounded (rounds + 1) params.codeBound next

                                    Resource bounds hold on every outcome, including erroneous tests and learner failures.

                                    theorem Cslib.Crypto.Pseudoentropy.Boosting.run_bounded (evaluate : List Bool → List Bool → Bool) (source : ProbComp (List Bool × Bool)) (learn : State → ProbComp (List Bool)) (params : Parameters) (state : State) :
                                    state ∈ (run evaluate source learn params).eval.support → State.Bounded params.clock params.codeBound state

                                    The clocked loop stores at most one bounded predictor per round.

                                    The complete sampled round composes the evaluator, source, learner, and unary parameters. No machine implementation is part of the client's proof.

                                    Polynomially bounded parameters and a certified learner give a strict PPT boosting loop. The single resource invariant also proves run_bounded, independently of correctness.