op_2130_path_interval_crossing_closed
If a unit edge has one endpoint in a finite integer interval and one outside, adding the outside endpoint and deleting the inside endpoint each produce another integer interval, possibly empty.
Statement
theorem op_2130_path_interval_crossing_closed (l r a b : ℤ) (ha : a ∈ Finset.Icc l r) (hb : b ∉ Finset.Icc l r) (hab : a + 1 = b ∨ b + 1 = a) : (∃ L R : ℤ, insert b (Finset.Icc l r) = Finset.Icc L R) ∧ (∃ L R : ℤ, (Finset.Icc l r).erase a = Finset.Icc L R)- Source
- OP-2130: interval specialization of the backward-witness construction of arXiv:2611.00388, Lemma 4.2
- Verified
- 22 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 2
- LinearOrder.toTotalPreorderEvery
LinearOrderis aTotalPreorder. - TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or…
- LinearOrder.toTotalPreorderEvery
The proof, explained
The proof shows that because the two adjacent integers a and b satisfy a ∈ [l, r] and b ∉ [l, r], a must be an endpoint of the interval and b the adjacent integer outside it: either (a = l, b = l - 1) or (a = r, b = r + 1). In the left-boundary case, inserting b yields the interval [l - 1, r] and erasing a yields [l + 1, r]. In the right-boundary case, inserting b yields [l, r + 1] and erasing a yields [l, r - 1]. In both cases, set extensionality and Presburger linear arithmetic verify the set equalities.
The pair (a, b) lies at one of the boundaries of the interval: either a = l with b = l - 1, or a = r with b = r + 1.
We unpack the hypothesis a ∈ [l, r] as l ≤ a ∧ a ≤ r using `Finset.mem_Icc.mp`, and the hypothesis b ∉ [l, r] as ¬(l ≤ b ∧ b ≤ r). Since a and b are adjacent integers (a + 1 = b or b + 1 = a), linear integer arithmetic (`omega`) rules out the possibility of a being strictly between l and r, leaving only the two boundary cases: a is the left endpoint l and b = l - 1, or a is the right endpoint r and b = r + 1.
uses
Finset.mem_Icc.mphave ha' := Finset.mem_Icc.mp ha have hb' : ¬ (l ≤ b ∧ b ≤ r) := by simpa using hb have h : (a = l ∧ b = l - 1) ∨ (a = r ∧ b = r + 1) := by rcases hab with hab | hab <;> omega
In the left-boundary case (a = l and b = l - 1), inserting b yields the interval [l - 1, r] and erasing a yields the interval [l + 1, r].
We split into the two boundary cases and assume a = l and b = l - 1. For the insertion claim, we choose the candidate interval bounds L = l - 1 and R = r. By set extensionality (`ext x`) and the membership lemmas for insertion (`Finset.mem_insert`) and intervals (`Finset.mem_Icc`), an integer x belongs to {b} ∪ [l, r] if and only if x = b ∨ (l ≤ x ∧ x ≤ r); since b = l - 1, linear integer arithmetic (`omega`) confirms this is equivalent to l - 1 ≤ x ∧ x ≤ r. For the erasure claim, we choose bounds L = l + 1 and R = r. By extensionality and the membership lemma for erasure (`Finset.mem_erase`), x belongs to [l, r] \ {a} if and only if x ≠ a ∧ l ≤ x ∧ x ≤ r; since a = l, linear integer arithmetic (`omega`) confirms this is equivalent to l + 1 ≤ x ∧ x ≤ r.
uses
Finset.mem_insert,Finset.mem_Icc,Finset.mem_erasercases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · constructor · refine ⟨l - 1, r, ?_⟩ ext x simp only [Finset.mem_insert, Finset.mem_Icc] omega · refine ⟨l + 1, r, ?_⟩ ext x simp only [Finset.mem_erase, Finset.mem_Icc] omega
In the right-boundary case (a = r and b = r + 1), inserting b yields the interval [l, r + 1] and erasing a yields the interval [l, r - 1].
In the remaining case, a = r and b = r + 1. For the insertion claim, we choose bounds L = l and R = r + 1. Rewriting membership with `Finset.mem_insert` and `Finset.mem_Icc`, an integer x belongs to {b} ∪ [l, r] if and only if x = b ∨ (l ≤ x ∧ x ≤ r); since b = r + 1, linear integer arithmetic (`omega`) verifies that this is equivalent to l ≤ x ∧ x ≤ r + 1. For the erasure claim, we choose bounds L = l and R = r - 1. Rewriting membership with `Finset.mem_erase` and `Finset.mem_Icc`, x belongs to [l, r] \ {a} if and only if x ≠ a ∧ l ≤ x ∧ x ≤ r; since a = r, linear integer arithmetic (`omega`) verifies that this is equivalent to l ≤ x ∧ x ≤ r - 1.
uses
Finset.mem_insert,Finset.mem_Icc,Finset.mem_erase· constructor · refine ⟨l, r + 1, ?_⟩ ext x simp only [Finset.mem_insert, Finset.mem_Icc] omega · refine ⟨l, r - 1, ?_⟩ ext x simp only [Finset.mem_erase, Finset.mem_Icc] omega
Finset.mem_Icc- An element x belongs to the closed integer interval [a, b] if and only if a ≤ x and x ≤ b.
Finset.mem_Icc.mp- If an element belongs to the closed integer interval [a, b], then it is bounded below by a and above by b.
Finset.mem_erase- An element belongs to the erased set s \ {b} if and only if it is not equal to b and belongs to s.
Finset.mem_insert- An element belongs to {b} ∪ s if and only if it equals b or belongs to s.
- In Lean, an integer interval `Finset.Icc L R` with `L > R` is the empty set. Thus, when an endpoint is deleted from a singleton interval $[l, l]$, the resulting empty set is represented as the interval $[l + 1, l]$ or $[l, l - 1]$.
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.
theorem op_2130_path_interval_crossing_closed (l r a b : ℤ) (ha : a ∈ Finset.Icc l r) (hb : b ∉ Finset.Icc l r) (hab : a + 1 = b ∨ b + 1 = a) : (∃ L R : ℤ, insert b (Finset.Icc l r) = Finset.Icc L R) ∧ (∃ L R : ℤ, (Finset.Icc l r).erase a = Finset.Icc L R) := by have ha' := Finset.mem_Icc.mp ha have hb' : ¬ (l ≤ b ∧ b ≤ r) := by simpa using hb have h : (a = l ∧ b = l - 1) ∨ (a = r ∧ b = r + 1) := by rcases hab with hab | hab <;> omega rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ · constructor · refine ⟨l - 1, r, ?_⟩ ext x simp only [Finset.mem_insert, Finset.mem_Icc] omega · refine ⟨l + 1, r, ?_⟩ ext x simp only [Finset.mem_erase, Finset.mem_Icc] omega · constructor · refine ⟨l, r + 1, ?_⟩ ext x simp only [Finset.mem_insert, Finset.mem_Icc] omega · refine ⟨l, r - 1, ?_⟩ ext x simp only [Finset.mem_erase, Finset.mem_Icc] omega