Partition
Lax799700.Partition · concepts/Lax799700/Partition.lean · lax-799700
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Theorem
PARTITION: can a family of numbers be split into two parts of equal sum? It lives on the vocabulary of Knapsack with the target symbol unused: what a part must match is the weight of the items it leaves out. That is what makes Partition a different problem rather than a special case of Knapsack: the number to reach, half the total, is not part of the instance, so an interpretation cannot compute it, and the classical padding by two extra items is not first-order definable. Hardness comes instead by an ordered first-order reduction from NAE-SAT, whose not-all-equal condition is the two-sided constraint a balanced split imposes. Membership is by an existential second-order definition.
Concept map
Evidence
Lean source view on GitHub
| 1 | import Mathlib.Algebra.BigOperators.Finprod |
| 2 | import Mathlib.ModelTheory.Semantics |
| 3 | import Mathlib.ModelTheory.Complexity |
| 4 | import Mathlib.Tactic.FinCases |
| 5 | import Mathlib.Data.Set.Finite.Lemmas |
| 6 | import Mathlib.Data.Fintype.EquivFin |
| 7 | import Mathlib.Data.Set.Card |
| 8 | import Mathlib.SetTheory.Cardinal.Finite |
| 9 | import Mathlib.Logic.Equiv.Prod |
| 10 | import Mathlib.ModelTheory.Syntax |
| 11 | import Lax799700.Knapsack |
| 12 | import Lax904597.Machines |
| 13 | import Lax904597.Classes |
| 14 | import Lax799700.Problems |
| 15 | |
| 16 | /-! |
| 17 | --- |
| 18 | title: Partition |
| 19 | type: theorem |
| 20 | --- |
| 21 | PARTITION: can a family of numbers be split into two parts of equal sum? |
| 22 | It lives on the vocabulary of Knapsack with the target symbol unused: |
| 23 | what a part must match is the weight of the items it leaves out. That is |
| 24 | what makes Partition a different problem rather than a special case of |
| 25 | Knapsack: the number to reach, half the total, is not part of the |
| 26 | instance, so an interpretation cannot compute it, and the classical |
| 27 | padding by two extra items is not first-order definable. Hardness comes |
| 28 | instead by an ordered first-order reduction from NAE-SAT, whose |
| 29 | not-all-equal condition is the two-sided constraint a balanced split |
| 30 | imposes. Membership is by an existential second-order definition. |
| 31 | |
| 32 | -/ |
| 33 | |
| 34 | namespace Lax799700.Partition |
| 35 | |
| 36 | open Lax799700.Knapsack Lax904597.Machines |
| 37 | |
| 38 | open FirstOrder |
| 39 | |
| 40 | open Language Structure |
| 41 | |
| 42 | section Problem |
| 43 | |
| 44 | variable (A : Type) [binWeights.Structure A] |
| 45 | |
| 46 | /-- A binary-weighted instance is a yes-instance of Partition when its order is |
| 47 | a linear order and some set of items weighs exactly as much as the items it |
| 48 | leaves out. -/ |
| 49 | def HasEqualSplit : Prop := |
| 50 | Finite A ∧ IsLinOrd (BWLe (A := A)) ∧ |
| 51 | ∃ S : A → Prop, (∀ i, S i → BWItem i) ∧ |
| 52 | (∑ᶠ i ∈ {i | S i}, BWWeight i) = ∑ᶠ i ∈ {i | BWItem i ∧ ¬S i}, BWWeight i |
| 53 | |
| 54 | end Problem |
| 55 | |
| 56 | open Lax904597.Problems Lax904597.Classes Lax799700.Problems |
| 57 | |
| 58 | /-- The property `HasEqualSplit` is isomorphism-invariant. -/ |
| 59 | axiom hasEqualSplit_iso : ∀ {A B : Type} [Lax799700.Knapsack.binWeights.Structure A] [Lax799700.Knapsack.binWeights.Structure B], |
| 60 | (A ≃[Lax799700.Knapsack.binWeights] B) → (HasEqualSplit A ↔ HasEqualSplit B) |
| 61 | |
| 62 | /-- The problem Partition: does the structure satisfy `HasEqualSplit`? -/ |
| 63 | def Partition : DecisionProblem Lax799700.Knapsack.binWeights := |
| 64 | DecisionProblem.ofPred HasEqualSplit |
| 65 | |
| 66 | /-- The yes-instances of Partition are exactly the structures satisfying |
| 67 | `HasEqualSplit`. -/ |
| 68 | axiom partition_iff : ∀ (A : Type) [Lax799700.Knapsack.binWeights.Structure A], Partition A ↔ HasEqualSplit A |
| 69 | |
| 70 | /-- Partition is NP-complete. -/ |
| 71 | axiom partition_NP_complete : NP.Complete Partition |
| 72 | |
| 73 | end Lax799700.Partition |
| 74 |
Used by
none
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments