knapsack5_weight
def
In the five-item knapsack instance of arXiv:2611.33095 Section 3, the items have weights: item 0 (A) has weight 1, item 1 (B) has weight 2, item 2 (E) has weight 2, item 3 (C) has weight 3, and item 4 (J) has weight 3.
Statement
def knapsack5_weight : Fin 5 → ℕ- Defined in
- arXiv:2611.33095 Section 3
- Verified
- 29 Nov 2026
- Axioms
- none listed
- Used by 2
- knapsack5_expected_offline_opt_eqThe expected offline optimum in the five-item knapsack instance equals 1011/50, i.e., knapsack5_expected_offline_opt = 1011 / 50.
- 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.
Read back from the Lean
The function knapsack5_weight from Fin 5 to ℕ defined by mapping index 0 to 1, index 1 to 2, index 2 to 2, index 3 to 3, and index 4 (the catch-all pattern _) to 3.
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
/-- Item weights for the 5-item knapsack instance. -/ def knapsack5_weight : Fin 5 → ℕ := fun i => match i with | 0 => 1 | 1 => 2 | 2 => 2 | 3 => 3 | _ => 3