op_2130_greedy_orientations_embedding
Injectively relabeling the vertices of a greedy carpool instance leaves its sequence of orientations unchanged for the same tie-breaking coins.
Statement
theorem op_2130_greedy_orientations_embedding (n m : ℕ) (f : Fin n ↪ Fin m) (edges : List (Fin n × Fin n)) (coins : List Bool) : carpool_greedy_orientations m (edges.map (fun e => (f e.1, f e.2))) coins = carpool_greedy_orientations n edges coins
- Source
- Independent-path-block construction for refuting op_2130_path_greedy_fixed_time_tail
- Verified
- 22 Nov 2026
- Axioms
propext- Built on 2
- carpool_greedy_orientationsGiven a list of edges and a list of tie-breaking coins, randomized greedy carpooling orients each edge toward the endpoint with smaller…
- carpool_stepIn online carpooling on n vertices, given an edge e joining two distinct vertices and an orientation bit b, the discrepancy vector d…
- Used by 1
- op_2130_greedy_discrepancies_embeddingAfter injectively relabeling the vertices of a greedy carpool instance, restricting every prefix discrepancy vector to the original…
The proof, explained
The proof proceeds by induction on the edge list in an auxiliary function that tracks vertex discrepancies. First, a helper lemma establishes that updating discrepancies after orienting an edge commutes with injective vertex relabeling, because injectivity preserves vertex equality tests. In each greedy step, since the embedded discrepancy values match the original ones, the greedy orientation choice (including tie-breaking) is identical on both graphs. Applying the induction hypothesis with the updated discrepancies shows the entire sequence of orientations is preserved, which implies the theorem for initial all-zero discrepancies.
Updating vertex discrepancies after orienting an edge commutes with injective vertex relabeling.
Let $v \in \mathrm{Fin}\, n$ be an arbitrary vertex. Since the relabeling map $f : \mathrm{Fin}\, n \hookrightarrow \mathrm{Fin}\, m$ is injective, $f(v) = f(e.1) \iff v = e.1$ and $f(v) = f(e.2) \iff v = e.2$. Unfolding `carpool_step`, the discrepancy update at a vertex depends only on whether it is the source or target of edge $e$. Because $d'(f(u)) = d(u)$ for all $u$, the updated discrepancy at $f(v)$ in the target graph matches the updated discrepancy at $v$ in the source graph.
uses
f.injective.eq_iffintro v have h1 : (f v = f e.1) ↔ v = e.1 := f.injective.eq_iff have h2 : (f v = f e.2) ↔ v = e.2 := f.injective.eq_iff simp [carpool_step, hd v, h1, h2]
The auxiliary greedy orientation routine commutes with vertex embedding when the edge list is empty.
We induct on the list of edges, generalizing over the coins and discrepancy vectors. In the base case where the edge list is empty (`nil`), mapping $f$ over the empty list gives `[]`, and `carpool_greedy_orientations.aux` evaluates directly to `[]` on both sides by definition.
induction edges generalizing coins d d' with | nil => simp [carpool_greedy_orientations.aux]
When edges remain but the list of tie-breaking coins is empty, the orientation sequence is empty on both sides.
For a non-empty edge list $e :: es$, we perform a case split on the list of coins. If no coins remain (`nil`), the auxiliary function immediately terminates and produces the empty list `[]` on both sides.
| cons e es ih => cases coins with | nil => simp [carpool_greedy_orientations.aux]The greedy orientation chosen for the current edge is identical in the original and embedded instances.
When a coin $c$ is available, let $b$ be the orientation chosen for $e = (e.1, e.2)$ using discrepancy $d$ and coin $c$. In the embedded instance, the choice compares $d'(f(e.1))$ and $d'(f(e.2))$, falling back to $c$ on a tie. Since $d'(f(u)) = d(u)$ by hypothesis, the comparisons evaluate to the exact same values, establishing that the embedded decision equals $b$.
| cons c cs => let b := if d e.1 < d e.2 then true else if d e.2 < d e.1 then false else c have hb : (if d' (f e.1) < d' (f e.2) then true else if d' (f e.2) < d' (f e.1) then false else c) = b := by simp [hd, b]The sequence of greedy orientations is preserved on non-empty inputs by the induction hypothesis.
Unfolding `List.map` on the edge list and the definition of `carpool_greedy_orientations.aux`, both sides produce $b$ as their first orientation. Factoring out $b$ with `congrArg (List.cons b)`, it remains to show the tails match. The tails are recursive calls on $es$ and $cs$ with discrepancy vectors updated by `carpool_step`. By the lemma `carpool_step_embedding`, the updated vectors still satisfy $d'_{new}(f(v)) = d_{new}(v)$, so the induction hypothesis applies to equate the tails.
uses
List.map_cons,congrArg,carpool_step_embeddingsimp only [List.map_cons, carpool_greedy_orientations.aux] rw [hb] apply congrArg (List.cons b) exact ih cs _ _ (carpool_step_embedding n m f d d' e b hd)
Injectively relabeling vertices preserves the greedy orientation sequence for the entire process.
Unfolding `carpool_greedy_orientations`, the overall procedure runs `carpool_greedy_orientations.aux` starting with the discrepancy vector identically zero on all vertices. Since $0 = 0$ holds trivially for every vertex, the auxiliary embedding lemma `greedy_aux_embedding` applies directly to finish the proof.
uses
greedy_aux_embeddingunfold carpool_greedy_orientations exact greedy_aux_embedding n m f edges coins _ _ (by intro; rfl)
f.injective.eq_iff- An injective function maps two arguments to the same value if and only if the arguments are equal.
List.map_cons- Mapping a function over a non-empty list applies the function to the head and recurses on the tail.
congrArg- Applying the same function to equal arguments produces equal results.
carpool_step_embedding- If a discrepancy vector on the target graph agrees with one on the source graph under the vertex embedding, then updating along an edge and orientation preserves this agreement on all embedded vertices.
greedy_aux_embedding- The auxiliary greedy orientation function produces identical orientation sequences on the original and embedded instances, provided the discrepancy vectors agree under the embedding.
- The algorithm is formulated via a recursive auxiliary function `carpool_greedy_orientations.aux` that carries the accumulating discrepancy vector; the main theorem is an immediate consequence when discrepancies are initialized to zero.
- The base cases where either the edge list or the tie-breaking coin list is empty are resolved automatically by definition unfolding in `simp`.
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.
private lemma carpool_step_embedding (n m : ℕ) (f : Fin n ↪ Fin m) (d : Fin n → ℤ) (d' : Fin m → ℤ) (e : Fin n × Fin n) (b : Bool) (hd : ∀ v, d' (f v) = d v) : ∀ v, carpool_step m d' (f e.1, f e.2) b (f v) = carpool_step n d e b v := by intro v have h1 : (f v = f e.1) ↔ v = e.1 := f.injective.eq_iff have h2 : (f v = f e.2) ↔ v = e.2 := f.injective.eq_iff simp [carpool_step, hd v, h1, h2]private lemma greedy_aux_embedding (n m : ℕ) (f : Fin n ↪ Fin m) (edges : List (Fin n × Fin n)) (coins : List Bool) (d : Fin n → ℤ) (d' : Fin m → ℤ) (hd : ∀ v, d' (f v) = d v) : carpool_greedy_orientations.aux m (edges.map (fun e => (f e.1, f e.2))) coins d' = carpool_greedy_orientations.aux n edges coins d := by induction edges generalizing coins d d' with | nil => simp [carpool_greedy_orientations.aux] | cons e es ih => cases coins with | nil => simp [carpool_greedy_orientations.aux] | cons c cs => let b := if d e.1 < d e.2 then true else if d e.2 < d e.1 then false else c have hb : (if d' (f e.1) < d' (f e.2) then true else if d' (f e.2) < d' (f e.1) then false else c) = b := by simp [hd, b] simp only [List.map_cons, carpool_greedy_orientations.aux] rw [hb] apply congrArg (List.cons b) exact ih cs _ _ (carpool_step_embedding n m f d d' e b hd)theorem op_2130_greedy_orientations_embedding (n m : ℕ) (f : Fin n ↪ Fin m) (edges : List (Fin n × Fin n)) (coins : List Bool) : carpool_greedy_orientations m (edges.map (fun e => (f e.1, f e.2))) coins = carpool_greedy_orientations n edges coins := by unfold carpool_greedy_orientations exact greedy_aux_embedding n m f edges coins _ _ (by intro; rfl)