treelike_cp_unsat_of_refutation
Soundness of treelike Cutting Planes refutations: if a CNF formula F over n variables has a treelike Cutting Planes refutation deriving 0 ≥ 1, then F is unsatisfiable (¬ CnfSatisfiable F).
Statement
theorem treelike_cp_unsat_of_refutation (n : ℕ) (F : List (List (CnfLit (Fin n)))) (d : TreelikeCpDerivation n F { coeffs := fun _ => 0, const := 1 }) : ¬ CnfSatisfiable F
- Formalizes
- arXiv:2611.24548 Def 4.1
- Verified
- 20 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 8
- TreelikeCpDerivationInductive type family of treelike Cutting Planes (CP) derivations of a linear inequality from a CNF formula F over n variables (given as a…
- CnfSatisfiableA CNF formula (a list of clauses, each a list of literals) is satisfiable if there is a truth assignment such that every clause contains…
- LinIneqA linear inequality c^T x ≥ d over n Boolean variables, with integer coefficient vector c : Fin n → ℤ and integer constant term d : ℤ.
- CnfLitA CNF literal over a variable type V is either a positive variable or a negated variable.
- cnf_clause_to_linThe linear inequality embedding of a CNF clause C over n variables, asserting ∑_{l ∈ C} [l] ≥ 1 where [x_i] = x_i and [~x_i] = 1 - x_i.
- TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or… - cnf_lit_decidable_eqDecidable equality on CNF literals, derived from decidable equality on the underlying variables.
- LinearOrder.toTotalPreorderEvery
LinearOrderis aTotalPreorder.
Read back from the Lean
For every natural number $n$, every CNF formula $F$ (given as a list of clauses, where each clause is a list of literals over $\mathrm{Fin}\ n$), and every tree-like Cutting Planes derivation $d$ from $F$ of the refutation inequality (the linear inequality with all coefficients $0$ and constant $1$, representing $0 \ge 1$), the formula $F$ is unsatisfiable (no truth assignment satisfies every clause of $F$).
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
The proof, explained
Soundness of treelike Cutting Planes refutations is proved by showing that every linear inequality derived from a CNF formula F holds under any truth assignment satisfying F. By structural induction on the derivation tree, the axioms (trivial 0 ≤ 0, variable box bounds 0 ≤ x_i ≤ 1, and clause translations) are satisfied, and the inference rules (non-negative linear combinations and integer division) preserve satisfaction. Since a refutation derives the contradiction 0 ≥ 1 (encoded as 1 ≤ 0), no satisfying assignment can exist, so F is unsatisfiable.
The linear expression for a clause can be rewritten as the sum of variable literal terms minus 1
By splitting sums of differences and sums of additions, and expanding the terms for positive and negative literals, algebraic rearrangement shows that ∑ (pos j - neg j) * x j - (1 - ∑ neg j) equals ∑ (pos j * x j + neg j * (1 - x j)) - 1.
uses
sum_congr,sum_sub_distrib,sum_add_distribhave h1 : (∑ j : Fin n, (pos j - neg j) * x j) = (∑ j : Fin n, (pos j * x j - neg j * x j)) := by apply sum_congr rfl intro j _ ring rw [h1, sum_sub_distrib] have h2 : (∑ j : Fin n, (pos j * x j + neg j * (1 - x j))) = (∑ j : Fin n, pos j * x j) + (∑ j : Fin n, (neg j * (1 - x j))) := by rw [sum_add_distrib] rw [h2] have h3 : (∑ j : Fin n, neg j * (1 - x j)) = (∑ j : Fin n, (neg j - neg j * x j)) := by apply sum_congr rfl intro j _ ring rw [h3, sum_sub_distrib] ring
Each variable's literal contribution to a clause is non-negative
Under any Boolean truth assignment, the linear translation of each variable takes values in {0, 1}, so both x j ≥ 0 and 1 - x j ≥ 0. Since the literal indicator coefficients are 0 or 1 (hence non-negative), each product and their sum are non-negative.
have h1 : 0 ≤ treelike_cp_unsat_of_refutation_bool_to_lin (τ j) := by cases τ j <;> decide have h2 : 0 ≤ 1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ j) := by cases τ j <;> decide have hpos : 0 ≤ (if CnfLit.pos j ∈ C then (1 : ℤ) else 0) := by split_ifs <;> omega have hneg : 0 ≤ (if CnfLit.neg j ∈ C then (1 : ℤ) else 0) := by split_ifs <;> omega nlinarith
A clause satisfied by a truth assignment has literal term sum at least 1
By case analysis on whether the satisfied literal l ∈ C is positive or negative for variable v: in both cases, the literal evaluates to 1 and its coefficient in C is 1, so the term for variable v is at least 1. Since all other variable terms in the clause sum are non-negative, the total sum over all variables is at least 1.
uses
if_pos,Finset.single_le_sum,Finset.mem_univ,treelike_cp_unsat_of_refutation_clause_term_nonnegcases l with | pos v => have hv_term : 1 ≤ (if CnfLit.pos v ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ v) + (if CnfLit.neg v ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ v)) := by have hpos : (if CnfLit.pos v ∈ C then (1 : ℤ) else 0) = 1 := if_pos hl have htau : treelike_cp_unsat_of_refutation_bool_to_lin (τ v) = 1 := by simp [treelike_cp_unsat_of_refutation_bool_to_lin, treelike_cp_unsat_of_refutation_lit_sat] at *; exact hsat have hneg_nonneg : 0 ≤ (if CnfLit.neg v ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ v)) := by have hneg : 0 ≤ (if CnfLit.neg v ∈ C then (1 : ℤ) else 0) := by split_ifs <;> omega have h2 : 0 ≤ 1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ v) := by cases τ v <;> decide nlinarith rw [hpos, htau] linarith have hsum := Finset.single_le_sum (f := fun j => (if CnfLit.pos j ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j) + (if CnfLit.neg j ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ j))) (fun j _ => treelike_cp_unsat_of_refutation_clause_term_nonneg C τ j) (Finset.mem_univ v) linarith | neg v => have hv_term : 1 ≤ (if CnfLit.pos v ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ v) + (if CnfLit.neg v ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ v)) := by have hneg : (if CnfLit.neg v ∈ C then (1 : ℤ) else 0) = 1 := if_pos hl have htau : 1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ v) = 1 := by have : τ v = false := hsat simp [treelike_cp_unsat_of_refutation_bool_to_lin, this] have hpos_nonneg : 0 ≤ (if CnfLit.pos v ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ v) := by have hpos : 0 ≤ (if CnfLit.pos v ∈ C then (1 : ℤ) else 0) := by split_ifs <;> omega have h1 : 0 ≤ treelike_cp_unsat_of_refutation_bool_to_lin (τ v) := by cases τ v <;> decide nlinarith rw [hneg, htau] linarith have hsum := Finset.single_le_sum (f := fun j => (if CnfLit.pos j ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j) + (if CnfLit.neg j ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ j))) (fun j _ => treelike_cp_unsat_of_refutation_clause_term_nonneg C τ j) (Finset.mem_univ v) linarith
The linear inequality translation of a satisfied clause holds under the assignment
By unfolding the linear inequality translation of the clause C and substituting the clause sum identity, the difference between the linear combination and the constant term equals the clause literal sum minus 1. Since the assignment satisfies a literal in C, this sum is at least 1, so the inequality holds.
uses
treelike_cp_unsat_of_refutation_sum_clause_identity,treelike_cp_unsat_of_refutation_clause_term_ge_onedsimp [cnf_clause_to_lin] have hid := treelike_cp_unsat_of_refutation_sum_clause_identity (fun j => if CnfLit.pos j ∈ C then 1 else 0) (fun j => if CnfLit.neg j ∈ C then 1 else 0) (fun j => treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) have hge := treelike_cp_unsat_of_refutation_clause_term_ge_one C τ l hl hsat linarith
The Cutting Planes integer division rule is sound over integers
If L_const ≤ α * c_sum with positive integer α, dividing both sides by α preserves the inequality over ℚ. Because c_sum is an integer, taking the ceiling of the left-hand side preserves the inequality: ⌈L_const / α⌉ ≤ c_sum.
uses
Int.ceil_le,div_le_iff₀rw [Int.ceil_le] have hα_pos : 0 < (α : ℚ) := by positivity rw [div_le_iff₀ hα_pos] have hineq_q : (L_const : ℚ) ≤ (c_sum : ℚ) * (α : ℚ) := by exact_mod_cast (by linarith : L_const ≤ c_sum * α) linarith
A scalar factor α factors out of a linear combination sum
Distributing the scalar α across the products and using distributivity of multiplication over finite summation allows factoring α out of ∑ (α * c j) * x j.
uses
mul_sumhave : (fun j => (↑α * c j) * x j) = (fun j => ↑α * (c j * x j)) := by funext j ring rw [this, mul_sum]
The Cutting Planes division step preserves satisfaction under an assignment
When all coefficients of an inequality L are divisible by α > 0, the sum of coefficients times the assignment can be written as α * ∑ c j * x j. By the induction hypothesis, L_const ≤ α * ∑ c j * x j, so soundness of the integer division rule yields ⌈L_const / α⌉ ≤ ∑ c j * x j.
uses
treelike_cp_unsat_of_refutation_sum_mul_factor,treelike_cp_unsat_of_refutation_div_rule_soundhave h_sum : (∑ j : Fin n, L.coeffs j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) = ↑α * (∑ j : Fin n, c j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) := by have h_coeff : (fun j => L.coeffs j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) = (fun j => (↑α * c j) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) := by funext j rw [hdiv j] rw [h_coeff, treelike_cp_unsat_of_refutation_sum_mul_factor] have hineq : L.const ≤ ↑α * (∑ j : Fin n, c j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) := by linarith [ih, h_sum] exact treelike_cp_unsat_of_refutation_div_rule_sound L.const (∑ j : Fin n, c j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) α hα hineq
Non-negative linear combinations preserve satisfaction under an assignment
Multiplying the two valid inequalities by non-negative natural scalars lam1 and lam2 preserves their directions. Adding them and regrouping terms using linearity of summation yields the valid combined inequality.
uses
sum_add_distrib,mul_sumhave h_split : (∑ j : Fin n, (↑lam1 * L1.coeffs j + ↑lam2 * L2.coeffs j) * x j) = ↑lam1 * (∑ j : Fin n, L1.coeffs j * x j) + ↑lam2 * (∑ j : Fin n, L2.coeffs j * x j) := by have : (fun j => (↑lam1 * L1.coeffs j + ↑lam2 * L2.coeffs j) * x j) = (fun j => ↑lam1 * (L1.coeffs j * x j) + ↑lam2 * (L2.coeffs j * x j)) := by funext j; ring rw [this, sum_add_distrib, mul_sum, mul_sum] rw [h_split] have h_lam1 : 0 ≤ (lam1 : ℤ) := by positivity have h_lam2 : 0 ≤ (lam2 : ℤ) := by positivity nlinarith
Every inequality derived in a treelike Cutting Planes proof is satisfied by any model of F
By structural induction on the derivation tree: the trivial inequality 0 ≤ 0 holds; the variable bound axioms 0 ≤ x i and x i ≤ 1 hold because boolean variables embed into {0, 1}; axiom clauses from F hold because the assignment satisfies a literal in each clause; and the inductive steps for linear combinations and division rules preserve satisfaction.
uses
treelike_cp_unsat_of_refutation_clause_sound,List.mem_toFinset.mpr,treelike_cp_unsat_of_refutation_lin_comb_sound,treelike_cp_unsat_of_refutation_division_step_soundinduction d with | trivial => simp | box_lower i => have : (fun j => (if j = i then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) = (fun j => if j = i then treelike_cp_unsat_of_refutation_bool_to_lin (τ j) else 0) := by funext j split_ifs <;> ring rw [this] simp cases τ i <;> decide | box_upper i => have : (fun j => (if j = i then (-1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) = (fun j => if j = i then -treelike_cp_unsat_of_refutation_bool_to_lin (τ j) else 0) := by funext j split_ifs <;> ring rw [this] simp cases τ i <;> decide | clause C hC => obtain ⟨l, hl, hsat⟩ := hτ C hC exact treelike_cp_unsat_of_refutation_clause_sound C.toFinset τ l (List.mem_toFinset.mpr hl) hsat | lin_comb d1 d2 lam1 lam2 ih1 ih2 => exact treelike_cp_unsat_of_refutation_lin_comb_sound lam1 lam2 _ _ (fun j => treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) ih1 ih2 | division d c α hα hdiv ih => exact treelike_cp_unsat_of_refutation_division_step_sound _ c α hα hdiv τ ih
If F has a treelike Cutting Planes refutation, then F is unsatisfiable
Suppose for contradiction that F has a satisfying assignment τ. By soundness of treelike Cutting Planes derivations, the inequality derived by the refutation must be satisfied by τ. But the refutation derives 0 ≥ 1 (coeffs 0 and const 1), which evaluates under τ to 1 ≤ 0, an immediate contradiction.
uses
treelike_cp_unsat_of_refutation_soundintro ⟨τ, hτ⟩ have hτ' : ∀ c ∈ F, ∃ l ∈ c, treelike_cp_unsat_of_refutation_lit_sat τ l := by intro c hc obtain ⟨l, hl, hsat⟩ := hτ c hc exact ⟨l, hl, hsat⟩ have hsound := treelike_cp_unsat_of_refutation_sound n F τ hτ' d dsimp at hsound simp at hsound
Int.ceil_le- The ceiling of a number a is at most an integer z if and only if a is at most z.
Finset.single_le_sum- In a sum of non-negative terms over a finite set, any single term is bounded above by the total sum.
Finset.mem_univ- Every element of a finite type belongs to the universal finset.
div_le_iff₀- Dividing by a positive element preserves the inequality: b / c ≤ a if and only if b ≤ a * c.
if_pos- An if-then-else expression evaluates to the 'then' branch when the condition holds.
mul_sum- Multiplication distributes over finite summation from the left: a * ∑ i ∈ s, f i = ∑ i ∈ s, a * f i.
sum_add_distrib- The sum of sums equals the sum of the individual sums over the same finite set.
sum_congr- Two finite sums are equal if their index sets are equal and their summands agree on every element.
sum_sub_distrib- The sum of differences equals the difference of the sums over the same finite set.
List.mem_toFinset.mpr- An element belonging to a list also belongs to the finset of its elements.
treelike_cp_unsat_of_refutation_clause_term_nonneg- For any variable j and clause C, the literal term contribution to the clause sum is non-negative under any Boolean assignment.
treelike_cp_unsat_of_refutation_sum_clause_identity- The standard linear inequality expression for a clause equals the sum of literal terms minus 1.
treelike_cp_unsat_of_refutation_clause_term_ge_one- If an assignment satisfies at least one literal in a clause C, the sum of literal terms for that clause is at least 1.
treelike_cp_unsat_of_refutation_clause_sound- A clause satisfied by assignment τ yields a valid linear inequality under the linear embedding of τ.
treelike_cp_unsat_of_refutation_div_rule_sound- If L_const ≤ α * c_sum with α > 0 and c_sum an integer, then ⌈L_const / α⌉ ≤ c_sum.
treelike_cp_unsat_of_refutation_sum_mul_factor- A common positive integer scalar factor α can be factored out of a linear combination sum.
treelike_cp_unsat_of_refutation_division_step_sound- The Cutting Planes division rule produces a satisfied inequality when applied to an already satisfied inequality.
treelike_cp_unsat_of_refutation_lin_comb_sound- A non-negative linear combination of two satisfied linear inequalities is also satisfied.
treelike_cp_unsat_of_refutation_sound- Any linear inequality derived by a treelike Cutting Planes derivation from F holds under any truth assignment satisfying F.
- Linear arithmetic and ring normalization tactics (ring, linarith, nlinarith, omega, positivity) handle algebraic rearrangements, bounding, and reasoning about inequalities over ℤ and ℚ.
- The boolean values true and false are embedded into integers as 1 and 0 via treelike_cp_unsat_of_refutation_bool_to_lin.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
open Finsetdef treelike_cp_unsat_of_refutation_bool_to_lin (b : Bool) : ℤ := if b then 1 else 0def treelike_cp_unsat_of_refutation_lit_sat {V : Type*} (τ : V → Bool) (l : CnfLit V) : Prop := match l with | CnfLit.pos v => τ v = true | CnfLit.neg v => τ v = falselemma treelike_cp_unsat_of_refutation_sum_clause_identity {n : ℕ} (pos neg : Fin n → ℤ) (x : Fin n → ℤ) : (∑ j : Fin n, (pos j - neg j) * x j) - (1 - ∑ j : Fin n, neg j) = (∑ j : Fin n, (pos j * x j + neg j * (1 - x j))) - 1 := by have h1 : (∑ j : Fin n, (pos j - neg j) * x j) = (∑ j : Fin n, (pos j * x j - neg j * x j)) := by apply sum_congr rfl intro j _ ring rw [h1, sum_sub_distrib] have h2 : (∑ j : Fin n, (pos j * x j + neg j * (1 - x j))) = (∑ j : Fin n, pos j * x j) + (∑ j : Fin n, (neg j * (1 - x j))) := by rw [sum_add_distrib] rw [h2] have h3 : (∑ j : Fin n, neg j * (1 - x j)) = (∑ j : Fin n, (neg j - neg j * x j)) := by apply sum_congr rfl intro j _ ring rw [h3, sum_sub_distrib] ringlemma treelike_cp_unsat_of_refutation_clause_term_nonneg {n : ℕ} (C : Finset (CnfLit (Fin n))) (τ : Fin n → Bool) (j : Fin n) : 0 ≤ (if CnfLit.pos j ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j) + (if CnfLit.neg j ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) := by have h1 : 0 ≤ treelike_cp_unsat_of_refutation_bool_to_lin (τ j) := by cases τ j <;> decide have h2 : 0 ≤ 1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ j) := by cases τ j <;> decide have hpos : 0 ≤ (if CnfLit.pos j ∈ C then (1 : ℤ) else 0) := by split_ifs <;> omega have hneg : 0 ≤ (if CnfLit.neg j ∈ C then (1 : ℤ) else 0) := by split_ifs <;> omega nlinarithlemma treelike_cp_unsat_of_refutation_clause_term_ge_one {n : ℕ} (C : Finset (CnfLit (Fin n))) (τ : Fin n → Bool) (l : CnfLit (Fin n)) (hl : l ∈ C) (hsat : treelike_cp_unsat_of_refutation_lit_sat τ l) : 1 ≤ ∑ j : Fin n, ((if CnfLit.pos j ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j) + (if CnfLit.neg j ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ j))) := by cases l with | pos v => have hv_term : 1 ≤ (if CnfLit.pos v ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ v) + (if CnfLit.neg v ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ v)) := by have hpos : (if CnfLit.pos v ∈ C then (1 : ℤ) else 0) = 1 := if_pos hl have htau : treelike_cp_unsat_of_refutation_bool_to_lin (τ v) = 1 := by simp [treelike_cp_unsat_of_refutation_bool_to_lin, treelike_cp_unsat_of_refutation_lit_sat] at *; exact hsat have hneg_nonneg : 0 ≤ (if CnfLit.neg v ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ v)) := by have hneg : 0 ≤ (if CnfLit.neg v ∈ C then (1 : ℤ) else 0) := by split_ifs <;> omega have h2 : 0 ≤ 1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ v) := by cases τ v <;> decide nlinarith rw [hpos, htau] linarith have hsum := Finset.single_le_sum (f := fun j => (if CnfLit.pos j ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j) + (if CnfLit.neg j ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ j))) (fun j _ => treelike_cp_unsat_of_refutation_clause_term_nonneg C τ j) (Finset.mem_univ v) linarith | neg v => have hv_term : 1 ≤ (if CnfLit.pos v ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ v) + (if CnfLit.neg v ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ v)) := by have hneg : (if CnfLit.neg v ∈ C then (1 : ℤ) else 0) = 1 := if_pos hl have htau : 1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ v) = 1 := by have : τ v = false := hsat simp [treelike_cp_unsat_of_refutation_bool_to_lin, this] have hpos_nonneg : 0 ≤ (if CnfLit.pos v ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ v) := by have hpos : 0 ≤ (if CnfLit.pos v ∈ C then (1 : ℤ) else 0) := by split_ifs <;> omega have h1 : 0 ≤ treelike_cp_unsat_of_refutation_bool_to_lin (τ v) := by cases τ v <;> decide nlinarith rw [hneg, htau] linarith have hsum := Finset.single_le_sum (f := fun j => (if CnfLit.pos j ∈ C then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j) + (if CnfLit.neg j ∈ C then (1 : ℤ) else 0) * (1 - treelike_cp_unsat_of_refutation_bool_to_lin (τ j))) (fun j _ => treelike_cp_unsat_of_refutation_clause_term_nonneg C τ j) (Finset.mem_univ v) linarithlemma treelike_cp_unsat_of_refutation_clause_sound {n : ℕ} (C : Finset (CnfLit (Fin n))) (τ : Fin n → Bool) (l : CnfLit (Fin n)) (hl : l ∈ C) (hsat : treelike_cp_unsat_of_refutation_lit_sat τ l) : (cnf_clause_to_lin n C).const ≤ ∑ j : Fin n, (cnf_clause_to_lin n C).coeffs j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j) := by dsimp [cnf_clause_to_lin] have hid := treelike_cp_unsat_of_refutation_sum_clause_identity (fun j => if CnfLit.pos j ∈ C then 1 else 0) (fun j => if CnfLit.neg j ∈ C then 1 else 0) (fun j => treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) have hge := treelike_cp_unsat_of_refutation_clause_term_ge_one C τ l hl hsat linarithlemma treelike_cp_unsat_of_refutation_div_rule_sound (L_const : ℤ) (c_sum : ℤ) (α : ℕ) (hα : 0 < α) (hineq : L_const ≤ α * c_sum) : ⌈(L_const : ℚ) / (α : ℚ)⌉ ≤ c_sum := by rw [Int.ceil_le] have hα_pos : 0 < (α : ℚ) := by positivity rw [div_le_iff₀ hα_pos] have hineq_q : (L_const : ℚ) ≤ (c_sum : ℚ) * (α : ℚ) := by exact_mod_cast (by linarith : L_const ≤ c_sum * α) linarithlemma treelike_cp_unsat_of_refutation_sum_mul_factor {n : ℕ} (α : ℕ) (c : Fin n → ℤ) (x : Fin n → ℤ) : (∑ j : Fin n, (↑α * c j) * x j) = ↑α * (∑ j : Fin n, c j * x j) := by have : (fun j => (↑α * c j) * x j) = (fun j => ↑α * (c j * x j)) := by funext j ring rw [this, mul_sum]lemma treelike_cp_unsat_of_refutation_division_step_sound {n : ℕ} (L : LinIneq n) (c : Fin n → ℤ) (α : ℕ) (hα : 0 < α) (hdiv : ∀ j, L.coeffs j = ↑α * c j) (τ : Fin n → Bool) (ih : L.const ≤ ∑ j : Fin n, L.coeffs j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) : ⌈(L.const : ℚ) / (α : ℚ)⌉ ≤ ∑ j : Fin n, c j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j) := by have h_sum : (∑ j : Fin n, L.coeffs j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) = ↑α * (∑ j : Fin n, c j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) := by have h_coeff : (fun j => L.coeffs j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) = (fun j => (↑α * c j) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) := by funext j rw [hdiv j] rw [h_coeff, treelike_cp_unsat_of_refutation_sum_mul_factor] have hineq : L.const ≤ ↑α * (∑ j : Fin n, c j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) := by linarith [ih, h_sum] exact treelike_cp_unsat_of_refutation_div_rule_sound L.const (∑ j : Fin n, c j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) α hα hineqlemma treelike_cp_unsat_of_refutation_lin_comb_sound {n : ℕ} (lam1 lam2 : ℕ) (L1 L2 : LinIneq n) (x : Fin n → ℤ) (h1 : L1.const ≤ ∑ j : Fin n, L1.coeffs j * x j) (h2 : L2.const ≤ ∑ j : Fin n, L2.coeffs j * x j) : (↑lam1 * L1.const + ↑lam2 * L2.const) ≤ ∑ j : Fin n, (↑lam1 * L1.coeffs j + ↑lam2 * L2.coeffs j) * x j := by have h_split : (∑ j : Fin n, (↑lam1 * L1.coeffs j + ↑lam2 * L2.coeffs j) * x j) = ↑lam1 * (∑ j : Fin n, L1.coeffs j * x j) + ↑lam2 * (∑ j : Fin n, L2.coeffs j * x j) := by have : (fun j => (↑lam1 * L1.coeffs j + ↑lam2 * L2.coeffs j) * x j) = (fun j => ↑lam1 * (L1.coeffs j * x j) + ↑lam2 * (L2.coeffs j * x j)) := by funext j; ring rw [this, sum_add_distrib, mul_sum, mul_sum] rw [h_split] have h_lam1 : 0 ≤ (lam1 : ℤ) := by positivity have h_lam2 : 0 ≤ (lam2 : ℤ) := by positivity nlinarithlemma treelike_cp_unsat_of_refutation_sound (n : ℕ) (F : List (List (CnfLit (Fin n)))) (τ : Fin n → Bool) (hτ : ∀ c ∈ F, ∃ l ∈ c, treelike_cp_unsat_of_refutation_lit_sat τ l) {L : LinIneq n} (d : TreelikeCpDerivation n F L) : L.const ≤ ∑ j : Fin n, L.coeffs j * treelike_cp_unsat_of_refutation_bool_to_lin (τ j) := by induction d with | trivial => simp | box_lower i => have : (fun j => (if j = i then (1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) = (fun j => if j = i then treelike_cp_unsat_of_refutation_bool_to_lin (τ j) else 0) := by funext j split_ifs <;> ring rw [this] simp cases τ i <;> decide | box_upper i => have : (fun j => (if j = i then (-1 : ℤ) else 0) * treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) = (fun j => if j = i then -treelike_cp_unsat_of_refutation_bool_to_lin (τ j) else 0) := by funext j split_ifs <;> ring rw [this] simp cases τ i <;> decide | clause C hC => obtain ⟨l, hl, hsat⟩ := hτ C hC exact treelike_cp_unsat_of_refutation_clause_sound C.toFinset τ l (List.mem_toFinset.mpr hl) hsat | lin_comb d1 d2 lam1 lam2 ih1 ih2 => exact treelike_cp_unsat_of_refutation_lin_comb_sound lam1 lam2 _ _ (fun j => treelike_cp_unsat_of_refutation_bool_to_lin (τ j)) ih1 ih2 | division d c α hα hdiv ih => exact treelike_cp_unsat_of_refutation_division_step_sound _ c α hα hdiv τ ih/-- Soundness of treelike Cutting Planes refutations. -/theorem treelike_cp_unsat_of_refutation (n : ℕ) (F : List (List (CnfLit (Fin n)))) (d : TreelikeCpDerivation n F { coeffs := fun _ => 0, const := 1 }) : ¬ CnfSatisfiable F := by intro ⟨τ, hτ⟩ have hτ' : ∀ c ∈ F, ∃ l ∈ c, treelike_cp_unsat_of_refutation_lit_sat τ l := by intro c hc obtain ⟨l, hl, hsat⟩ := hτ c hc exact ⟨l, hl, hsat⟩ have hsound := treelike_cp_unsat_of_refutation_sound n F τ hτ' d dsimp at hsound simp at hsound