File size: 1,527 Bytes
f89a930
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import OAI.NumberTheory.Jacobsthal.Paths.GeometricRegularWords

namespace OAI

namespace Erdos970
open scoped _root_.Erdos970


namespace NumberTheoryLean.FirstIsolatedPosition
open PrimeHistories GeometricRegularWords IsolatedBinGeometry
open LogarithmicBinScale LogarithmicBinLabels


theorem first_matching_position {α : Type*} (P : α → Prop) (ps : List α)
    (hex : ∃ p ∈ ps,P p) : ∃ pre p tail,ps=pre++p::tail ∧ P p ∧ ∀ q ∈ pre,¬P q := by
  classical
  induction ps with
  | nil => simp at hex
  | cons p ps ih =>
    by_cases hp : P p
    · exact ⟨[],p,ps,rfl,hp,by simp⟩
    · have ht : ∃ q ∈ ps,P q := by
        obtain ⟨q,hq,hP⟩ := hex
        rcases List.mem_cons.mp hq with rfl | hq
        · exact False.elim (hp hP)
        · exact ⟨q,hq,hP⟩
      obtain ⟨pre,q,tail,he,hq,hpre⟩ := ih ht
      exact ⟨p::pre,q,tail,by rw [List.cons_append,he],hq,by simpa using And.intro hp hpre⟩

theorem geometric_first_isolated {w top xi C B R L alpha beta : ℝ}
    (hw : 1 < w) (htop : w < top) (hxi : 0 < xi) (z : Node) (ps : List ℕ)
    (hp : ps ∈ geometricWords hw htop hxi C B R L alpha beta z) :
    ∃ pre p tail,ps=pre++p::tail ∧
      isolatedBin w top xi B alpha beta (label (zero_lt_one.trans hw) htop hxi p) ∧
      ∀ q ∈ pre,¬isolatedBin w top xi B alpha beta (label (zero_lt_one.trans hw) htop hxi q) :=
  first_matching_position _ ps (geometric_isolated_prime hw htop hxi z ps hp)
end NumberTheoryLean.FirstIsolatedPosition


end Erdos970

end OAI