Offline · exact source
Exact Lean source

TensorLANEmbeddingDiagonal

formalization/Cloning/TensorLANEmbeddingDiagonal.lean

Source hash: cbd2be7d72ce71ce964ae32130005cd3a60062520d2aae3feba11ee204297367

Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.

The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.

Declarations in this module
1import Mathlib.Order.Filter.AtTopBot.Basic
2import Mathlib.Data.Finset.Lattice.Fold
3 
4/-! One diverging cutoff can satisfy all countably many fixed-cutoff and
5integer-window requirements simultaneously. The chosen sequence is independent
6of which fixed compact window is subsequently tested. -/
7noncomputable section
8open Filter
9open scoped Classical
10namespace Cloning.TensorLAN
11set_option maxHeartbeats 800000
12 
13/-- Diagonal selection for any countable family of eventual requirements.
14The predicate can bundle all cutoff, window, and accuracy tests through level `r`.
15No new channel is chosen after a compact set is supplied. -/
16theorem exists_common_diverging_cutoff (P : ℕ → ℕ → Prop)
17    (hP : ∀ r, ∀ᶠ N in atTop, P N r) :
18    ∃ R : ℕ → ℕ, Monotone R ∧ Tendsto R atTop atTop ∧
19      (∀ N, R N ≤ N) ∧ ∀ᶠ N in atTop, ∀ r ≤ R N, P N r := by
20  classical
21  have hfinite (r : ℕ) : ∀ᶠ N in atTop, ∀ k ≤ r, P N k := by
22    induction r with
23    | zero =>
24        filter_upwards [hP 0] with N hN k hk
25        simpa only [Nat.le_zero.mp hk] using hN
26    | succ r ih =>
27        filter_upwards [ih, hP (r + 1)] with N hN hr k hk
28        rcases Nat.eq_or_lt_of_le hk with rfl | hlt
29        · exact hr
30        · exact hN k (Nat.le_of_lt_succ hlt)
31  choose threshold hthreshold using (fun r => eventually_atTop.mp (hfinite r))
32  let candidates (N : ℕ) := (Finset.range (N + 1)).filter (fun r => threshold r ≤ N)
33  let R (N : ℕ) := (candidates N).sup id
34  have hmem (N r : ℕ) : r ∈ candidates N ↔ r ≤ N ∧ threshold r ≤ N := by
35    simp only [candidates, Finset.mem_filter, Finset.mem_range, Nat.lt_succ_iff]
36  have hmono : Monotone R := by
37    intro N M hNM
38    apply Finset.sup_mono
39    intro r hr
40    exact (hmem M r).mpr ⟨((hmem N r).mp hr).1.trans hNM,
41      ((hmem N r).mp hr).2.trans hNM⟩
42  have hbound (N : ℕ) : R N ≤ N := by
43    apply Finset.sup_le
44    intro r hr
45    exact ((hmem N r).mp hr).1
46  have hlarge : Tendsto R atTop atTop := by
47    apply tendsto_atTop.mpr
48    intro r
49    filter_upwards [eventually_ge_atTop (max r (threshold r))] with N hN
50    exact Finset.le_sup (f := id) ((hmem N r).mpr ⟨(le_max_left _ _).trans hN,
51      (le_max_right _ _).trans hN⟩)
52  refine ⟨R, hmono, hlarge, hbound, ?_⟩
53  filter_upwards [eventually_ge_atTop (threshold 0)] with N hN
54  have hnonempty : (candidates N).Nonempty := ⟨0, (hmem N 0).mpr ⟨Nat.zero_le _, hN⟩⟩
55  have hm : R N ∈ candidates N := by
56    obtain ⟨r, hr, he⟩ := Finset.sup_mem_of_nonempty (f := id) hnonempty
57    change (candidates N).sup id ∈ candidates N
58    simpa only [id_eq] using he ▸ hr
59  exact hthreshold (R N) N ((hmem N (R N)).mp hm).2
60 
61/-- A fixed window is eventually below the common selected cutoff. -/
62theorem common_cutoff_eventually_covers {R : ℕ → ℕ} (hR : Tendsto R atTop atTop)
63    (window : ℕ) : ∀ᶠ N in atTop, window ≤ R N :=
64  hR.eventually (eventually_ge_atTop window)
65 
66/-- Sequence-wise asymptotic theorems imply uniform eventual control over
67varying admissible sectors. A violating sector could otherwise be selected at
68every bad sample size. The reference sequence supplies admissible values at
69all remaining sizes. -/
70theorem eventually_uniform_of_all_sequences {A : ℕ → Type*}
71    (S : ∀ N, Set (A N)) (reference : ∀ N, A N)
72    (hreference : ∀ᶠ N in atTop, reference N ∈ S N)
73    (P : ∀ N, A N → Prop)
74    (hseq : ∀ x : ∀ N, A N, (∀ᶠ N in atTop, x N ∈ S N) → ∀ᶠ N in atTop, P N (x N)) :
75    ∀ᶠ N in atTop, ∀ x ∈ S N, P N x := by
76  classical
77  let choice (N : ℕ) : A N := if h : ∃ x ∈ S N, ¬ P N x then Classical.choose h else reference N
78  have hmem : ∀ᶠ N in atTop, choice N ∈ S N := by
79    filter_upwards [hreference] with N hN
80    dsimp only [choice]
81    split_ifs with h
82    · exact (Classical.choose_spec h).1
83    · exact hN
84  filter_upwards [hseq choice hmem] with N hN x hx
85  by_contra hbad
86  have hex : ∃ x ∈ S N, ¬ P N x := ⟨x, hx, hbad⟩
87  have hn : ¬ P N (choice N) := by
88    dsimp only [choice]
89    rw [dif_pos hex]
90    exact (Classical.choose_spec hex).2
91  exact hn hN
92 
93end Cloning.TensorLAN