AFTD Auto-Formalizing Theoretical Domains

carpool_path_requests_valid

theoremverified

Every path request has distinct endpoints.

Statement

theorem carpool_path_requests_valid (n : ℕ) (edges : List (Fin n × Fin n)) (h : carpool_path_requests n edges) : ValidCarpoolEdgeSequence n edges
Source
OP-2130, proposed here; arXiv:2609.21348 Theorem 1.1 gives a deterministic bound for greedy, while arXiv:2611.00388 proves a cubic tail for a different randomized algorithm.
Verified
22 Nov 2026
Axioms
Quot.soundpropext
Built on 2
  • carpool_path_requestsEvery requested ordered pair joins consecutive vertices of the n-vertex path; repetitions and either endpoint order are allowed.
  • ValidCarpoolEdgeSequenceA list of edges on n vertices is valid for online carpooling if every arriving edge connects two distinct vertices.

The proof, explained

The proof proceeds by contradiction: suppose some edge in the sequence has identical endpoints. By the definition of `carpool_path_requests`, adjacent vertices along any edge must differ in index by 1. However, identical endpoints must have equal numerical values, which is impossible since no natural number equals itself plus 1.

  1. To show that all edges have distinct endpoints, it suffices to assume some edge has identical endpoints and derive a contradiction.

    By definition, `ValidCarpoolEdgeSequence n edges` asserts that e.1 ≠ e.2 for every edge e ∈ edges. We introduce an arbitrary edge e ∈ edges and assume for contradiction that e.1 = e.2 (heq), leaving False as the goal.

    line 2

      intro e he heq
  2. The endpoints must have numerical indices differing by 1, but they also have equal numerical values.

    By the assumption h (`carpool_path_requests`), any edge in edges connects adjacent indices, meaning e.1.val + 1 = e.2.val or e.2.val + 1 = e.1.val. At the same time, applying `Fin.val` to both sides of the equality e.1 = e.2 via `congrArg` yields e.1.val = e.2.val.

    lines 3–4

    uses congrArg, Fin.val

      have hindex := h e he
      have hv : e.1.val = e.2.val := congrArg Fin.val heq
  3. A contradiction is derived.

    Linear arithmetic over ℕ (`omega`) determines that e.1.val = e.2.val is incompatible with e.1.val + 1 = e.2.val ∨ e.2.val + 1 = e.1.val, as no natural number equals itself plus 1.

    line 5

      omega
congrArg
Equality is preserved under function application: if a₁ = a₂, then f a₁ = f a₂.
Fin.val
The projection mapping a bounded natural number in Fin n to its underlying value in ℕ.

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

theorem carpool_path_requests_valid (n : ℕ) (edges : List (Fin n × Fin n)) (h : carpool_path_requests n edges) : ValidCarpoolEdgeSequence n edges := by  intro e he heq  have hindex := h e he  have hv : e.1.val = e.2.val := congrArg Fin.val heq  omega
See it in the graphDiscuss this resultChallenge it