Documentation

CslibFrontier.Algorithms.Reachability.DoubleCounting.ControllerBounds

Scalar bounds for arbitrary controller replies #

These are bounds for the actual list-valued controller handlers, independent of graph correctness or exact expected tallies. A list entry is a successful branch; an empty callback list rejects. Every finite prefix uses the same handlers as scanNextRound, including prefixes that later reject or set the tie flag. The bounds concern retained scalar registers at the callback boundary, not the workspace or duration of a callback. Native realization remains part of #6747.

Main results #

RoundCall.result_mem connects this proof-level call relation to the original controller without defining another executable dispatch.

The arbitrary index maps in the prefix lemmas include the increasing initial segment fun i => ⟨i.val, i.isLt.trans_le hj⟩ for hj : j ≤ n. Thus the current loop index is at most n, and each queried index is strictly below n. No transcript is retained by these bounds. See CslibFrontierTests.DoubleCountingControllerBounds for rejection and tie clients.

theorem Cslib.DoubleCounting.predecessor_prefix_le {n j : ℕ} (edge : Fin n → Fin n → List Bool) (member : Fin n → List Bool) (v : Fin n) (index : Fin j → Fin n) (c b : ℕ) (hb : b ∈ Fin.foldlM j (fun (c : ℕ) (i : Fin j) => predecessorStep edge member v c (index i)) c) :
b ≤ c + j

Every successful predecessor prefix, even one whose continuation later rejects, stores at most its initial count plus the number of tested indices. Replies may be arbitrary.

theorem Cslib.DoubleCounting.scanVertex_prefix_bounds {n j : ℕ} (edge : Fin n → Fin n → List Bool) (member : Fin n → List Bool) (k : ℕ) (index : Fin j → Fin n) (a b : RoundUpdate) (hb : b ∈ Fin.foldlM j (fun (a : RoundUpdate) (i : Fin j) => scanVertex edge member k a (index i)) a) :

All scalar outer-loop prefixes are bounded without assuming correct membership, absence of ties, or eventual success. The index map can select the increasing initial segment.

theorem Cslib.DoubleCounting.scanNextRound_bounds {n : ℕ} (edge : Fin n → Fin n → List Bool) (member : MembershipScan List n) (k : ℕ) (t : Tally) (a : RoundUpdate) (ha : a ∈ scanNextRound edge member k t) :

The actual round scan satisfies the same bounds, also when its tie flag is set.

inductive Cslib.DoubleCounting.RoundCall {n : ℕ} (edge : Fin n → Fin n → List Bool) (member : MembershipScan List n) :
ℕ → ℕ → Tally → Prop

Reachable recursive calls of the existing controller, starting with its actual fuel and initial tally. This is a proof-level call relation, not another controller implementation.

theorem Cslib.DoubleCounting.RoundCall.result_mem {n fuel k : ℕ} {edge : Fin n → Fin n → List Bool} {member : MembershipScan List n} {t : Tally} (h : RoundCall edge member fuel k t) (target : Fin n) {result : Option ControllerVerdict} (hr : result ∈ runRounds edge member target fuel k t) :
result ∈ runController edge member target

Agreement with actual dispatch: every result at a reachable call is a result of the original controller. List membership here forgets multiplicity only for this reachability fact.

theorem Cslib.DoubleCounting.RoundCall.bounds {n fuel k : ℕ} {edge : Fin n → Fin n → List Bool} {member : MembershipScan List n} {t : Tally} (h : RoundCall edge member fuel k t) :
fuel + k = n ∧ t.count ≤ 1 + k * n ∧ t.lengthSum ≤ n * k * k

All reachable round boundaries, including those before a later rejection, have bounded radius and scalar registers for arbitrary replies. The sum bound is deliberately conservative.

theorem Cslib.DoubleCounting.RoundCall.prefix_bounds {n fuel k j : ℕ} {edge : Fin n → Fin n → List Bool} {member : MembershipScan List n} {t : Tally} (h : RoundCall edge member fuel k t) (hactive : 0 < fuel) (hj : j ≤ n) (index : Fin j → Fin n) (a : RoundUpdate) (ha : a ∈ Fin.foldlM j (fun (a : RoundUpdate) (i : Fin j) => scanVertex edge (member k t) k a (index i)) { tally := t, bad := false }) :
k < n ∧ j ≤ n ∧ a.tally.count ≤ 1 + n * n ∧ a.tally.lengthSum ≤ n * n * n

At every vertex prefix of an active controller round the radius, loop index, count and sum are polynomially bounded, including tied prefixes and prefixes of rejecting branches. Together with predecessor_prefix_le, all retained numeric registers have polynomial bounds sufficient for binary logarithmic-length encodings. No callee workspace is asserted.