Lean / Reader
Lean reader

RingObstruction.lean

149 lines7 declarationsno sorryimports TwoCopy Mathlib.Data.Nat.Log Mathlib.Tactic.Linarith

Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports TwoCopy, which it does not have: you can read it there, but it will not check. Build the project itself to check it.

  1. import TwoCopy
  2. import Mathlib.Data.Nat.Log
  3. import Mathlib.Tactic.Linarith
  4. open SimpleGraph SimpleGraph.Walk
  5. open scoped Sym2
  6. namespace TerminalCycles
  7. universe u
  8. /-- A two-terminal graph together with uniform bounds on path length plus
  9. one. The added unit accounts for one joining edge per copy in a ring. -/
  10. structure PathBlock (lo hi n : ℕ) where
  11. Vertex : Type u
  12. finite : Finite Vertex
  13. graph : SimpleGraph Vertex
  14. start : Vertex
  15. finish : Vertex
  16. rootDegree : 2 ≤ valence graph start
  17. side : TerminalSide graph start finish
  18. order : Nat.card Vertex = n
  19. window : ∀ p : graph.Walk start finish, p.IsPath → lo ≤ p.length+1 ∧ p.length+1 ≤ hi
  20. namespace PathBlock
  21. /-- Join two blocks in series by a single bridge. Cycles stay in their
  22. original blocks, and the shifted path-length intervals add. -/
  23. def series {l h n l' h' n' : ℕ} (X : PathBlock.{u} l h n) (Y : PathBlock.{u} l' h' n') :
  24. PathBlock.{u} (l+l') (h+h') (n+n') := by
  25. letI : Finite X.Vertex := X.finite
  26. letI : Finite Y.Vertex := Y.finite
  27. let y : ExceptRoot Y.start := ⟨Y.finish,Y.side.distinct⟩
  28. let L := LeafGraph Y.graph Y.start
  29. let leaf := leafVertex (b:=Y.start)
  30. let term := leafEnd y
  31. let ls : TerminalSide L leaf term := (leaf_side Y.graph Y.side Y.rootDegree).1
  32. have one : 1 ≤ valence L leaf := (leaf_side Y.graph Y.side Y.rootDegree).2
  33. let yt : ExceptRoot leaf := ⟨term,ls.distinct⟩
  34. let K := wedge X.graph L X.finish leaf
  35. let a : WedgeVertex X.Vertex leaf := .inl X.start
  36. let b : WedgeVertex X.Vertex leaf := .inr yt
  37. have dx := X.side.target
  38. have degs := wedge_terminal_degrees X.graph L X.finish leaf X.start yt (by omega)
  39. X.rootDegree ls.target (fun z hx ha => X.side.others z ha hx) ls.others
  40. refine ⟨WedgeVertex X.Vertex leaf,inferInstance,K,a,b,degs.1,⟨Sum.inr_ne_inl,degs.2.1,degs.2.2,?_⟩,?_,?_⟩
  41. · intro yes
  42. exact (wedge_cycle_from_side X.graph L X.finish leaf yes).elim X.side.noCycle ls.noCycle
  43. · have aSize := wedge_order (V:=X.Vertex) leaf
  44. have bSize := leaf_order Y.start
  45. have cSize := X.order
  46. have dSize := Y.order
  47. change Nat.card (WedgeVertex X.Vertex leaf) = n+n'
  48. omega
  49. · intro p hp
  50. obtain ⟨r,q,hr,hq,sum⟩ := wedge_terminal_split X.graph L X.finish leaf X.start yt p hp
  51. obtain ⟨s',hs',add⟩ := leaf_path Y.graph y q hq
  52. have hX := X.window r.reverse hr.reverse
  53. have hY := Y.window s' hs'
  54. simp only [length_reverse] at hX
  55. omega
  56. /-- A chain of r+1 copies, retaining all original vertices. -/
  57. def chain {lo hi n : ℕ} (X : PathBlock.{u} lo hi n) (r : ℕ) :
  58. PathBlock.{u} ((r+1)*lo) ((r+1)*hi) ((r+1)*n) := by
  59. induction r with
  60. | zero => simpa using X
  61. | succ r ih => simpa only [Nat.succ_mul] using series ih X
  62. /-- A shifted interval that misses all dyadic lengths gives an actual
  63. finite counterexample, on the same vertices as the chain being closed. -/
  64. theorem close_without_power {lo hi n : ℕ} (X : PathBlock.{u} lo hi n) (long : 2 < lo)
  65. (gap : ∀ k ≥ 2, ¬ (lo ≤ 2^k ∧ 2^k ≤ hi)) :
  66. ∃ (T : Type u) (_ : Finite T) (G : SimpleGraph T), Nat.card T=n ∧
  67. Nonempty T ∧ (∀ v, 3 ≤ valence G v) ∧ ¬ hasPowerCycle G := by
  68. letI : Finite X.Vertex := X.finite
  69. let a := X.start
  70. let b := X.finish
  71. have diff : a ≠ b := X.side.distinct.symm
  72. have missing : ¬ X.graph.Adj a b := by
  73. intro edge
  74. let p : X.graph.Walk a b := cons edge nil
  75. have good : p.IsPath := by simp [p,cons_isPath_iff,diff]
  76. have low := (X.window p good).1
  77. change lo ≤ 2 at low
  78. omega
  79. let K := completeEdge X.graph a b
  80. refine ⟨X.Vertex,X.finite,K,X.order,⟨a⟩,completed_minimum X.graph a b diff missing X.rootDegree X.side.target X.side.others,?_⟩
  81. intro yes
  82. obtain ⟨k,hk,p,hp,len⟩ := path_after_completion X.graph a b missing yes X.side.noCycle
  83. exact gap k hk (len ▸ X.window p hp)
  84. /-- Scale an integral interval of multiplicative width strictly below two
  85. so that it lies strictly between consecutive powers of two. -/
  86. theorem dyadic_gap_multiplier (lo hi : ℕ) (positive : 0 < lo) (ordered : lo ≤ hi) (narrow : hi < 2*lo) :
  87. ∃ q j : ℕ, hi ≤ q ∧ q ≤ 2*hi ∧ 2^j < (q+1)*lo ∧ (q+1)*hi < 2^(j+1) := by
  88. let j := Nat.log 2 (hi*lo) + 1
  89. let d := 2^j
  90. let q := d/lo
  91. have pos : hi*lo ≠ 0 := Nat.mul_ne_zero (by omega) (by omega)
  92. have below : hi*lo < d := Nat.lt_pow_succ_log_self (by decide) _
  93. have above : d ≤ 2*(hi*lo) := by
  94. have bound := Nat.pow_log_le_self 2 pos
  95. dsimp [d,j]
  96. rw [pow_succ]
  97. omega
  98. have lower : hi ≤ q := (Nat.le_div_iff_mul_le positive).mpr below.le
  99. have upper : q ≤ 2*hi := Nat.div_le_of_le_mul (by nlinarith only [above] : d ≤ lo*(2*hi))
  100. have strictLow : d < (q+1)*lo := (Nat.div_lt_iff_lt_mul positive).mp (Nat.lt_succ_self q)
  101. have qsize : q*lo ≤ d := Nat.div_mul_le_self d lo
  102. have cap := Nat.mul_le_mul_left q (show hi+1 ≤ 2*lo by omega)
  103. have strictHigh : (q+1)*hi < 2*d := by
  104. by_cases eq : q=hi
  105. · nlinarith only [cap,below,eq,show q*lo=hi*lo from congrArg (·*lo) eq]
  106. · have hlt : hi < q := by omega
  107. nlinarith only [cap,qsize,hlt]
  108. exact ⟨q,j,lower,upper,strictLow,by simpa only [pow_succ,Nat.mul_comm 2] using strictHigh⟩
  109. /-- A single finite block with all terminal path lengths between m and M,
  110. where 1 ≤ m ≤ M ≤ 2m, gives an actual counterexample on rn vertices with
  111. 2 ≤ r ≤ 2M+3. This is a sufficient certificate to disprove Erdős #64. -/
  112. theorem narrow_window_counterexample {m M n : ℕ} (X : PathBlock.{u} (m+1) (M+1) n)
  113. (positive : 1 ≤ m) (ordered : m ≤ M) (narrow : M ≤ 2*m) :
  114. ∃ r : ℕ, 2 ≤ r ∧ r ≤ 2*M+3 ∧ ∃ (T : Type u) (_ : Finite T) (G : SimpleGraph T),
  115. Nat.card T=r*n ∧ Nonempty T ∧ (∀ v, 3 ≤ valence G v) ∧ ¬ hasPowerCycle G := by
  116. obtain ⟨q,j,lower,upper,left,right⟩ := dyadic_gap_multiplier (m+1) (M+1) (by omega) (by omega) (by omega)
  117. have long : 2 < (q+1)*(m+1) := by nlinarith only [lower,positive,ordered,Nat.zero_le (q*m)]
  118. have gap (k : ℕ) (_ : k ≥ 2) : ¬ ((q+1)*(m+1) ≤ 2^k ∧ 2^k ≤ (q+1)*(M+1)) := by
  119. rintro ⟨a,b⟩
  120. rcases le_or_gt k j with small | big
  121. · exact (not_lt_of_ge (Nat.pow_le_pow_right (by decide : 0<2) small)) (left.trans_le a)
  122. · have monotone := Nat.pow_le_pow_right (by decide : 0<2) (show j+1 ≤ k by omega)
  123. omega
  124. exact ⟨q+1,by omega,by omega,(chain X q).close_without_power long gap⟩
  125. theorem narrow_window_refutes_erdos64 {m M n : ℕ} (X : PathBlock.{u} (m+1) (M+1) n)
  126. (positive : 1 ≤ m) (ordered : m ≤ M) (narrow : M ≤ 2*m) : ¬ erdos64Statement.{u} := by
  127. classical
  128. intro conjecture
  129. obtain ⟨_,_,_,T,fin,G,_,nonempty,degree,no⟩ := X.narrow_window_counterexample positive ordered narrow
  130. letI : Finite T := fin
  131. letI : Fintype T := Fintype.ofFinite T
  132. letI : Nonempty T := nonempty
  133. exact no (conjecture T G (G.le_minDegree_of_forall_le_degree 3 (fun v => by simpa only [← valence_eq_degree] using degree v)))
  134. end PathBlock
  135. end TerminalCycles