Lean / Reader
Lean readerCutVertex.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports CompetitorDegrees, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import CompetitorDegreesopen SimpleGraph SimpleGraph.Walkopen scoped Sym2namespace TerminalCyclesuniverse uvariable {V W : Type u}/-- The full open problem, with the finiteness, adjacency-decision and minimumdegree conventions in FormalConjectures/ErdosProblems/64.lean. -/def erdos64Statement : Prop :=∀ (T : Type u) (K : SimpleGraph T) [Fintype T] [DecidableRel K.Adj],K.minDegree ≥ 3 → hasPowerCycle K/-- Order minimality among nonempty finite graphs, all of whose degreesare at least three. Lexicographic minimality by order and size implies this. -/def smaller_graphs_have_cycle (_G : SimpleGraph W) : Prop :=∀ (T : Type u) [Finite T] [Nonempty T] (K : SimpleGraph T),Nat.card T < Nat.card W → (∀ v, 3 ≤ valence K v) → hasPowerCycle Kprivate theorem absent_below {H : SimpleGraph V} {G : SimpleGraph W} (f : H ↪g G)(absent : ¬ hasPowerCycle G) : ¬ hasPowerCycle H := byrintro ⟨k,v,p,hk,c,sz⟩apply absentexact ⟨k,f v,p.map f.toHom,hk,c.map f.injective,(length_map _ _).trans sz⟩/-- Appending the two incidences of c closes every simple terminal path. -/theorem forbidden_plus_two {H : SimpleGraph V} {G : SimpleGraph W}(f : H ↪g G) {c : W} {s t : V} (different : s ≠ t)(outside : ∀ v, f v ≠ c) (cs : G.Adj c (f s)) (ct : G.Adj c (f t))(absent : ¬ hasPowerCycle G) (p : H.Walk s t) (simple : p.IsPath) :∀ k ≥ 2, p.length+2 ≠ 2^k := byintro k hk helet q := p.map f.toHomhave fresh : c ∉ q.support := byintro in_qchange c ∈ (p.map f.toHom).support at in_qrw [Walk.support_map, List.mem_map] at in_qobtain ⟨v,_,eq⟩ := in_qexact outside v eqhave good := map_isPath_of_injective (f:=f.toHom) f.injective simplehave cycle := close_internal q good (fun e => different (f.injective e)) fresh cs ct.symmapply absentexact ⟨k,c,_,hk,cycle,by simpa [q,Nat.add_assoc] using he⟩/-- The nonadjacent-terminal conclusion under the single-side conditionsprovided by Ducoffe and Dumitru's Theorem 2.3. -/theorem cut_side_paths [Finite V] [Finite W] (H : SimpleGraph V) (G : SimpleGraph W)(f : H ↪g G) (s t : V) (c : W)(different : s ≠ t) (missing : ¬ H.Adj s t)(outside : ∀ v, f v ≠ c) (cs : G.Adj c (f s)) (ct : G.Adj c (f t))(smaller : Nat.card V < Nat.card W)(ds : 2 ≤ valence H s) (dt : 2 ≤ valence H t)(rest : ∀ v, v ≠ s → v ≠ t → 3 ≤ valence H v)(absent : ¬ hasPowerCycle G) (minimal : smaller_graphs_have_cycle G) :(∃ i ≥ 2, ∃ p : H.Walk s t, p.IsPath ∧ p.length = 2^i) ∧(∃ j ≥ 2, ∃ p : H.Walk s t, p.IsPath ∧ p.length+1 = 2^j) ∧(∀ p : H.Walk s t, p.IsPath → ∀ k ≥ 2, p.length+2 ≠ 2^k) := byclassicalletI : Nonempty V := ⟨s⟩have forbidden := forbidden_plus_two f different outside cs ct absenthave disj : ∀ v, H.Adj v s → H.Adj v t → False := byintro v vs vtlet p : H.Walk s t := cons vs.symm (cons vt nil)have simple : p.IsPath := bysimp [p,cons_isPath_iff,vs.ne.symm,different,vt.ne]exact forbidden p simple 2 (by decide) (by rfl)have no_old := absent_below f absenthave yes_merged := minimal _ (identify H s t)(lt_of_le_of_lt (identified_size s t) smaller) (identified_minimum H s t missing disj ds dt rest)have yes_added := minimal _ (completeEdge H s t) smaller(completed_minimum H s t different missing ds dt rest)have no_deleted : ¬ hasPowerCycle ((completeEdge H s t).deleteEdges {s(s,t)}) := byrwa [delete_completed H s t missing]obtain ⟨j,hj,proof⟩ := critical_edge_forces_path (completeEdge H s t) s t yes_added no_deletedrw [delete_completed H s t missing] at proofexact ⟨identification_forces_dyadic_path H s t different no_old yes_merged, ⟨j,hj,proof⟩, forbidden⟩/-- Applying the balanced-cut order identity from Theorem 2.3 gives anambient bound from the one-less-than-a-power path in `cut_side_paths`. -/theorem balanced_order_of_dyadic_distance [Finite V] [Finite W](H : SimpleGraph V) (s t : V) {i : ℕ} (dyadic : H.dist s t = 2^i)(balanced : Nat.card W = 2 * Nat.card V + 1)(path : ∃ j ≥ 2, ∃ p : H.Walk s t, p.IsPath ∧ p.length+1 = 2^j) :2 * H.dist s t ≤ Nat.card V ∧ 4 * H.dist s t + 1 ≤ Nat.card W := byclassicalletI := Fintype.ofFinite Vobtain ⟨j,_,p,hp,len⟩ := pathhave side := order_of_dyadic_distance dyadic p hp lenrw [← Nat.card_eq_fintype_card] at sideexact ⟨side, by omega⟩end TerminalCycles