AFTD Auto-Formalizing Theoretical Domains

knapsack5_expected_offline_opt

def

The expected offline optimum knapsack5_expected_offline_opt : ℝ in the five-item knapsack instance, defined as the sum over ω : Bool × Bool × Bool of (knapsack5_prob ω : ℝ) times sSup {r : ℝ | ∃ S : Finset (Fin 5), knapsack5_feasible S ∧ r = ∑ i ∈ S, knapsack5_principal_val ω i}.

Statement

open scoped BigOperators in
noncomputable def knapsack5_expected_offline_opt : ℝ
Defined in
arXiv:2611.33095 Section 3
Verified
29 Nov 2026
Axioms
none listed
Built on 3
  • knapsack5_probThe rational probability mass function knapsack5_prob : Bool × Bool × Bool → ℚ assigns to each state (a, b, j) the product of (if a then 1…
  • knapsack5_feasibleA subset of items in Fin 5 is feasible in the knapsack instance if the sum of its item weights does not exceed the knapsack capacity of 3.
  • knapsack5_principal_valThe function knapsack5_principal_val : Bool × Bool × Bool → Fin 5 → ℝ maps an uncurried state tuple (a, b, j) and an item i : Fin 5 to the…
Used by 1

Read back from the Lean

A definition of the real number knapsack5_expected_offline_opt, which is the expected maximum value attainable in a 5-item knapsack problem of capacity 3 over a random scenario ω = (a, b, j) ∈ Bool × Bool × Bool. It is defined as the sum over all triples ω = (a, b, j) of the product of: 1. The probability knapsack5_prob ω cast to ℝ, and 2. The supremum (in ℝ) of all real numbers r such that there exists a subset S ⊆ Fin 5 that is feasible (total weight at most 3) with total value ∑_{i ∈ S} knapsack5_principal_val ω i equal to r.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

open scoped BigOperators in
/-- Expected offline optimum for the five-item knapsack instance. -/
noncomputable def knapsack5_expected_offline_opt : ℝ := ∑ ω : Bool × Bool × Bool, (knapsack5_prob ω : ℝ) *
    sSup {r : ℝ | ∃ S : Finset (Fin 5), knapsack5_feasible S ∧ r = ∑ i ∈ S, knapsack5_principal_val ω i}
See it in the graphDiscuss this resultChallenge it