Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proposition 2.4 and Remark, pp. 154–155 — limited backtracking terminates, and its success and failure answers are correct

Proved
Timetabling85.TwoPeriod.limited_backtracking_correct

by mikedeng1 · Oct 6, 2026 · Mathlib 0df444a (Lean v4.33.1)

algorithm-correctnessbacktrackingp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1stable-settimetabling

Let GGG be a graph on the nodes xj=(j,true)x_j=(j,\mathrm{true})xj​=(j,true), xˉj=(j,false)\bar x_j=(j,\mathrm{false})xˉj​=(j,false) of nnn teachers in which xjx_jxj​ and xˉj\bar x_jxˉj​ are linked for every jjj (each teacher has two possible schedules, and they are incompatible). Run de Werra's limited backtracking from run(∅)\mathrm{run}(\emptyset)run(∅), with arbitrary choices of the teacher to decide and of the first schedule tried. Then:

  1. termination — there is no infinite run: the move relation is well founded from run(∅)\mathrm{run}(\emptyset)run(∅);
  2. progress — every reachable state run(A)\mathrm{run}(A)run(A) in which some teacher is not yet fixed has a move;
  3. success is correct — if run(A)\mathrm{run}(A)run(A) is reachable and every teacher is fixed in AAA, then AAA is a set of nnn pairwise non-adjacent nodes of GGG, i.e. a timetable;
  4. failure is correct — if fail\mathrm{fail}fail is reachable, then
G has no set of n pairwise non-adjacent nodes.G \text{ has no set of } n \text{ pairwise non-adjacent nodes.}G has no set of n pairwise non-adjacent nodes.

Together, every run of the procedure stops after finitely many decisions and returns a timetable exactly when one exists. Combined with the reduction of CT4 to the conflict graph, this is the correctness content of de Werra's Proposition 2.4 (the case of CT4 in which every teacher is available during at most 2 periods) and of the Remark that follows it.

Formalization Note The O(n2)O(n^2)O(n2) running-time claim of Proposition 2.4 and of the Remark is not formalized: the page fixes no machine model and no constant. Termination (clause 1) is the formal content; each move fixes at least one more teacher. All four clauses quantify over every run of the nondeterministic move relation, not over one fixed choice rule; clauses 1 and 2 rule out a procedure that never moves.


Retired 2026-10-27: a Lean-vs-paper fidelity audit found this statement weaker than, or narrower than, the cited result. A corrected statement will be resubmitted.

Preamble
import Mathlib
import Definitions.Def_Timetabling85_TwoPeriod_Backtracking
Formal statement
namespace Timetabling85.TwoPeriod

theorem limited_backtracking_correct {n : ℕ} (G : SimpleGraph (Fin n × Bool))
    (hpair : ∀ j : Fin n, G.Adj (j, false) (j, true)) :
    Acc (fun t s => Step G s t) (State.run ∅) ∧
    (∀ A : Finset (Fin n × Bool), Reachable G (State.run A) → (∃ j, ¬ Fixed A j) →
      ∃ t, Step G (State.run A) t) ∧
    (∀ A : Finset (Fin n × Bool), Reachable G (State.run A) → (∀ j, Fixed A j) →
      G.IsNIndepSet n A) ∧
    (Reachable G State.fail → ¬ ∃ T : Finset (Fin n × Bool), G.IsNIndepSet n T) := by sorry

end Timetabling85.TwoPeriod
Source
de Werra, An introduction to timetabling, Eur. J. Oper. Res. 19 (1985), pp. 154–155, Proposition 2.4 and its proof; Remark, p. 155
Human review
  • Endorsed by Shuze Chen · Oct 6, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 6, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me