Counterfactual Regret for Reflective Agents with Lean-Verified Guarantees
Organizations: School of Computer Science and Technology / School of Artificial Intelligence China University of Mining and Technology Xuzhou, China
Abstract
Reflective language agents reuse feedback and memory to adapt across tasks without updating model weights. However, existing guarantees for policy selection and action generation do not by themselves establish when local reflection yields long-term performance guarantees for the complete agent under resource constraints. In this paper, we address this gap by deriving sufficient conditions for sublinear counterfactual regret from local generation and deployment guarantees, while retaining the native controller. Specifically, we establish a resource-sensitive transfer that bounds full-state deployment discrepancies along actual execution paths and preserves the own-history laws of both learner and comparator. Besides, local generation reliability yields a cumulative generation opportunity bound, linking policy acquisition to long-term performance through an explicit quality, coverage, and hard-budget tradeoff. To verify these guarantees, we formalize the conditional proof chain for all thirteen numbered theoretical results in Lean, including a native instance with repeated policy growth and imperfect validation.
Figures & tables
| Proof obligation | Purpose of formal checking | Formal result |
|---|---|---|
| Probability coherence | Preserve native laws across couplings. | Prop. 4 , Thm. 7 |
| Adaptive observations | Derive moments under bounded stopping. | Lem. 5 , Thm. 6 |
| Generation reliability | Couple quality, trials and hard costs. | Thm. 11 , Cor. 13 |
| Deployment stability | Control error propagation on actual paths. | Thms. 9 – 10 |
| Composition and limits | Align task clocks and limit hypotheses. | Thm. 11 , Cor. 8 |
| Benchmark consistency | Match cost and feedback conventions. | Thm. 14 |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Result | Formal endpoint |
|---|---|
| Proposition 4 | NativeSemantics.Execution.expected_bounds , loss_integrable , and Realization.expected_total |
| Lemma 5 | FiniteObservation.Round.estimate_mean , weighted_second , and StoppedObservation.Protocol.stopped_unbiased , stopped_second |
| Theorem 6 | DependentSelection.expected_growing_selection |
| Theorem 7 | NativeFamily.own_coupling_counterfactual |
| Corollary 8 | NativeNoRegret.budget_tends_zero and NativeFamily.own_coupling_no_regret |
| Theorem 9 | StateFeedbackStability.actual_loss , adaptive_resource_loss , and module FeedbackLocalOnly , declaration uniform_local_bound |
| Symbol | Meaning and scope |
|---|---|
| Task horizon and task index, internal-operation index, reference-slot index, last padded slot, and slot cap . Defined in Sections 2 and 2.4 . | |
| Operation and result spaces, legal next operations, and admissible extension relation. These describe operational legality, not resource penalties. | |
| Context, memory, and primitive-action spaces. Lowercase are their elements. The benchmark phase count is local to Section 4 . | |
| Operation-history and task-history spaces. Random task prefix , with . Lowercase is a realized history. | |
| Execution-card action kernel, comparator meta-policy, complete native learner, its operation-selection kernel, and nonempty comparator class. is immutable executable identity, not a primitive action. | |
| Common task scorer, scalar task loss, realized cumulative loss, expected cumulative loss, and own-history regret from equation 1 . Unqualified abbreviates . |
| Endpoint or charge | Definition, outgoing comparison, and correspondence |
|---|---|
| Expected native learner loss . Expectation of realA . Its difference from is bounded by . | |
| Expected reference learner endpoint, expectation of refA . Its difference from is bounded by . | |
| , identified with Experiment.selectedTotal . Its comparison to is the proved selection bound. | |
| , identified with Experiment.availableTotal . Its difference from is bounded by . | |
| Aligned represented comparator score, expectation of aligned . Its difference from is bounded by . | |
| Score after removing alignment, expectation of clean . Its difference from is bounded by . |
| Symbol | Meaning and scope |
|---|---|
| Complete finite state, its realization, native and reference state-transition kernels, and common initial distribution in Section 3.2 . The capital switch bound is not a state. | |
| Common immediate state score, -step continuation value from state-time , local continuation-range envelope, and its uniform bound. is distinct from the response scale . | |
| Total variation, relative entropy, local full-state TV envelope, and uniform activity-scaled TV factor. Relative entropy uses natural logarithms and the common support in Appendix F . | |
| Nonnegative update activity, actual-path resource charge, strictly positive cost per unit activity, and learner/comparator resource envelopes. Here is a resource function, not a slot number. | |
| Local product , its accumulated -Bellman charge, and . The proof integrates along the native law. | |
| Generation episode, trial index, number of trials, and episode-specific completed-trial space. Trials and task rounds need not coincide. |
| Component | Role and scope of the contribution |
|---|---|
| Growing selection | Classical exponential weights and sharing, checked on history-dependent finite types. |
| Native transfer | Directed own-law composition, with application-dependent interface certificates. |
| Local stability | Range-sensitive TV telescoping, specialized to actual-path adaptive resource charging. |
| Local generation | Conditional coverage and per-task quality bound the generation opportunity gap. |
| Paid benchmark | Explicit common-model information lower and primitive upper, near matching only under equation 28 . |
| Lean artifact | Reproducible verification of the conditional mathematical chain and its explicit interfaces. |