AFTD Auto-Formalizing Theoretical Domains

carpool_path_example_d2

theoremverified

For the displayed three requests on the four-vertex path, exactly four of the eight coin tapes reach absolute prefix discrepancy two.

Statement

theorem carpool_path_example_d2 : carpool_path_requests 4 [(0,1),(2,3),(1,2)] ∧ carpool_greedy_tail_count 4 [(0,1),(2,3),(1,2)] 2 = 4
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
Classical.choiceQuot.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.
  • carpool_greedy_tail_countThe number of length-T Boolean coin tapes for which the greedy trajectory has maximum absolute prefix discrepancy at least D, where T is…

The proof, explained

The theorem asserts that the list of three requests [(0,1), (2,3), (1,2)] consists of valid adjacent edges on the 4-vertex path, and that exactly four of the eight possible coin sequences cause the online greedy carpool algorithm to reach an absolute vertex discrepancy of at least two. The proof splits the conjunction: the first part is verified by simplifying the definition of valid path edges, while the second part is solved by direct computation in Lean's kernel, exhaustively simulating the greedy algorithm across all eight coin tapes.

  1. The goal is split into verifying that the request sequence is valid on the path, and verifying the greedy discrepancy count.

    The proof splits the logical conjunction into two separate subgoals.

    line 2

      constructor
  2. The request list [(0, 1), (2, 3), (1, 2)] consists of adjacent edges on the 4-vertex path.

    Unfolding the definition `carpool_path_requests` requires checking that each edge (u, v) in the list satisfies u + 1 = v or v + 1 = u. The simplifier checks this arithmetic condition for each of the three edges: 0 + 1 = 1, 2 + 1 = 3, and 1 + 1 = 2.

    line 3

    uses carpool_path_requests

      · simp [carpool_path_requests]
  3. Exactly 4 of the 8 coin sequences lead to a maximum discrepancy of at least 2 under the greedy carpool algorithm.

    Because the problem domain is finite (3 requests yielding 2³ = 8 coin tapes on 4 vertices), the entire definition—running the greedy choice function, tracking vertex discrepancies, and counting the tapes reaching discrepancy at least 2—is computable. Lean's kernel evaluates the left-hand side directly to 4 by reflexivity.

    line 4

      · rfl
carpool_path_requests
the predicate asserting that every pair (u, v) in a list connects adjacent vertices on the path of length n, i.e., u + 1 = v or v + 1 = u

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_example_d2 : carpool_path_requests 4 [(0,1),(2,3),(1,2)] ∧ carpool_greedy_tail_count 4 [(0,1),(2,3),(1,2)] 2 = 4 := by  constructor  · simp [carpool_path_requests]  · rfl
See it in the graphDiscuss this resultChallenge it