7.3. CSPs and computational complexity
-
FABL.maxCutTemplate[complete] -
FABL.maxThreeColoringTemplate[complete] -
FABL.maxE3LinTemplate[complete] -
FABL.e3SatPredicate[complete] -
FABL.maxE3SatTemplate[complete] -
FABL.MaxThreeSatPredicate[complete] -
FABL.maxThreeSatPredicateEval[complete] -
FABL.maxThreeSatTemplate[complete]
Example 7.21. The optimization problems used in this chapter are:
-
Max-3-Sat: maximize the number of satisfied clauses in a CNF whose clauses have width at most
3; -
Max-Cut: maximize the number of graph edges crossing a bipartition;
-
Max-E3-Lin: maximize the number of satisfied
\mathbb F_2-linear equations, each involving exactly three variables; -
Max-3-Coloring: maximize the number of bichromatic edges under a three-color assignment.
Lean code for Lemma7.3.1●8 definitions
Associated Lean declarations
-
FABL.maxCutTemplate[complete]
-
FABL.maxThreeColoringTemplate[complete]
-
FABL.maxE3LinTemplate[complete]
-
FABL.e3SatPredicate[complete]
-
FABL.maxE3SatTemplate[complete]
-
FABL.MaxThreeSatPredicate[complete]
-
FABL.maxThreeSatPredicateEval[complete]
-
FABL.maxThreeSatTemplate[complete]
-
FABL.maxCutTemplate[complete] -
FABL.maxThreeColoringTemplate[complete] -
FABL.maxE3LinTemplate[complete] -
FABL.e3SatPredicate[complete] -
FABL.maxE3SatTemplate[complete] -
FABL.MaxThreeSatPredicate[complete] -
FABL.maxThreeSatPredicateEval[complete] -
FABL.maxThreeSatTemplate[complete]
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.maxCutTemplate : FABL.CSPTemplate FABL.Sign
def FABL.maxCutTemplate : FABL.CSPTemplate FABL.Sign
The single inequality predicate used by Max-Cut.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.maxThreeColoringTemplate : FABL.CSPTemplate (Fin 3)
def FABL.maxThreeColoringTemplate : FABL.CSPTemplate (Fin 3)
The single inequality predicate used by Max-3-Coloring.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.maxE3LinTemplate : FABL.CSPTemplate FABL.𝔽₂
def FABL.maxE3LinTemplate : FABL.CSPTemplate FABL.𝔽₂
The two possible right-hand sides of an exact three-variable equation over `𝔽₂`.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.e3SatPredicate (negated values : Fin 3 → Bool) : Bool
def FABL.e3SatPredicate (negated values : Fin 3 → Bool) : Bool
A three-literal disjunction, with one negation bit for each literal.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.maxE3SatTemplate : FABL.CSPTemplate Bool
def FABL.maxE3SatTemplate : FABL.CSPTemplate Bool
The eight exact-three-literal predicates used by Max-E3-Sat.
-
abbrevdefined in FABL/Chapter07/CSP.leancomplete
abbrev FABL.MaxThreeSatPredicate : Type
abbrev FABL.MaxThreeSatPredicate : Type
Predicate names for clauses of width one, two, or three.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.maxThreeSatPredicateEval (p : FABL.MaxThreeSatPredicate) (values : Fin (↑p.fst + 1) → Bool) : Bool
def FABL.maxThreeSatPredicateEval (p : FABL.MaxThreeSatPredicate) (values : Fin (↑p.fst + 1) → Bool) : Bool
Disjunction of a nonempty tuple of literals.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.maxThreeSatTemplate : FABL.CSPTemplate Bool
def FABL.maxThreeSatTemplate : FABL.CSPTemplate Bool
The fourteen width-at-most-three clause predicates used by Max-3-Sat.
-
FABL.CSPTemplate[complete] -
FABL.CSPTemplate.maxArity[complete] -
FABL.CSPTemplate.maxArity_eq_of_forall_arity_eq[complete]
Definition 7.22. A finite-domain CSP is specified by a finite set
\Psi of predicates. A predicate may have its own arity,
\psi:\Omega^r\to\{0,1\},
and the arity of the CSP is the maximum such r.
For Max-3-Sat, \Psi consists of the eight signed three-literal ORs,
four signed two-literal ORs, and two signed one-literal ORs. Max-Cut and
Max-3-Coloring use inequality on the sign and three-color domains,
respectively. Max-E3-Lin uses the two predicates
x_1+x_2+x_3 and x_1+x_2+x_3+1 over \mathbb F_2.
Lean code for Definition7.3.2●3 declarations
Associated Lean declarations
-
FABL.CSPTemplate[complete]
-
FABL.CSPTemplate.maxArity[complete]
-
FABL.CSPTemplate.maxArity_eq_of_forall_arity_eq[complete]
-
FABL.CSPTemplate[complete] -
FABL.CSPTemplate.maxArity[complete] -
FABL.CSPTemplate.maxArity_eq_of_forall_arity_eq[complete]
-
structuredefined in FABL/Chapter07/CSP.leancomplete
structure FABL.CSPTemplate.{u, v} (D : Type u) : Type (max u (v + 1))
structure FABL.CSPTemplate.{u, v} (D : Type u) : Type (max u (v + 1))
O'Donnell, Definition 7.22: a finite family of predicates over a domain `D`. Using a finite index type avoids imposing decidable equality on dependent function values while still presenting exactly a finite collection of predicate types.
Fields
Predicate : Type v
Names of the allowed predicates.
fintypePredicate : Fintype self.Predicate
The predicate family is finite.
arity : self.Predicate → ℕ
Arity of an allowed predicate.
eval : (p : self.Predicate) → (Fin (self.arity p) → D) → Bool
Evaluation of an allowed predicate; `true` means that the constraint is satisfied.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPTemplate.maxArity.{u, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) : ℕ
def FABL.CSPTemplate.maxArity.{u, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) : ℕ
Maximum arity of the predicates in a finite CSP template.
-
theoremdefined in FABL/Chapter07/CSP.leancomplete
theorem FABL.CSPTemplate.maxArity_eq_of_forall_arity_eq.{u, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) [Nonempty Ψ.Predicate] {r : ℕ} (h : ∀ (p : Ψ.Predicate), Ψ.arity p = r) : Ψ.maxArity = r
theorem FABL.CSPTemplate.maxArity_eq_of_forall_arity_eq.{u, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) [Nonempty Ψ.Predicate] {r : ℕ} (h : ∀ (p : Ψ.Predicate), Ψ.arity p = r) : Ψ.maxArity = r
Remark 7.23. A Boolean CSP has domain \{0,1\} (or signs).
Max-\psi means that the allowed predicate set is the singleton
\{\psi\}. The prefix E3 requires exactly three variables per
constraint, whereas 3-Lin and 3-Sat permit arities at most three unless E3
is written explicitly.
-
FABL.CSPConstraint[complete] -
FABL.CSPTemplate.unsatisfiedCost[complete] -
FABL.CSPTemplate.toValuedCSP[complete] -
FABL.CSPConstraint.toValuedTerm[complete] -
FABL.CSPConstraint.evalSolution_toValuedTerm[complete] -
FABL.CSPInstance[complete] -
FABL.CSPInstance.toValuedInstance[complete]
Definition 7.24. An instance P of Max-CSP(\Psi) is a nonempty
finite multiset of constraints C=(S,\psi). If \psi has arity r,
then S=(v_1,\ldots,v_r) is an injective tuple of variables. Every
variable occurs in at least one scope. With domain, predicate set, and
arity fixed as constants and n=|V|, the encoded input size lies between
n and O(|P|\log n).
The finite instance, injective scopes, nonempty multiset, participation
invariant, and Mathlib ValuedCSP bridge are formalized. The displayed
bit-encoding size estimate remains a representation-level claim until a
concrete variable-name and constraint codec is supplied.
Lean code for Definition7.3.4●7 declarations
Associated Lean declarations
-
FABL.CSPConstraint[complete]
-
FABL.CSPTemplate.unsatisfiedCost[complete]
-
FABL.CSPTemplate.toValuedCSP[complete]
-
FABL.CSPConstraint.toValuedTerm[complete]
-
FABL.CSPConstraint.evalSolution_toValuedTerm[complete]
-
FABL.CSPInstance[complete]
-
FABL.CSPInstance.toValuedInstance[complete]
-
FABL.CSPConstraint[complete] -
FABL.CSPTemplate.unsatisfiedCost[complete] -
FABL.CSPTemplate.toValuedCSP[complete] -
FABL.CSPConstraint.toValuedTerm[complete] -
FABL.CSPConstraint.evalSolution_toValuedTerm[complete] -
FABL.CSPInstance[complete] -
FABL.CSPInstance.toValuedInstance[complete]
-
structuredefined in FABL/Chapter07/CSP.leancomplete
structure FABL.CSPConstraint.{u, v, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) (V : Type v) : Type (max u_1 v)
structure FABL.CSPConstraint.{u, v, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) (V : Type v) : Type (max u_1 v)
One constraint of a Max-CSP instance. Its embedding-valued scope makes repeated variables unrepresentable.
Fields
predicate : Ψ.Predicate
Predicate applied by this constraint.
scope : Fin (Ψ.arity self.predicate) ↪ V
Ordered tuple of pairwise-distinct variables.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPTemplate.unsatisfiedCost.{u, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) (p : Ψ.Predicate) (x : Fin (Ψ.arity p) → D) : ℕ
def FABL.CSPTemplate.unsatisfiedCost.{u, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) (p : Ψ.Predicate) (x : Fin (Ψ.arity p) → D) : ℕ
The zero-one cost complementary to a CSP predicate.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPTemplate.toValuedCSP.{u, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) : ValuedCSP D ℕ
def FABL.CSPTemplate.toValuedCSP.{u, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) : ValuedCSP D ℕ
The Mathlib valued-CSP template obtained by charging one for an unsatisfied constraint.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPConstraint.toValuedTerm.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (c : FABL.CSPConstraint Ψ V) : Ψ.toValuedCSP.Term V
def FABL.CSPConstraint.toValuedTerm.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (c : FABL.CSPConstraint Ψ V) : Ψ.toValuedCSP.Term V
Interpret a book constraint as a term of Mathlib's cost-minimizing `ValuedCSP`.
-
theoremdefined in FABL/Chapter07/CSP.leancomplete
theorem FABL.CSPConstraint.evalSolution_toValuedTerm.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (c : FABL.CSPConstraint Ψ V) (assignment : V → D) : c.toValuedTerm.evalSolution assignment = c.unsatisfiedIndicator assignment
theorem FABL.CSPConstraint.evalSolution_toValuedTerm.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (c : FABL.CSPConstraint Ψ V) (assignment : V → D) : c.toValuedTerm.evalSolution assignment = c.unsatisfiedIndicator assignment
-
structuredefined in FABL/Chapter07/CSP.leancomplete
structure FABL.CSPInstance.{u, v, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) (V : Type v) : Type (max u_1 v)
structure FABL.CSPInstance.{u, v, u_1} {D : Type u} (Ψ : FABL.CSPTemplate D) (V : Type v) : Type (max u_1 v)
O'Donnell, Definition 7.24: a nonempty multiset of constraints in which every declared variable participates.
Fields
constraints : Multiset (FABL.CSPConstraint Ψ V)
Constraint multiset; multiplicity records integer weights.
constraints_nonempty : self.constraints ≠ 0
Normalized value requires at least one constraint.
participates : ∀ (variableName : V), ∃ constraint ∈ self.constraints, variableName ∈ Set.range ⇑constraint.scope
Every declared variable occurs in some constraint scope.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPInstance.toValuedInstance.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) : Ψ.toValuedCSP.Instance V
def FABL.CSPInstance.toValuedInstance.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) : Ψ.toValuedCSP.Instance V
The underlying Mathlib valued-CSP instance.
-
FABL.maxCutConstraintScope[complete] -
FABL.maxCutConstraint_scope_ne[complete] -
FABL.maxCutInstance_exists_incident_constraint[complete] -
FABL.twoVertexMaxCutConstraint[complete] -
FABL.parallelEdgeMaxCutInstance[complete] -
FABL.parallelEdgeMaxCutInstance_card[complete]
Remark 7.25. The Max-Cut convention permits parallel edges but forbids self-loops and isolated vertices; the graph need not be connected.
Lean code for Lemma7.3.5●6 declarations
Associated Lean declarations
-
FABL.maxCutConstraintScope[complete]
-
FABL.maxCutConstraint_scope_ne[complete]
-
FABL.maxCutInstance_exists_incident_constraint[complete]
-
FABL.twoVertexMaxCutConstraint[complete]
-
FABL.parallelEdgeMaxCutInstance[complete]
-
FABL.parallelEdgeMaxCutInstance_card[complete]
-
FABL.maxCutConstraintScope[complete] -
FABL.maxCutConstraint_scope_ne[complete] -
FABL.maxCutInstance_exists_incident_constraint[complete] -
FABL.twoVertexMaxCutConstraint[complete] -
FABL.parallelEdgeMaxCutInstance[complete] -
FABL.parallelEdgeMaxCutInstance_card[complete]
-
defdefined in FABL/Chapter07/CSPExamples.leancomplete
def FABL.maxCutConstraintScope.{u} {V : Type u} (c : FABL.CSPConstraint FABL.maxCutTemplate V) : Fin 2 ↪ V
def FABL.maxCutConstraintScope.{u} {V : Type u} (c : FABL.CSPConstraint FABL.maxCutTemplate V) : Fin 2 ↪ V
The two ordered endpoints of a Max-Cut constraint.
-
theoremdefined in FABL/Chapter07/CSPExamples.leancomplete
theorem FABL.maxCutConstraint_scope_ne.{u} {V : Type u} (c : FABL.CSPConstraint FABL.maxCutTemplate V) : (FABL.maxCutConstraintScope c) 0 ≠ (FABL.maxCutConstraintScope c) 1
theorem FABL.maxCutConstraint_scope_ne.{u} {V : Type u} (c : FABL.CSPConstraint FABL.maxCutTemplate V) : (FABL.maxCutConstraintScope c) 0 ≠ (FABL.maxCutConstraintScope c) 1
A Max-Cut constraint cannot be a self-loop because its scope is an embedding.
-
theoremdefined in FABL/Chapter07/CSPExamples.leancomplete
theorem FABL.maxCutInstance_exists_incident_constraint.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxCutTemplate V) (v : V) : ∃ c ∈ P.constraints, v = (FABL.maxCutConstraintScope c) 0 ∨ v = (FABL.maxCutConstraintScope c) 1
theorem FABL.maxCutInstance_exists_incident_constraint.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxCutTemplate V) (v : V) : ∃ c ∈ P.constraints, v = (FABL.maxCutConstraintScope c) 0 ∨ v = (FABL.maxCutConstraintScope c) 1
Every declared vertex of a Max-Cut instance is incident to some edge.
-
defdefined in FABL/Chapter07/CSPExamples.leancomplete
def FABL.twoVertexMaxCutConstraint : FABL.CSPConstraint FABL.maxCutTemplate (Fin 2)
def FABL.twoVertexMaxCutConstraint : FABL.CSPConstraint FABL.maxCutTemplate (Fin 2)
The canonical two-vertex Max-Cut edge.
-
defdefined in FABL/Chapter07/CSPExamples.leancomplete
def FABL.parallelEdgeMaxCutInstance : FABL.CSPInstance FABL.maxCutTemplate (Fin 2)
def FABL.parallelEdgeMaxCutInstance : FABL.CSPInstance FABL.maxCutTemplate (Fin 2)
A Max-Cut instance containing two parallel copies of the same edge.
-
theoremdefined in FABL/Chapter07/CSPExamples.leancomplete
theorem FABL.parallelEdgeMaxCutInstance_card : FABL.parallelEdgeMaxCutInstance.constraints.card = 2
theorem FABL.parallelEdgeMaxCutInstance_card : FABL.parallelEdgeMaxCutInstance.constraints.card = 2
-
FABL.CSPConstraint.Satisfied[complete] -
FABL.CSPConstraint.satisfiedIndicator[complete] -
FABL.CSPConstraint.unsatisfiedIndicator[complete] -
FABL.CSPInstance.satisfiedCount[complete] -
FABL.CSPInstance.unsatisfiedCost[complete] -
FABL.CSPInstance.satisfiedCount_add_unsatisfiedCost[complete] -
FABL.CSPInstance.value[complete] -
FABL.CSPInstance.value_eq_one_sub_unsatisfiedCost_div[complete] -
FABL.CSPInstance.optimalAssignment[complete] -
FABL.CSPInstance.optimum[complete] -
FABL.CSPInstance.optimum_nonneg[complete] -
FABL.CSPInstance.value_le_optimum[complete] -
FABL.CSPInstance.Satisfiable[complete] -
FABL.CSPInstance.satisfiable_iff_exists_fullySatisfied[complete]
Definition 7.26. An assignment is a map F:V\to\Omega. A constraint
(S,\psi) is satisfied exactly when \psi(F(S))=1. Its value and the
instance optimum are
\operatorname{Val}_P(F)
=\mathbb E_{(S,\psi)\sim P}[\psi(F(S))],
\tag{7.3}
\operatorname{Opt}(P)=\max_{F:V\to\Omega}\operatorname{Val}_P(F).
The instance is satisfiable when \operatorname{Opt}(P)=1.
Lean code for Definition7.3.6●14 declarations
Associated Lean declarations
-
FABL.CSPConstraint.Satisfied[complete]
-
FABL.CSPConstraint.satisfiedIndicator[complete]
-
FABL.CSPConstraint.unsatisfiedIndicator[complete]
-
FABL.CSPInstance.satisfiedCount[complete]
-
FABL.CSPInstance.unsatisfiedCost[complete]
-
FABL.CSPInstance.satisfiedCount_add_unsatisfiedCost[complete]
-
FABL.CSPInstance.value[complete]
-
FABL.CSPInstance.value_eq_one_sub_unsatisfiedCost_div[complete]
-
FABL.CSPInstance.optimalAssignment[complete]
-
FABL.CSPInstance.optimum[complete]
-
FABL.CSPInstance.optimum_nonneg[complete]
-
FABL.CSPInstance.value_le_optimum[complete]
-
FABL.CSPInstance.Satisfiable[complete]
-
FABL.CSPInstance.satisfiable_iff_exists_fullySatisfied[complete]
-
FABL.CSPConstraint.Satisfied[complete] -
FABL.CSPConstraint.satisfiedIndicator[complete] -
FABL.CSPConstraint.unsatisfiedIndicator[complete] -
FABL.CSPInstance.satisfiedCount[complete] -
FABL.CSPInstance.unsatisfiedCost[complete] -
FABL.CSPInstance.satisfiedCount_add_unsatisfiedCost[complete] -
FABL.CSPInstance.value[complete] -
FABL.CSPInstance.value_eq_one_sub_unsatisfiedCost_div[complete] -
FABL.CSPInstance.optimalAssignment[complete] -
FABL.CSPInstance.optimum[complete] -
FABL.CSPInstance.optimum_nonneg[complete] -
FABL.CSPInstance.value_le_optimum[complete] -
FABL.CSPInstance.Satisfiable[complete] -
FABL.CSPInstance.satisfiable_iff_exists_fullySatisfied[complete]
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPConstraint.Satisfied.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (c : FABL.CSPConstraint Ψ V) (assignment : V → D) : Prop
def FABL.CSPConstraint.Satisfied.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (c : FABL.CSPConstraint Ψ V) (assignment : V → D) : Prop
An assignment satisfies a constraint when its predicate evaluates to true.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPConstraint.satisfiedIndicator.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (c : FABL.CSPConstraint Ψ V) (assignment : V → D) : ℕ
def FABL.CSPConstraint.satisfiedIndicator.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (c : FABL.CSPConstraint Ψ V) (assignment : V → D) : ℕ
Indicator of a satisfied constraint.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPConstraint.unsatisfiedIndicator.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (c : FABL.CSPConstraint Ψ V) (assignment : V → D) : ℕ
def FABL.CSPConstraint.unsatisfiedIndicator.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (c : FABL.CSPConstraint Ψ V) (assignment : V → D) : ℕ
Indicator of an unsatisfied constraint.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPInstance.satisfiedCount.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) (assignment : V → D) : ℕ
def FABL.CSPInstance.satisfiedCount.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) (assignment : V → D) : ℕ
Number of satisfied constraints, including multiplicity.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPInstance.unsatisfiedCost.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) (assignment : V → D) : ℕ
def FABL.CSPInstance.unsatisfiedCost.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) (assignment : V → D) : ℕ
Number of unsatisfied constraints, expressed through Mathlib's `ValuedCSP` evaluator.
-
theoremdefined in FABL/Chapter07/CSP.leancomplete
theorem FABL.CSPInstance.satisfiedCount_add_unsatisfiedCost.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) (assignment : V → D) : P.satisfiedCount assignment + P.unsatisfiedCost assignment = P.constraints.card
theorem FABL.CSPInstance.satisfiedCount_add_unsatisfiedCost.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) (assignment : V → D) : P.satisfiedCount assignment + P.unsatisfiedCost assignment = P.constraints.card
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPInstance.value.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) (assignment : V → D) : ℚ
def FABL.CSPInstance.value.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) (assignment : V → D) : ℚ
O'Donnell, Definition 7.26: the fraction of constraints satisfied by an assignment.
-
theoremdefined in FABL/Chapter07/CSP.leancomplete
theorem FABL.CSPInstance.value_eq_one_sub_unsatisfiedCost_div.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) (assignment : V → D) : P.value assignment = 1 - ↑(P.unsatisfiedCost assignment) / ↑P.constraints.card
theorem FABL.CSPInstance.value_eq_one_sub_unsatisfiedCost_div.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (P : FABL.CSPInstance Ψ V) (assignment : V → D) : P.value assignment = 1 - ↑(P.unsatisfiedCost assignment) / ↑P.constraints.card
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPInstance.optimalAssignment.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) : V → D
def FABL.CSPInstance.optimalAssignment.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) : V → D
A maximizing assignment, whose existence is supplied by finite extrema.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPInstance.optimum.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) : ℚ
def FABL.CSPInstance.optimum.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) : ℚ
O'Donnell, Definition 7.26: maximum value over all assignments.
-
theoremdefined in FABL/Chapter07/CSP.leancomplete
theorem FABL.CSPInstance.optimum_nonneg.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) : 0 ≤ P.optimum
theorem FABL.CSPInstance.optimum_nonneg.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) : 0 ≤ P.optimum
-
theoremdefined in FABL/Chapter07/CSP.leancomplete
theorem FABL.CSPInstance.value_le_optimum.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) (assignment : V → D) : P.value assignment ≤ P.optimum
theorem FABL.CSPInstance.value_le_optimum.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) (assignment : V → D) : P.value assignment ≤ P.optimum
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.CSPInstance.Satisfiable.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) : Prop
def FABL.CSPInstance.Satisfiable.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) : Prop
An instance is satisfiable when its optimum value is one.
-
theoremdefined in FABL/Chapter07/CSP.leancomplete
theorem FABL.CSPInstance.satisfiable_iff_exists_fullySatisfied.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) : P.Satisfiable ↔ ∃ assignment, P.FullySatisfied assignment
theorem FABL.CSPInstance.satisfiable_iff_exists_fullySatisfied.{u, v, u_1} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} [Finite D] [Nonempty D] [Finite V] (P : FABL.CSPInstance Ψ V) : P.Satisfiable ↔ ∃ assignment, P.FullySatisfied assignment
Remark 7.27. Variable names and their assigned values are distinct
objects. Thus a constraint is evaluated using F(x_i), not by silently
identifying x_i with a domain element.
Definition 7.28. Max-CSP(\Psi) is the optimization task which, on
input a valid instance P, outputs an assignment having as large a value
\operatorname{Val}_P as possible.
Lean code for Definition7.3.8●1 definition
Associated Lean declarations
-
FABL.EncodedMaximizationProblem[complete]
-
FABL.EncodedMaximizationProblem[complete]
-
structuredefined in FABL/Chapter07/Complexity.leancomplete
structure FABL.EncodedMaximizationProblem : Type
structure FABL.EncodedMaximizationProblem : Type
A maximization problem presented at the binary encoding boundary. Mathematical CSP values remain in `CSP.lean`; an application supplies the concrete encoders and the following semantics.
Fields
instances : Language Bool
Well-formed encoded instances.
Feasible : List Bool → List Bool → Prop
Feasibility relation between an instance and an encoded solution.
value : List Bool → List Bool → ℚ
Objective value of an encoded solution.
optimum : List Bool → ℚ
Optimum objective value of an encoded instance.
value_le_optimum : ∀ {input solution : List Bool}, input ∈ self.instances → self.Feasible input solution → self.value input solution ≤ self.optimum input
Feasible solutions never exceed the stated optimum.
-
FABL.UniformStringTester[complete] -
FABL.UniformStringTester.constraint[complete] -
FABL.UniformStringTester.toCSPInstance[complete] -
FABL.UniformStringTester.acceptance[complete] -
FABL.UniformStringTester.acceptance_eq_value[complete]
Finite CSPs and finite uniformly randomized string testers are equivalent.
Sampling a uniform constraint of an arity-r CSP and checking its
predicate gives an r-query tester satisfying
\Pr[T\text{ accepts }F]=\operatorname{Val}_P(F).
Conversely, enumerating every random seed of a tester whose seed space is
finite and uniform and whose query tuple is injective gives a CSP instance
with the same acceptance value. General real-valued seed probabilities and
repeated query positions require, respectively, weighted constraints and
the duplicate-scope repair of Exercise 7.31; they are not silently coerced
to an unweighted CSP.
Lean code for Theorem7.3.9●5 declarations
Associated Lean declarations
-
FABL.UniformStringTester[complete]
-
FABL.UniformStringTester.constraint[complete]
-
FABL.UniformStringTester.toCSPInstance[complete]
-
FABL.UniformStringTester.acceptance[complete]
-
FABL.UniformStringTester.acceptance_eq_value[complete]
-
FABL.UniformStringTester[complete] -
FABL.UniformStringTester.constraint[complete] -
FABL.UniformStringTester.toCSPInstance[complete] -
FABL.UniformStringTester.acceptance[complete] -
FABL.UniformStringTester.acceptance_eq_value[complete]
-
structuredefined in FABL/Chapter07/CSP.leancomplete
structure FABL.UniformStringTester.{u, v, u_1, u_2} {D : Type u} (Ψ : FABL.CSPTemplate D) (V : Type v) : Type (max (max (u_1 + 1) u_2) v)
structure FABL.UniformStringTester.{u, v, u_1, u_2} {D : Type u} (Ψ : FABL.CSPTemplate D) (V : Type v) : Type (max (max (u_1 + 1) u_2) v)
A finite uniform string tester whose queries are distinct and collectively cover its declared variables. These are exactly the hypotheses needed for the tester-to-CSP direction under Definition 7.24.
Fields
Seed : Type u_1
Uniform finite random seed.
fintypeSeed : Fintype self.Seed
The seed space is finite.
nonemptySeed : Nonempty self.Seed
A uniform seed can be drawn.
predicate : self.Seed → Ψ.Predicate
Predicate selected by a seed.
scope : (seed : self.Seed) → Fin (Ψ.arity (self.predicate seed)) ↪ V
Ordered tuple of distinct queries selected by a seed.
covers : ∀ (variableName : V), ∃ seed, variableName ∈ Set.range ⇑(self.scope seed)
Every declared string coordinate is queried for at least one seed.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.UniformStringTester.constraint.{u, v, u_1, u_2} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (T : FABL.UniformStringTester Ψ V) (seed : T.Seed) : FABL.CSPConstraint Ψ V
def FABL.UniformStringTester.constraint.{u, v, u_1, u_2} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (T : FABL.UniformStringTester Ψ V) (seed : T.Seed) : FABL.CSPConstraint Ψ V
Constraint selected by a tester seed.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.UniformStringTester.toCSPInstance.{u, v, u_1, u_2} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (T : FABL.UniformStringTester Ψ V) : FABL.CSPInstance Ψ V
def FABL.UniformStringTester.toCSPInstance.{u, v, u_1, u_2} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (T : FABL.UniformStringTester Ψ V) : FABL.CSPInstance Ψ V
Enumerating the uniform seeds produces a genuine CSP multiset, retaining duplicate constraints when different seeds make the same test.
-
defdefined in FABL/Chapter07/CSP.leancomplete
def FABL.UniformStringTester.acceptance.{u, v, u_1, u_2} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (T : FABL.UniformStringTester Ψ V) (assignment : V → D) : ℚ
def FABL.UniformStringTester.acceptance.{u, v, u_1, u_2} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (T : FABL.UniformStringTester Ψ V) (assignment : V → D) : ℚ
Acceptance probability of a finite uniform tester on a fixed assignment.
-
theoremdefined in FABL/Chapter07/CSP.leancomplete
theorem FABL.UniformStringTester.acceptance_eq_value.{u, v, u_1, u_2} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (T : FABL.UniformStringTester Ψ V) (assignment : V → D) : T.acceptance assignment = T.toCSPInstance.value assignment
theorem FABL.UniformStringTester.acceptance_eq_value.{u, v, u_1, u_2} {D : Type u} {Ψ : FABL.CSPTemplate D} {V : Type v} (T : FABL.UniformStringTester Ψ V) (assignment : V → D) : T.acceptance assignment = T.toCSPInstance.value assignment
The tester's acceptance probability is exactly the value of its associated CSP assignment.
-
FABL.MaxThreeLinPredicate[complete] -
FABL.maxAtMostThreeLinTemplate[complete] -
FABL.maxArity_maxAtMostThreeLinTemplate[complete] -
FABL.OddWeightPartialSumVariable[complete] -
FABL.oddWeightPartialSumCSPPredicate[complete] -
FABL.oddWeightPartialSumCSPScope[complete] -
FABL.oddWeightPartialSumUniformStringTester[complete] -
FABL.oddWeightPartialSumCSPAssignment[complete] -
FABL.oddWeightPartialSumCSPPredicate_eval[complete] -
FABL.card_oddWeightPartialSumVariable[complete] -
FABL.oddWeightPartialSumUniformStringTester_acceptance_eq_value[complete] -
FABL.oddWeightPartialSumUniformStringTester_acceptance_eq_expect[complete] -
FABL.blrQueryTriple[complete] -
FABL.BLRQueriesCollide[complete] -
FABL.blrCSPConstraint[complete] -
FABL.blrCSPPredicate[complete] -
FABL.blrCSPScope[complete] -
FABL.blrCSPPredicate_eval[complete] -
FABL.blrUniformStringTester[complete] -
FABL.card_blrTruthTableVariables[complete] -
FABL.blrUniformStringTester_acceptance_eq_value[complete] -
FABL.blrUniformStringTester_acceptance_eq_expect[complete]
Example 7.29. The PCPP of Example 7.15 is a Max-3-Lin instance on
2n-1 variables. The BLR tester is a Max-3-Lin instance on the 2^n
truth-table variables, with equations
F(x)+F(y)+F(x+y)=0.
When a displayed equation repeats a variable, equal variables are first
cancelled over \mathbb F_2, producing an equivalent constraint of arity
at most three with an injective scope.
The compiled BLR instance retains all 2^n truth-table variables for
n\ge2. In dimensions zero and one, cancellation makes nonzero
truth-table coordinates isolated, so they must be removed before imposing
Definition 7.24's participation invariant; this endpoint is recorded rather
than represented by a false coverage proof.
Lean code for Lemma7.3.10●22 declarations
Associated Lean declarations
-
FABL.MaxThreeLinPredicate[complete]
-
FABL.maxAtMostThreeLinTemplate[complete]
-
FABL.maxArity_maxAtMostThreeLinTemplate[complete]
-
FABL.OddWeightPartialSumVariable[complete]
-
FABL.oddWeightPartialSumCSPPredicate[complete]
-
FABL.oddWeightPartialSumCSPScope[complete]
-
FABL.oddWeightPartialSumUniformStringTester[complete]
-
FABL.oddWeightPartialSumCSPAssignment[complete]
-
FABL.oddWeightPartialSumCSPPredicate_eval[complete]
-
FABL.card_oddWeightPartialSumVariable[complete]
-
FABL.oddWeightPartialSumUniformStringTester_acceptance_eq_value[complete]
-
FABL.oddWeightPartialSumUniformStringTester_acceptance_eq_expect[complete]
-
FABL.blrQueryTriple[complete]
-
FABL.BLRQueriesCollide[complete]
-
FABL.blrCSPConstraint[complete]
-
FABL.blrCSPPredicate[complete]
-
FABL.blrCSPScope[complete]
-
FABL.blrCSPPredicate_eval[complete]
-
FABL.blrUniformStringTester[complete]
-
FABL.card_blrTruthTableVariables[complete]
-
FABL.blrUniformStringTester_acceptance_eq_value[complete]
-
FABL.blrUniformStringTester_acceptance_eq_expect[complete]
-
FABL.MaxThreeLinPredicate[complete] -
FABL.maxAtMostThreeLinTemplate[complete] -
FABL.maxArity_maxAtMostThreeLinTemplate[complete] -
FABL.OddWeightPartialSumVariable[complete] -
FABL.oddWeightPartialSumCSPPredicate[complete] -
FABL.oddWeightPartialSumCSPScope[complete] -
FABL.oddWeightPartialSumUniformStringTester[complete] -
FABL.oddWeightPartialSumCSPAssignment[complete] -
FABL.oddWeightPartialSumCSPPredicate_eval[complete] -
FABL.card_oddWeightPartialSumVariable[complete] -
FABL.oddWeightPartialSumUniformStringTester_acceptance_eq_value[complete] -
FABL.oddWeightPartialSumUniformStringTester_acceptance_eq_expect[complete] -
FABL.blrQueryTriple[complete] -
FABL.BLRQueriesCollide[complete] -
FABL.blrCSPConstraint[complete] -
FABL.blrCSPPredicate[complete] -
FABL.blrCSPScope[complete] -
FABL.blrCSPPredicate_eval[complete] -
FABL.blrUniformStringTester[complete] -
FABL.card_blrTruthTableVariables[complete] -
FABL.blrUniformStringTester_acceptance_eq_value[complete] -
FABL.blrUniformStringTester_acceptance_eq_expect[complete]
-
structuredefined in FABL/Chapter07/CSPTesterExamples.leancomplete
structure FABL.MaxThreeLinPredicate : Type
structure FABL.MaxThreeLinPredicate : Type
An affine equation over `𝔽₂` with at most three distinct variables.
Fields
arityIndex : Fin 4
Number of variables occurring in the equation.
rhs : FABL.𝔽₂
Right-hand side of the equation.
-
defdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
def FABL.maxAtMostThreeLinTemplate : FABL.CSPTemplate FABL.𝔽₂
def FABL.maxAtMostThreeLinTemplate : FABL.CSPTemplate FABL.𝔽₂
The mixed-arity Max-3-Lin template used by Example 7.29.
-
theoremdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
theorem FABL.maxArity_maxAtMostThreeLinTemplate : FABL.maxAtMostThreeLinTemplate.maxArity = 3
theorem FABL.maxArity_maxAtMostThreeLinTemplate : FABL.maxAtMostThreeLinTemplate.maxArity = 3
-
abbrevdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
abbrev FABL.OddWeightPartialSumVariable (m : ℕ) : Type
abbrev FABL.OddWeightPartialSumVariable (m : ℕ) : Type
The `2(m+2)-1` input-and-proof variables of Example 7.15.
-
defdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
def FABL.oddWeightPartialSumCSPPredicate {m : ℕ} (seed : FABL.OddWeightPartialSumCheckSeed m) : FABL.MaxThreeLinPredicate
def FABL.oddWeightPartialSumCSPPredicate {m : ℕ} (seed : FABL.OddWeightPartialSumCheckSeed m) : FABL.MaxThreeLinPredicate
Predicate selected by an endpoint or recurrence check of Example 7.15.
-
defdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
def FABL.oddWeightPartialSumCSPScope {m : ℕ} (seed : FABL.OddWeightPartialSumCheckSeed m) : Fin (FABL.maxAtMostThreeLinTemplate.arity (FABL.oddWeightPartialSumCSPPredicate seed)) ↪ FABL.OddWeightPartialSumVariable m
def FABL.oddWeightPartialSumCSPScope {m : ℕ} (seed : FABL.OddWeightPartialSumCheckSeed m) : Fin (FABL.maxAtMostThreeLinTemplate.arity (FABL.oddWeightPartialSumCSPPredicate seed)) ↪ FABL.OddWeightPartialSumVariable m
The distinct variables used by an endpoint or recurrence equation of Example 7.15.
-
defdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
def FABL.oddWeightPartialSumUniformStringTester (m : ℕ) : FABL.UniformStringTester FABL.maxAtMostThreeLinTemplate (FABL.OddWeightPartialSumVariable m)
def FABL.oddWeightPartialSumUniformStringTester (m : ℕ) : FABL.UniformStringTester FABL.maxAtMostThreeLinTemplate (FABL.OddWeightPartialSumVariable m)
The uniform constraint tester underlying Example 7.15.
-
defdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
def FABL.oddWeightPartialSumCSPAssignment {m : ℕ} (w : Fin (m + 2) → Bool) (proof : Fin (m + 1) → Bool) : FABL.OddWeightPartialSumVariable m → FABL.𝔽₂
def FABL.oddWeightPartialSumCSPAssignment {m : ℕ} (w : Fin (m + 2) → Bool) (proof : Fin (m + 1) → Bool) : FABL.OddWeightPartialSumVariable m → FABL.𝔽₂
Interpret an input and proof as the `𝔽₂` assignment used by the Max-3-Lin instance.
-
theoremdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
theorem FABL.oddWeightPartialSumCSPPredicate_eval {m : ℕ} (seed : FABL.OddWeightPartialSumCheckSeed m) (w : Fin (m + 2) → Bool) (proof : Fin (m + 1) → Bool) : FABL.maxAtMostThreeLinTemplate.eval (FABL.oddWeightPartialSumCSPPredicate seed) (FABL.oddWeightPartialSumCSPAssignment w proof ∘ ⇑(FABL.oddWeightPartialSumCSPScope seed)) = decide (FABL.OddWeightPartialSumCheckHolds seed w proof)
theorem FABL.oddWeightPartialSumCSPPredicate_eval {m : ℕ} (seed : FABL.OddWeightPartialSumCheckSeed m) (w : Fin (m + 2) → Bool) (proof : Fin (m + 1) → Bool) : FABL.maxAtMostThreeLinTemplate.eval (FABL.oddWeightPartialSumCSPPredicate seed) (FABL.oddWeightPartialSumCSPAssignment w proof ∘ ⇑(FABL.oddWeightPartialSumCSPScope seed)) = decide (FABL.OddWeightPartialSumCheckHolds seed w proof)
Every Max-3-Lin constraint is exactly the corresponding endpoint or recurrence check.
-
theoremdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
theorem FABL.card_oddWeightPartialSumVariable (m : ℕ) : Fintype.card (FABL.OddWeightPartialSumVariable m) = 2 * (m + 2) - 1
theorem FABL.card_oddWeightPartialSumVariable (m : ℕ) : Fintype.card (FABL.OddWeightPartialSumVariable m) = 2 * (m + 2) - 1
The CSP attached to Example 7.15 has exactly `2n-1` variables when `n=m+2`.
-
theoremdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
theorem FABL.oddWeightPartialSumUniformStringTester_acceptance_eq_value {m : ℕ} (w : Fin (m + 2) → Bool) (proof : Fin (m + 1) → Bool) : (FABL.oddWeightPartialSumUniformStringTester m).acceptance (FABL.oddWeightPartialSumCSPAssignment w proof) = (FABL.oddWeightPartialSumUniformStringTester m).toCSPInstance.value (FABL.oddWeightPartialSumCSPAssignment w proof)
theorem FABL.oddWeightPartialSumUniformStringTester_acceptance_eq_value {m : ℕ} (w : Fin (m + 2) → Bool) (proof : Fin (m + 1) → Bool) : (FABL.oddWeightPartialSumUniformStringTester m).acceptance (FABL.oddWeightPartialSumCSPAssignment w proof) = (FABL.oddWeightPartialSumUniformStringTester m).toCSPInstance.value (FABL.oddWeightPartialSumCSPAssignment w proof)
Enumerating Example 7.15's checks produces a Max-3-Lin instance with the same value.
-
theoremdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
theorem FABL.oddWeightPartialSumUniformStringTester_acceptance_eq_expect {m : ℕ} (w : Fin (m + 2) → Bool) (proof : Fin (m + 1) → Bool) : (FABL.oddWeightPartialSumUniformStringTester m).acceptance (FABL.oddWeightPartialSumCSPAssignment w proof) = Finset.univ.expect fun seed => if FABL.OddWeightPartialSumCheckHolds seed w proof then 1 else 0
theorem FABL.oddWeightPartialSumUniformStringTester_acceptance_eq_expect {m : ℕ} (w : Fin (m + 2) → Bool) (proof : Fin (m + 1) → Bool) : (FABL.oddWeightPartialSumUniformStringTester m).acceptance (FABL.oddWeightPartialSumCSPAssignment w proof) = Finset.univ.expect fun seed => if FABL.OddWeightPartialSumCheckHolds seed w proof then 1 else 0
The uniform CSP acceptance integrand is exactly the PCPP's endpoint/recurrence predicate.
-
defdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
def FABL.blrQueryTriple {n : ℕ} (x y : FABL.F₂Cube n) : Fin 3 → FABL.F₂Cube n
def FABL.blrQueryTriple {n : ℕ} (x y : FABL.F₂Cube n) : Fin 3 → FABL.F₂Cube n
The three BLR query positions before repeated variables are cancelled.
-
defdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
def FABL.BLRQueriesCollide {n : ℕ} (x y : FABL.F₂Cube n) : Prop
def FABL.BLRQueriesCollide {n : ℕ} (x y : FABL.F₂Cube n) : Prop
Exactly the cases in which the three BLR query positions are not distinct.
-
defdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
def FABL.blrCSPConstraint {n : ℕ} (x y : FABL.F₂Cube n) : FABL.CSPConstraint FABL.maxAtMostThreeLinTemplate (FABL.F₂Cube n)
def FABL.blrCSPConstraint {n : ℕ} (x y : FABL.F₂Cube n) : FABL.CSPConstraint FABL.maxAtMostThreeLinTemplate (FABL.F₂Cube n)
The injective affine constraint obtained by cancelling repeated BLR query variables.
-
defdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
def FABL.blrCSPPredicate {n : ℕ} (x y : FABL.F₂Cube n) : FABL.MaxThreeLinPredicate
def FABL.blrCSPPredicate {n : ℕ} (x y : FABL.F₂Cube n) : FABL.MaxThreeLinPredicate
Predicate selected after BLR collision cancellation.
-
defdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
def FABL.blrCSPScope {n : ℕ} (x y : FABL.F₂Cube n) : Fin (FABL.maxAtMostThreeLinTemplate.arity (FABL.blrCSPPredicate x y)) ↪ FABL.F₂Cube n
def FABL.blrCSPScope {n : ℕ} (x y : FABL.F₂Cube n) : Fin (FABL.maxAtMostThreeLinTemplate.arity (FABL.blrCSPPredicate x y)) ↪ FABL.F₂Cube n
Injective scope selected after BLR collision cancellation.
-
theoremdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
theorem FABL.blrCSPPredicate_eval {n : ℕ} (f : FABL.F₂Cube n → FABL.𝔽₂) (x y : FABL.F₂Cube n) : FABL.maxAtMostThreeLinTemplate.eval (FABL.blrCSPPredicate x y) (f ∘ ⇑(FABL.blrCSPScope x y)) = decide (FABL.blrAccepts f x y)
theorem FABL.blrCSPPredicate_eval {n : ℕ} (f : FABL.F₂Cube n → FABL.𝔽₂) (x y : FABL.F₂Cube n) : FABL.maxAtMostThreeLinTemplate.eval (FABL.blrCSPPredicate x y) (f ∘ ⇑(FABL.blrCSPScope x y)) = decide (FABL.blrAccepts f x y)
Evaluating the cancelled injective constraint is equivalent to the original BLR equation.
-
defdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
def FABL.blrUniformStringTester (n : ℕ) (hn : 2 ≤ n) : FABL.UniformStringTester FABL.maxAtMostThreeLinTemplate (FABL.F₂Cube n)
def FABL.blrUniformStringTester (n : ℕ) (hn : 2 ≤ n) : FABL.UniformStringTester FABL.maxAtMostThreeLinTemplate (FABL.F₂Cube n)
For `n≥2`, cancellation still leaves every truth-table variable in some BLR constraint.
-
theoremdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
theorem FABL.card_blrTruthTableVariables (n : ℕ) : Fintype.card (FABL.F₂Cube n) = 2 ^ n
theorem FABL.card_blrTruthTableVariables (n : ℕ) : Fintype.card (FABL.F₂Cube n) = 2 ^ n
The BLR CSP has one truth-table variable for each point of `𝔽₂ⁿ`.
-
theoremdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
theorem FABL.blrUniformStringTester_acceptance_eq_value {n : ℕ} (hn : 2 ≤ n) (f : FABL.F₂Cube n → FABL.𝔽₂) : (FABL.blrUniformStringTester n hn).acceptance f = (FABL.blrUniformStringTester n hn).toCSPInstance.value f
theorem FABL.blrUniformStringTester_acceptance_eq_value {n : ℕ} (hn : 2 ≤ n) (f : FABL.F₂Cube n → FABL.𝔽₂) : (FABL.blrUniformStringTester n hn).acceptance f = (FABL.blrUniformStringTester n hn).toCSPInstance.value f
The cancelled BLR tester's acceptance is exactly its Max-3-Lin instance value.
-
theoremdefined in FABL/Chapter07/CSPTesterExamples.leancomplete
theorem FABL.blrUniformStringTester_acceptance_eq_expect {n : ℕ} (hn : 2 ≤ n) (f : FABL.F₂Cube n → FABL.𝔽₂) : (FABL.blrUniformStringTester n hn).acceptance f = Finset.univ.expect fun x => Finset.univ.expect fun y => if FABL.blrAccepts f x y then 1 else 0
theorem FABL.blrUniformStringTester_acceptance_eq_expect {n : ℕ} (hn : 2 ≤ n) (f : FABL.F₂Cube n → FABL.𝔽₂) : (FABL.blrUniformStringTester n hn).acceptance f = Finset.univ.expect fun x => Finset.univ.expect fun y => if FABL.blrAccepts f x y then 1 else 0
The finite uniform acceptance integrand of the CSP is the named BLR acceptance predicate.
-
FABL.PolytimeMap[complete] -
FABL.PolytimeMap.id[complete] -
FABL.PolytimeMap.comp[complete] -
FABL.KarpReducible[complete] -
FABL.KarpReducible.refl[complete] -
FABL.KarpReducible.trans[complete]
Circuit-Sat is the decision problem which, given a finite encoding of a
Boolean circuit C, asks whether there is an input w satisfying
C(w)=1. A problem is NP-hard in this chapter when Circuit-Sat admits a
polynomial-time many-one reduction to it; ordinary computable many-one
reducibility is not sufficient.
Lean code for Definition7.3.11●6 declarations
Associated Lean declarations
-
FABL.PolytimeMap[complete]
-
FABL.PolytimeMap.id[complete]
-
FABL.PolytimeMap.comp[complete]
-
FABL.KarpReducible[complete]
-
FABL.KarpReducible.refl[complete]
-
FABL.KarpReducible.trans[complete]
-
FABL.PolytimeMap[complete] -
FABL.PolytimeMap.id[complete] -
FABL.PolytimeMap.comp[complete] -
FABL.KarpReducible[complete] -
FABL.KarpReducible.refl[complete] -
FABL.KarpReducible.trans[complete]
-
structuredefined in FABL/Chapter07/Complexity.leancomplete
structure FABL.PolytimeMap : Type 1
structure FABL.PolytimeMap : Type 1
A total binary-string map accompanied by a CSLib single-tape polynomial-time computation.
Fields
toFun : List Bool → List Bool
Extensional function computed by the machine.
computation : Cslib.Turing.SingleTapeTM.PolyTimeComputable self.toFun
CSLib computation and polynomial runtime certificate.
-
defdefined in FABL/Chapter07/Complexity.leancomplete
def FABL.PolytimeMap.id : FABL.PolytimeMap
def FABL.PolytimeMap.id : FABL.PolytimeMap
The identity binary-string map.
-
defdefined in FABL/Chapter07/Complexity.leancomplete
def FABL.PolytimeMap.comp (g f : FABL.PolytimeMap) : FABL.PolytimeMap
def FABL.PolytimeMap.comp (g f : FABL.PolytimeMap) : FABL.PolytimeMap
Composition of polynomial-time binary-string maps, using CSLib's machine composition after replacing the second runtime bound by its monotone polynomial majorant.
-
defdefined in FABL/Chapter07/Complexity.leancomplete
def FABL.KarpReducible (source target : Language Bool) : Prop
def FABL.KarpReducible (source target : Language Bool) : Prop
Polynomial-time many-one (Karp) reducibility between binary languages.
-
theoremdefined in FABL/Chapter07/Complexity.leancomplete
theorem FABL.KarpReducible.refl (language : Language Bool) : language ≤ₖ language
theorem FABL.KarpReducible.refl (language : Language Bool) : language ≤ₖ language
Karp reducibility is reflexive.
-
theoremdefined in FABL/Chapter07/Complexity.leancomplete
theorem FABL.KarpReducible.trans {first second third : Language Bool} (h₁₂ : first ≤ₖ second) (h₂₃ : second ≤ₖ third) : first ≤ₖ third
theorem FABL.KarpReducible.trans {first second third : Language Bool} (h₁₂ : first ≤ₖ second) (h₂₃ : second ≤ₖ third) : first ≤ₖ third
Karp reductions compose.
Theorem 7.30. Computing a maximum cut in a finite graph is NP-hard.
The reduction is quoted rather than proved in the book and supplies no assumption to the production library.
-
FABL.PolytimeMap.IsThresholdApproximation[complete] -
FABL.PolytimeMap.IsThresholdApproximation.weaken[complete] -
FABL.PolytimeMap.IsThresholdApproximation.value_le_optimum[complete] -
FABL.BinaryPromiseProblem[complete] -
FABL.PromiseKarpReducible[complete] -
FABL.PromiseKarpReducible.refl[complete] -
FABL.PromiseKarpReducible.trans[complete] -
FABL.PolytimeMap.DistinguishesPromise[complete] -
FABL.HasPolytimeDistinguisher[complete] -
FABL.PromiseKarpReducible.hasPolytimeDistinguisher[complete] -
FABL.PolytimeMap.ValueThresholdTest[complete] -
FABL.EncodedMaximizationProblem.gapPromise[complete] -
FABL.EncodedMaximizationProblem.gapPromiseReal[complete] -
FABL.EncodedMaximizationProblem.gapPromiseReal_reducible_of_thresholds[complete]
Definition 7.31. For 0\le\alpha\le\beta\le1, an algorithm A is an
(\alpha,\beta)-approximation for Max-CSP(\Psi) when every input
instance satisfying
\operatorname{Opt}(P)\ge\beta is mapped to an assignment of value at
least \alpha. For a randomized algorithm, the expected value of the
output assignment must be at least \alpha.
Encoded objectives are rational, while the analytic constants used by the
long-code reduction may be arbitrary real numbers. The formal promise
boundary therefore compares the rational optimum after coercion to real
thresholds; it does not require those thresholds to be rational.
The associated IsThresholdApproximation is deterministic; the book's
randomized expected-output variant still requires an explicit randomized
machine semantics and is not inferred from PolytimeMap.
Lean code for Definition7.3.13●14 declarations
Associated Lean declarations
-
FABL.PolytimeMap.IsThresholdApproximation[complete]
-
FABL.PolytimeMap.IsThresholdApproximation.weaken[complete]
-
FABL.PolytimeMap.IsThresholdApproximation.value_le_optimum[complete]
-
FABL.BinaryPromiseProblem[complete]
-
FABL.PromiseKarpReducible[complete]
-
FABL.PromiseKarpReducible.refl[complete]
-
FABL.PromiseKarpReducible.trans[complete]
-
FABL.PolytimeMap.DistinguishesPromise[complete]
-
FABL.HasPolytimeDistinguisher[complete]
-
FABL.PromiseKarpReducible.hasPolytimeDistinguisher[complete]
-
FABL.PolytimeMap.ValueThresholdTest[complete]
-
FABL.EncodedMaximizationProblem.gapPromise[complete]
-
FABL.EncodedMaximizationProblem.gapPromiseReal[complete]
-
FABL.EncodedMaximizationProblem.gapPromiseReal_reducible_of_thresholds[complete]
-
FABL.PolytimeMap.IsThresholdApproximation[complete] -
FABL.PolytimeMap.IsThresholdApproximation.weaken[complete] -
FABL.PolytimeMap.IsThresholdApproximation.value_le_optimum[complete] -
FABL.BinaryPromiseProblem[complete] -
FABL.PromiseKarpReducible[complete] -
FABL.PromiseKarpReducible.refl[complete] -
FABL.PromiseKarpReducible.trans[complete] -
FABL.PolytimeMap.DistinguishesPromise[complete] -
FABL.HasPolytimeDistinguisher[complete] -
FABL.PromiseKarpReducible.hasPolytimeDistinguisher[complete] -
FABL.PolytimeMap.ValueThresholdTest[complete] -
FABL.EncodedMaximizationProblem.gapPromise[complete] -
FABL.EncodedMaximizationProblem.gapPromiseReal[complete] -
FABL.EncodedMaximizationProblem.gapPromiseReal_reducible_of_thresholds[complete]
-
defdefined in FABL/Chapter07/Complexity.leancomplete
def FABL.PolytimeMap.IsThresholdApproximation (algorithm : FABL.PolytimeMap) (problem : FABL.EncodedMaximizationProblem) (outputThreshold optimumThreshold : ℚ) : Prop
def FABL.PolytimeMap.IsThresholdApproximation (algorithm : FABL.PolytimeMap) (problem : FABL.EncodedMaximizationProblem) (outputThreshold optimumThreshold : ℚ) : Prop
An `(outputThreshold, optimumThreshold)` threshold approximation: on each valid instance it returns a feasible solution, and whenever the optimum reaches `optimumThreshold`, its output value reaches `outputThreshold`.
-
theoremdefined in FABL/Chapter07/Complexity.leancomplete
theorem FABL.PolytimeMap.IsThresholdApproximation.weaken {algorithm : FABL.PolytimeMap} {problem : FABL.EncodedMaximizationProblem} {outputThreshold optimumThreshold weakerOutput weakerOptimum : ℚ} (h : algorithm.IsThresholdApproximation problem outputThreshold optimumThreshold) (hOutput : weakerOutput ≤ outputThreshold) (hOptimum : optimumThreshold ≤ weakerOptimum) : algorithm.IsThresholdApproximation problem weakerOutput weakerOptimum
theorem FABL.PolytimeMap.IsThresholdApproximation.weaken {algorithm : FABL.PolytimeMap} {problem : FABL.EncodedMaximizationProblem} {outputThreshold optimumThreshold weakerOutput weakerOptimum : ℚ} (h : algorithm.IsThresholdApproximation problem outputThreshold optimumThreshold) (hOutput : weakerOutput ≤ outputThreshold) (hOptimum : optimumThreshold ≤ weakerOptimum) : algorithm.IsThresholdApproximation problem weakerOutput weakerOptimum
Threshold guarantees weaken monotonically in the output threshold and antitonically in the triggering optimum threshold.
-
theoremdefined in FABL/Chapter07/Complexity.leancomplete
theorem FABL.PolytimeMap.IsThresholdApproximation.value_le_optimum {algorithm : FABL.PolytimeMap} {problem : FABL.EncodedMaximizationProblem} {outputThreshold optimumThreshold : ℚ} (h : algorithm.IsThresholdApproximation problem outputThreshold optimumThreshold) {input : List Bool} (hinput : input ∈ problem.instances) : problem.value input (algorithm.toFun input) ≤ problem.optimum input
theorem FABL.PolytimeMap.IsThresholdApproximation.value_le_optimum {algorithm : FABL.PolytimeMap} {problem : FABL.EncodedMaximizationProblem} {outputThreshold optimumThreshold : ℚ} (h : algorithm.IsThresholdApproximation problem outputThreshold optimumThreshold) {input : List Bool} (hinput : input ∈ problem.instances) : problem.value input (algorithm.toFun input) ≤ problem.optimum input
The value returned by a threshold approximation is bounded by the problem optimum.
-
structuredefined in FABL/Chapter07/Complexity.leancomplete
structure FABL.BinaryPromiseProblem : Type
structure FABL.BinaryPromiseProblem : Type
A binary promise problem with disjoint yes- and no-instance languages.
Fields
yesInstances : Language Bool
Inputs on which the promised answer is yes.
noInstances : Language Bool
Inputs on which the promised answer is no.
disjoint : Disjoint self.yesInstances self.noInstances
No input carries both promised answers.
-
defdefined in FABL/Chapter07/Complexity.leancomplete
def FABL.PromiseKarpReducible (source target : FABL.BinaryPromiseProblem) : Prop
def FABL.PromiseKarpReducible (source target : FABL.BinaryPromiseProblem) : Prop
Polynomial-time many-one reducibility between binary promise problems. The reduction must preserve both sides of the promise; behavior outside the source promise is unrestricted.
-
theoremdefined in FABL/Chapter07/Complexity.leancomplete
theorem FABL.PromiseKarpReducible.refl (problem : FABL.BinaryPromiseProblem) : FABL.PromiseKarpReducible problem problem
theorem FABL.PromiseKarpReducible.refl (problem : FABL.BinaryPromiseProblem) : FABL.PromiseKarpReducible problem problem
Promise Karp reducibility is reflexive.
-
theoremdefined in FABL/Chapter07/Complexity.leancomplete
theorem FABL.PromiseKarpReducible.trans {first second third : FABL.BinaryPromiseProblem} (h₁₂ : FABL.PromiseKarpReducible first second) (h₂₃ : FABL.PromiseKarpReducible second third) : FABL.PromiseKarpReducible first third
theorem FABL.PromiseKarpReducible.trans {first second third : FABL.BinaryPromiseProblem} (h₁₂ : FABL.PromiseKarpReducible first second) (h₂₃ : FABL.PromiseKarpReducible second third) : FABL.PromiseKarpReducible first third
Promise Karp reductions compose.
-
defdefined in FABL/Chapter07/Complexity.leancomplete
def FABL.PolytimeMap.DistinguishesPromise (decision : FABL.PolytimeMap) (problem : FABL.BinaryPromiseProblem) : Prop
def FABL.PolytimeMap.DistinguishesPromise (decision : FABL.PolytimeMap) (problem : FABL.BinaryPromiseProblem) : Prop
A polynomial-time one-bit decision map distinguishes a promise problem when it returns `[true]` on every yes-instance and `[false]` on every no-instance.
-
defdefined in FABL/Chapter07/Complexity.leancomplete
def FABL.HasPolytimeDistinguisher (problem : FABL.BinaryPromiseProblem) : Prop
def FABL.HasPolytimeDistinguisher (problem : FABL.BinaryPromiseProblem) : Prop
Existence of a polynomial-time distinguisher for a binary promise problem.
-
theoremdefined in FABL/Chapter07/Complexity.leancomplete
theorem FABL.PromiseKarpReducible.hasPolytimeDistinguisher {source target : FABL.BinaryPromiseProblem} (hreduction : FABL.PromiseKarpReducible source target) (hdistinguisher : FABL.HasPolytimeDistinguisher target) : FABL.HasPolytimeDistinguisher source
theorem FABL.PromiseKarpReducible.hasPolytimeDistinguisher {source target : FABL.BinaryPromiseProblem} (hreduction : FABL.PromiseKarpReducible source target) (hdistinguisher : FABL.HasPolytimeDistinguisher target) : FABL.HasPolytimeDistinguisher source
A promise Karp reduction transports a polynomial-time distinguisher back to its source.
-
structuredefined in FABL/Chapter07/Complexity.leancomplete
structure FABL.PolytimeMap.ValueThresholdTest (algorithm : FABL.PolytimeMap) (problem : FABL.EncodedMaximizationProblem) (threshold : ℚ) : Type 1
structure FABL.PolytimeMap.ValueThresholdTest (algorithm : FABL.PolytimeMap) (problem : FABL.EncodedMaximizationProblem) (threshold : ℚ) : Type 1
A supplied polynomial-time implementation of thresholding an approximation algorithm's semantic output value. This interface is necessary because a bare rational-valued objective need not itself be computable.
Fields
decision : FABL.PolytimeMap
Polynomial-time one-bit test.
decision_eq : ∀ (input : List Bool), self.decision.toFun input = [decide (threshold ≤ problem.value input (algorithm.toFun input))]
Exact threshold semantics.
-
defdefined in FABL/Chapter07/Complexity.leancomplete
def FABL.EncodedMaximizationProblem.gapPromise (problem : FABL.EncodedMaximizationProblem) (soundness completeness : ℚ) (hgap : soundness < completeness) : FABL.BinaryPromiseProblem
def FABL.EncodedMaximizationProblem.gapPromise (problem : FABL.EncodedMaximizationProblem) (soundness completeness : ℚ) (hgap : soundness < completeness) : FABL.BinaryPromiseProblem
The promise problem of distinguishing optimum at least `completeness` from optimum at most `soundness`. The strict gap makes the two promise sides disjoint.
-
defdefined in FABL/Chapter07/Complexity.leancomplete
def FABL.EncodedMaximizationProblem.gapPromiseReal (problem : FABL.EncodedMaximizationProblem) (soundness completeness : ℝ) (hgap : soundness < completeness) : FABL.BinaryPromiseProblem
def FABL.EncodedMaximizationProblem.gapPromiseReal (problem : FABL.EncodedMaximizationProblem) (soundness completeness : ℝ) (hgap : soundness < completeness) : FABL.BinaryPromiseProblem
The same maximization gap with real thresholds, comparing them to the real coercion of the rational encoded optimum. This is the faithful boundary for analytic reductions whose constants need not be rational.
-
theoremdefined in FABL/Chapter07/Complexity.leancomplete
theorem FABL.EncodedMaximizationProblem.gapPromiseReal_reducible_of_thresholds (problem : FABL.EncodedMaximizationProblem) {soundness completeness weakerSoundness weakerCompleteness : ℝ} (hgap : soundness < completeness) (hweakerGap : weakerSoundness < weakerCompleteness) (hsoundness : soundness ≤ weakerSoundness) (hcompleteness : weakerCompleteness ≤ completeness) : FABL.PromiseKarpReducible (problem.gapPromiseReal soundness completeness hgap) (problem.gapPromiseReal weakerSoundness weakerCompleteness hweakerGap)
theorem FABL.EncodedMaximizationProblem.gapPromiseReal_reducible_of_thresholds (problem : FABL.EncodedMaximizationProblem) {soundness completeness weakerSoundness weakerCompleteness : ℝ} (hgap : soundness < completeness) (hweakerGap : weakerSoundness < weakerCompleteness) (hsoundness : soundness ≤ weakerSoundness) (hcompleteness : weakerCompleteness ≤ completeness) : FABL.PromiseKarpReducible (problem.gapPromiseReal soundness completeness hgap) (problem.gapPromiseReal weakerSoundness weakerCompleteness hweakerGap)
The identity machine weakens a real-valued encoded maximization gap by raising its soundness threshold or lowering its completeness threshold.
-
FABL.e3LinConstantAssignment[complete] -
FABL.satisfiedIndicator_e3LinConstantAssignment[complete] -
FABL.satisfiedIndicator_zero_add_one_e3Lin[complete] -
FABL.satisfiedCount_zero_add_one_e3Lin[complete] -
FABL.exists_constantAssignment_value_ge_half_e3Lin[complete] -
FABL.betterE3LinConstantLabel[complete] -
FABL.betterE3LinConstantAssignment[complete] -
FABL.betterE3LinConstantAssignment_value_ge_half[complete] -
FABL.half_le_optimum_maxE3Lin[complete] -
FABL.MaxLinearPredicate[complete] -
FABL.maxLinearTemplate[complete] -
FABL.CSPConstraint.toF₂LinearEquation[complete] -
FABL.CSPConstraint.eval_toF₂LinearEquation[complete] -
FABL.CSPConstraint.isSatisfied_toF₂LinearEquation_iff[complete] -
FABL.CSPInstance.linearRows[complete] -
FABL.CSPInstance.satisfiesRows_linearRows_iff[complete] -
FABL.CSPInstance.gaussianAssignment[complete] -
FABL.CSPInstance.gaussianAssignment_fullySatisfied_of_satisfiable[complete] -
FABL.CSPInstance.gaussianAssignment_value_eq_one_of_satisfiable[complete] -
FABL.CSPInstance.gaussianEliminationWork[complete] -
FABL.CSPInstance.gaussianEliminationWork_le[complete]
Example 7.32. For Max-E3-Lin, output the better of the two constant
assignments F\equiv0 and F\equiv1. Every equation is satisfied by
exactly one of these assignments, so the better one has value at least
1/2; this is a (1/2,\beta)-approximation for every \beta.
Gaussian elimination gives a (1,1)-approximation for Max-r-Lin.
The associated declarations verify the exact finite comparison of the two constant assignments.
For general Max-r-Lin they transport every scoped constraint to Chapter 6's executable
\mathbb F_2 row representation, reuse its forward elimination and back substitution, and prove
both the returned assignment's correctness and the cubic charged-operation bound. Turning this
finite algorithm into a CSLib machine remains explicitly conditional on a chosen binary encoding;
no encoding-independent polynomial-time claim is manufactured.
Lean code for Lemma7.3.14●21 declarations
Associated Lean declarations
-
FABL.e3LinConstantAssignment[complete]
-
FABL.satisfiedIndicator_e3LinConstantAssignment[complete]
-
FABL.satisfiedIndicator_zero_add_one_e3Lin[complete]
-
FABL.satisfiedCount_zero_add_one_e3Lin[complete]
-
FABL.exists_constantAssignment_value_ge_half_e3Lin[complete]
-
FABL.betterE3LinConstantLabel[complete]
-
FABL.betterE3LinConstantAssignment[complete]
-
FABL.betterE3LinConstantAssignment_value_ge_half[complete]
-
FABL.half_le_optimum_maxE3Lin[complete]
-
FABL.MaxLinearPredicate[complete]
-
FABL.maxLinearTemplate[complete]
-
FABL.CSPConstraint.toF₂LinearEquation[complete]
-
FABL.CSPConstraint.eval_toF₂LinearEquation[complete]
-
FABL.CSPConstraint.isSatisfied_toF₂LinearEquation_iff[complete]
-
FABL.CSPInstance.linearRows[complete]
-
FABL.CSPInstance.satisfiesRows_linearRows_iff[complete]
-
FABL.CSPInstance.gaussianAssignment[complete]
-
FABL.CSPInstance.gaussianAssignment_fullySatisfied_of_satisfiable[complete]
-
FABL.CSPInstance.gaussianAssignment_value_eq_one_of_satisfiable[complete]
-
FABL.CSPInstance.gaussianEliminationWork[complete]
-
FABL.CSPInstance.gaussianEliminationWork_le[complete]
-
FABL.e3LinConstantAssignment[complete] -
FABL.satisfiedIndicator_e3LinConstantAssignment[complete] -
FABL.satisfiedIndicator_zero_add_one_e3Lin[complete] -
FABL.satisfiedCount_zero_add_one_e3Lin[complete] -
FABL.exists_constantAssignment_value_ge_half_e3Lin[complete] -
FABL.betterE3LinConstantLabel[complete] -
FABL.betterE3LinConstantAssignment[complete] -
FABL.betterE3LinConstantAssignment_value_ge_half[complete] -
FABL.half_le_optimum_maxE3Lin[complete] -
FABL.MaxLinearPredicate[complete] -
FABL.maxLinearTemplate[complete] -
FABL.CSPConstraint.toF₂LinearEquation[complete] -
FABL.CSPConstraint.eval_toF₂LinearEquation[complete] -
FABL.CSPConstraint.isSatisfied_toF₂LinearEquation_iff[complete] -
FABL.CSPInstance.linearRows[complete] -
FABL.CSPInstance.satisfiesRows_linearRows_iff[complete] -
FABL.CSPInstance.gaussianAssignment[complete] -
FABL.CSPInstance.gaussianAssignment_fullySatisfied_of_satisfiable[complete] -
FABL.CSPInstance.gaussianAssignment_value_eq_one_of_satisfiable[complete] -
FABL.CSPInstance.gaussianEliminationWork[complete] -
FABL.CSPInstance.gaussianEliminationWork_le[complete]
-
defdefined in FABL/Chapter07/CSPExamples.leancomplete
def FABL.e3LinConstantAssignment.{u} {V : Type u} (b : FABL.𝔽₂) : V → FABL.𝔽₂
def FABL.e3LinConstantAssignment.{u} {V : Type u} (b : FABL.𝔽₂) : V → FABL.𝔽₂
The constant assignment with label `b`.
-
theoremdefined in FABL/Chapter07/CSPExamples.leancomplete
theorem FABL.satisfiedIndicator_e3LinConstantAssignment.{u} {V : Type u} (c : FABL.CSPConstraint FABL.maxE3LinTemplate V) (b : FABL.𝔽₂) : c.satisfiedIndicator (FABL.e3LinConstantAssignment b) = if c.predicate = b then 1 else 0
theorem FABL.satisfiedIndicator_e3LinConstantAssignment.{u} {V : Type u} (c : FABL.CSPConstraint FABL.maxE3LinTemplate V) (b : FABL.𝔽₂) : c.satisfiedIndicator (FABL.e3LinConstantAssignment b) = if c.predicate = b then 1 else 0
A constant Max-E3-Lin assignment satisfies exactly the constraints whose right-hand side is that constant.
-
theoremdefined in FABL/Chapter07/CSPExamples.leancomplete
theorem FABL.satisfiedIndicator_zero_add_one_e3Lin.{u} {V : Type u} (c : FABL.CSPConstraint FABL.maxE3LinTemplate V) : c.satisfiedIndicator (FABL.e3LinConstantAssignment 0) + c.satisfiedIndicator (FABL.e3LinConstantAssignment 1) = 1
theorem FABL.satisfiedIndicator_zero_add_one_e3Lin.{u} {V : Type u} (c : FABL.CSPConstraint FABL.maxE3LinTemplate V) : c.satisfiedIndicator (FABL.e3LinConstantAssignment 0) + c.satisfiedIndicator (FABL.e3LinConstantAssignment 1) = 1
For every three-variable linear equation, exactly one of the all-zero and all-one assignments satisfies it.
-
theoremdefined in FABL/Chapter07/CSPExamples.leancomplete
theorem FABL.satisfiedCount_zero_add_one_e3Lin.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : P.satisfiedCount (FABL.e3LinConstantAssignment 0) + P.satisfiedCount (FABL.e3LinConstantAssignment 1) = P.constraints.card
theorem FABL.satisfiedCount_zero_add_one_e3Lin.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : P.satisfiedCount (FABL.e3LinConstantAssignment 0) + P.satisfiedCount (FABL.e3LinConstantAssignment 1) = P.constraints.card
Across an instance, the satisfaction counts of the all-zero and all-one assignments sum to the number of constraints.
-
theoremdefined in FABL/Chapter07/CSPExamples.leancomplete
theorem FABL.exists_constantAssignment_value_ge_half_e3Lin.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : ∃ b, 1 / 2 ≤ P.value (FABL.e3LinConstantAssignment b)
theorem FABL.exists_constantAssignment_value_ge_half_e3Lin.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : ∃ b, 1 / 2 ≤ P.value (FABL.e3LinConstantAssignment b)
One of the two constant assignments has value at least one half.
-
defdefined in FABL/Chapter07/CSPExamples.leancomplete
def FABL.betterE3LinConstantLabel.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : FABL.𝔽₂
def FABL.betterE3LinConstantLabel.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : FABL.𝔽₂
Label of the better of the all-zero and all-one assignments.
-
defdefined in FABL/Chapter07/CSPExamples.leancomplete
def FABL.betterE3LinConstantAssignment.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : V → FABL.𝔽₂
def FABL.betterE3LinConstantAssignment.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : V → FABL.𝔽₂
The constant assignment selected by comparing the two objective values.
-
theoremdefined in FABL/Chapter07/CSPExamples.leancomplete
theorem FABL.betterE3LinConstantAssignment_value_ge_half.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : 1 / 2 ≤ P.value (FABL.betterE3LinConstantAssignment P)
theorem FABL.betterE3LinConstantAssignment_value_ge_half.{u} {V : Type u} (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : 1 / 2 ≤ P.value (FABL.betterE3LinConstantAssignment P)
The explicit better-constant assignment attains value at least one half.
-
theoremdefined in FABL/Chapter07/CSPExamples.leancomplete
theorem FABL.half_le_optimum_maxE3Lin.{u} {V : Type u} [Finite V] (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : 1 / 2 ≤ P.optimum
theorem FABL.half_le_optimum_maxE3Lin.{u} {V : Type u} [Finite V] (P : FABL.CSPInstance FABL.maxE3LinTemplate V) : 1 / 2 ≤ P.optimum
Example 7.32: every Max-E3-Lin instance has optimum at least one half, witnessed by an all-zero or all-one assignment.
-
structuredefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
structure FABL.MaxLinearPredicate (r : ℕ) : Type
structure FABL.MaxLinearPredicate (r : ℕ) : Type
A positive arity at most `r`, together with the right-hand side of a binary linear equation.
Fields
arityIndex : Fin (r + 1)
Arity, represented as a natural strictly below `r + 1`.
arity_pos : 0 < self.arityIndex
Linear constraints contain at least one variable.
rhs : FABL.𝔽₂
Right-hand side of the equation.
-
defdefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
def FABL.maxLinearTemplate (r : ℕ) : FABL.CSPTemplate FABL.𝔽₂
def FABL.maxLinearTemplate (r : ℕ) : FABL.CSPTemplate FABL.𝔽₂
The finite family of all positive-arity binary linear equations using at most `r` distinct variables.
-
defdefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
def FABL.CSPConstraint.toF₂LinearEquation.{u} {r : ℕ} {V : Type u} [DecidableEq V] (constraint : FABL.CSPConstraint (FABL.maxLinearTemplate r) V) : FABL.F₂LinearEquation V
def FABL.CSPConstraint.toF₂LinearEquation.{u} {r : ℕ} {V : Type u} [DecidableEq V] (constraint : FABL.CSPConstraint (FABL.maxLinearTemplate r) V) : FABL.F₂LinearEquation V
Global linear equation obtained from a scoped Max-`r`-Lin constraint.
-
theoremdefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
theorem FABL.CSPConstraint.eval_toF₂LinearEquation.{u} {r : ℕ} {V : Type u} [Fintype V] [DecidableEq V] (constraint : FABL.CSPConstraint (FABL.maxLinearTemplate r) V) (assignment : V → FABL.𝔽₂) : constraint.toF₂LinearEquation.eval assignment = ∑ i, assignment (constraint.scope i)
theorem FABL.CSPConstraint.eval_toF₂LinearEquation.{u} {r : ℕ} {V : Type u} [Fintype V] [DecidableEq V] (constraint : FABL.CSPConstraint (FABL.maxLinearTemplate r) V) (assignment : V → FABL.𝔽₂) : constraint.toF₂LinearEquation.eval assignment = ∑ i, assignment (constraint.scope i)
The global equation evaluates to the sum of the assignment on the constraint scope.
-
theoremdefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
theorem FABL.CSPConstraint.isSatisfied_toF₂LinearEquation_iff.{u} {r : ℕ} {V : Type u} [Fintype V] [DecidableEq V] (constraint : FABL.CSPConstraint (FABL.maxLinearTemplate r) V) (assignment : V → FABL.𝔽₂) : constraint.toF₂LinearEquation.IsSatisfied assignment ↔ constraint.Satisfied assignment
theorem FABL.CSPConstraint.isSatisfied_toF₂LinearEquation_iff.{u} {r : ℕ} {V : Type u} [Fintype V] [DecidableEq V] (constraint : FABL.CSPConstraint (FABL.maxLinearTemplate r) V) (assignment : V → FABL.𝔽₂) : constraint.toF₂LinearEquation.IsSatisfied assignment ↔ constraint.Satisfied assignment
Satisfaction of the transported equation is exactly satisfaction of the original CSP constraint.
-
defdefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
def FABL.CSPInstance.linearRows {r : ℕ} {V : Type} [DecidableEq V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) : List (FABL.F₂LinearEquation V)
def FABL.CSPInstance.linearRows {r : ℕ} {V : Type} [DecidableEq V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) : List (FABL.F₂LinearEquation V)
Row list supplied to Chapter 6's executable Gaussian solver.
-
theoremdefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
theorem FABL.CSPInstance.satisfiesRows_linearRows_iff {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) (assignment : V → FABL.𝔽₂) : FABL.F₂SatisfiesRows problem.linearRows assignment ↔ problem.FullySatisfied assignment
theorem FABL.CSPInstance.satisfiesRows_linearRows_iff {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) (assignment : V → FABL.𝔽₂) : FABL.F₂SatisfiesRows problem.linearRows assignment ↔ problem.FullySatisfied assignment
Simultaneous satisfaction of the transported rows is exactly full satisfaction of the CSP instance.
-
defdefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
def FABL.CSPInstance.gaussianAssignment {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] [Encodable V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) : V → FABL.𝔽₂
def FABL.CSPInstance.gaussianAssignment {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] [Encodable V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) : V → FABL.𝔽₂
Assignment returned by the established Chapter 6 Gaussian solver.
-
theoremdefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
theorem FABL.CSPInstance.gaussianAssignment_fullySatisfied_of_satisfiable {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] [Encodable V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) (hproblem : problem.Satisfiable) : problem.FullySatisfied problem.gaussianAssignment
theorem FABL.CSPInstance.gaussianAssignment_fullySatisfied_of_satisfiable {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] [Encodable V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) (hproblem : problem.Satisfiable) : problem.FullySatisfied problem.gaussianAssignment
Gaussian elimination fully satisfies every satisfiable Max-`r`-Lin instance.
-
theoremdefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
theorem FABL.CSPInstance.gaussianAssignment_value_eq_one_of_satisfiable {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] [Encodable V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) (hproblem : problem.Satisfiable) : problem.value problem.gaussianAssignment = 1
theorem FABL.CSPInstance.gaussianAssignment_value_eq_one_of_satisfiable {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] [Encodable V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) (hproblem : problem.Satisfiable) : problem.value problem.gaussianAssignment = 1
Example 7.32: Gaussian elimination is a `(1,1)` Max-`r`-Lin approximation in the exact finite semantic sense.
-
defdefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
def FABL.CSPInstance.gaussianEliminationWork {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] [Encodable V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) : ℕ
def FABL.CSPInstance.gaussianEliminationWork {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] [Encodable V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) : ℕ
Charged work for dense row construction followed by the same forward elimination and back substitution executed by the canonical Chapter 6 solver backend.
-
theoremdefined in FABL/Chapter07/LinearCSPAlgorithms.leancomplete
theorem FABL.CSPInstance.gaussianEliminationWork_le {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] [Encodable V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) : problem.gaussianEliminationWork ≤ problem.constraints.card * (Fintype.card V + 1) + Fintype.card V * problem.constraints.card * (Fintype.card V + 2) + Fintype.card V * (Fintype.card V + 1)
theorem FABL.CSPInstance.gaussianEliminationWork_le {r : ℕ} {V : Type} [Fintype V] [DecidableEq V] [Encodable V] (problem : FABL.CSPInstance (FABL.maxLinearTemplate r) V) : problem.gaussianEliminationWork ≤ problem.constraints.card * (Fintype.card V + 1) + Fintype.card V * problem.constraints.card * (Fintype.card V + 2) + Fintype.card V * (Fintype.card V + 1)
Dense row construction, forward elimination, and back substitution obey the displayed cubic charged-work bound.
For every \beta, the Goemans--Williamson semidefinite algorithm is an
efficient randomized (.878\beta,\beta)-approximation for Max-Cut.
This external approximation theorem is cited by the book and supplies no assumption to the production library.
Theorem 7.33. A (1,1)-approximation for Max-E3-Sat is NP-hard, and so
is a (1,1)-approximation for Max-3-Coloring. Exercise 7.13 supplies the
Max-E3-Sat reduction; the Max-3-Coloring reduction is external to the
chapter.
Theorem 7.34. For every fixed \beta\in(1/2,1), an
(\beta,\beta)-approximation for Max-E3-Lin is NP-hard, and so is an
(\beta,\beta)-approximation for Max-Cut.
These textbook hardness theorems are quoted without proof.
Theorem 7.35. There is a universal constant \delta_0>0 such that an
(1-\delta_0,1)-approximation for Max-E3-Sat is NP-hard.
The book sketches the implication from the external PCPP Theorem and the finite reductions in Exercises 7.12 and 7.19. Since the PCPP theorem itself is not proved here, the unconditional hardness claim remains statement-only and supplies no assumption to the production library.