agentsclimarketplace

Lean math optimization

Skill r-irbe/proof-skills/skills/lean-math-optimization

APM-installable agent skills for Lean 4 and Mathlib4 — proof tactics, math domains, review and research workflows, generic tooling.

Install
npx -y skills add r-irbe/proof-skills --skill lean-math-optimization

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

USE FOR: optimization theory, convex optimization, game theory, reinforcement-learning theory (Bellman equations, value / policy iteration), Nash equilibria, minimax theorems, decision theory, and fixed-point iterations in Lean 4. DO NOT USE FOR: stochastic policies / Markov chains (use @lean-math-stochastic); pure analysis (use @lean-math-analysis); Lyapunov / control-stability proofs (use @lean-math-dynamical); writing one specific proof (use @lean-proof). TRIGGERS: optimization, convex, game theory, Bellman, value iteration, policy iteration, Nash, minimax, fixed point, KKT.

SKILL.md

7.2 KB, as published. Nobody here has run it

Lean 4 Optimization & Decision Theory

Guide to formalizing optimization, game theory, RL theory, and decision-making in Lean 4.

Routing

  • USE FOR: optimization theory, convex optimization, game theory, reinforcement-learning theory (Bellman equations, value / policy iteration), Nash equilibria, minimax theorems, decision theory, and fixed-point iterations in Lean 4.
  • DO NOT USE FOR: stochastic policies / Markov chains (delegate to @lean-math-stochastic); pure analysis (delegate to @lean-math-analysis); Lyapunov / control-stability proofs (delegate to @lean-math-dynamical); writing one specific proof (delegate to @lean-proof).
  • TRIGGERS: optimization, convex, game theory, Bellman, value iteration, policy iteration, Nash, minimax, fixed point, KKT.

Workflow

  1. Identify the optimality structure (Part 1) — unconstrained, convex, equilibrium, dynamic-programming.
  2. Pick the matching tool below (gradient / KKT, contraction / Banach fixed-point, Bellman backup, Nash-equilibrium argument).
  3. Handoff to @lean-proof; if the contraction step requires a normed-space lemma, handoff to @lean-math-analysis.

Recovery & STOP

  • STOP if the proof requires a Banach-contraction instance not yet imported — handoff to @lean-math-analysis.
  • STOP if a stochastic policy or expected-value argument appears — re-route to @lean-math-stochastic.

Handoffs

  • Predecessors: agent:gateway, skill:lean-proof (mid-proof optimization goal), skill:lean-research (Bellman / Nash-equilibrium API survey).
  • Successors: skill:lean-proof (apply the optimization pattern), skill:lean-proof-review (audit fixed-point claim), skill:lean-math-analysis (contraction / normed-space reduction).

Detailed reference

Full encyclopaedia content (Parts 1 through 7) lives in references/lean4-math-optimization.md. Load that file when authoring; the SKILL.md only carries the dispatch contract and the high-frequency pitfalls / recipes (kept inline below).

PartTopicCovers
Part 1Optimization Fundamentalsobjective / feasible-set / optimum vocabulary in Mathlib
Part 2Convex OptimizationConvexOn, KKT (host-repository), Jensen, gradient conditions
Part 3Fixed-Point IterationsBanach contraction; iteration-bound estimates
Part 4Game TheoryNash equilibrium, zero-sum, minimax, saddle-point hypotheses
Part 5Reinforcement Learning TheoryBellman backup, value/policy iteration, discount factor
Part 6Multi-Objective OptimizationPareto frontier, lexicographic ordering
Part 7Decision Theorybounded rationality + project alignment

Part 8 — Research Council Integration

Consolidated into the single canonical routing matrix: references/research-council-skill-map.md (see the "Optimization" section). When dispatching a question to a council member, cite that table rather than restating the rows here.


Part 9 — Common Pitfalls (Convex / RL / Game Theory)

PitfallSymptomRecovery
Bellman without 0 ≤ γ < 1Value-iteration convergence won't closeAdd hypothesis hγ : γ < 1; the Bellman backup is a contraction in ‖·‖∞ only under this condition
Convex but not strictly convexUniqueness of optimum failsStrengthen to StrictConvexOn instead of ConvexOn; pair with strict-monotonicity for the optimum step
Banach contraction missing [CompleteSpace α]ContractingWith.fixedPoint won't applyAdd the instance, or restrict to a closed ball with induced completeness
Minimax order flippedinf sup ≤ sup inf doesn't closeSaddle-point requires compact + convex + continuous on both sides; check Sion's-theorem hypotheses (no Sion in Mathlib at current pin — local construction or @lean-research)
Discount factor used as while state is Coercion warnings; ^ won't elaborateUse (γ : ℝ) ^ n and prove with Real.rpow_lt_one family (or pow_lt_one_iff_of_nonneg)
Non-empty / non-bounded feasible set assumedIsLeast / IsGLB won't constructBound the feasible set explicitly; for unbounded LP, no Mathlib fixed-point applies — use @lean-research

RL-theory escape hatches

  • Finite horizon: Finset.sum_range_succ unfolding usually beats induction on a valueFn.
  • Infinite horizon: only meaningful with 0 ≤ γ < 1; the geometric-series bound is Real.geom_series_lt / tsum_geometric_lt_one / summable_geometric_of_lt_one.
  • Value-iteration convergence: prove the Bellman backup is a contraction in ‖·‖∞, then apply the Banach fixed-point theorem (see @lean-math-dynamical Part 10 for the recipe).
  • Policy iteration: equivalence to value iteration is not in Mathlib — author a local lemma in the host repository and cite it.

Part 10 — Convex-Optimization Cross-Reference

GoalMathlib lemma / tactic
Jensen's inequalityConvexOn.inner_le_iff, ConvexOn.smul_le_sum
Strict convexity → unique minimumStrictConvexOn.eq_of_le_of_le (host-repository lemma usually required)
Convex hull of a finite setMathlib.Analysis.Convex.HullconvexHull_eq
Polytope verticesMathlib.Analysis.Convex.Extrema — extreme-point characterisation
KKT conditionsNo general KKT API in Mathlib; author locally and cite
stdSimplex.le_one (single-coord ≤ 1)Mathlib/Analysis/Convex/StdSimplex.lean:304 — prefer over (mem_Icc_of_mem_stdSimplex h x).2 for single-coordinate queries

See also

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.