File size: 3,900 Bytes
4a56cd6 | 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | import OAI.Combinatorics.CycleDecomposition.BatchIndexing
namespace OAI
section
open Filter Asymptotics Real
open scoped Topology
noncomputable section
open MeasureTheory ProbabilityTheory Finset
section
namespace ErdosGallai
noncomputable section
open Finset
theorem prefix_selection (S : β β β) (hS : β j, 0 β€ S j) (K N : β)
(hsupp : β j, N β€ j β S j = 0) (hne : β j, 0 < S j) :
β i, 0 < S i β§ β j β range (i+K+1), S j β€ 4*(K+1:β)*S i := by
let A := (range N).filter (fun j => 0 < S j)
have hA : A.Nonempty := by
obtain β¨j,hjβ© := hne
exact β¨j, by
simp only [A, mem_filter, mem_range]
exact β¨by by_contra hn; rw [hsupp j (by omega)] at hj; linarith, hjβ©β©
let iβ := A.min' hA
have hiβA : iβ β A := A.min'_mem hA
have hiβpos : 0 < S iβ := (mem_filter.mp hiβA).2
have hstart : (β j β range (iβ+1), S j) = S iβ := by
apply sum_eq_single iβ
Β· intro j hj hji
by_contra hjzero
have hjpos : 0 < S j := lt_of_le_of_ne (hS j) (Ne.symm hjzero)
have hjA : j β A := by
simp only [A, mem_filter, mem_range]
refine β¨?_, hjposβ©
have hiN := (mem_range.mp (mem_filter.mp hiβA).1)
have hjle := mem_range.mp hj
omega
have hmin : iβ β€ j := A.min'_le j hjA
have hjle := mem_range.mp hj
omega
Β· intro hi
exact (hi (by simp)).elim
let B := A.filter (fun i => (β j β range (i+1), S j) β€ 2*(K+1:β)*S i)
have hB : B.Nonempty := by
refine β¨iβ, mem_filter.mpr β¨hiβA, ?_β©β©
rw [hstart]
have hK : (0:β) β€ K := Nat.cast_nonneg K
nlinarith
let i := B.max' hB
have hiB : i β B := B.max'_mem hB
have hiA : i β A := (mem_filter.mp hiB).1
have hipos : 0 < S i := (mem_filter.mp hiA).2
have hinv : (β j β range (i+1), S j) β€ 2*(K+1:β)*S i := (mem_filter.mp hiB).2
refine β¨i, hipos, ?_β©
by_contra hfail
have hfail' : 4*(K+1:β)*S i < β j β range (i+K+1), S j := lt_of_not_ge hfail
have hwindow : 2*(K+1:β)*S i < β j β Ico (i+1) (i+K+1), S j := by
have hsplit := Finset.sum_range_add_sum_Ico S (by omega : i+1 β€ i+K+1)
linarith
have hwindow_nonempty : (Ico (i+1) (i+K+1)).Nonempty := by
by_contra hh
rw [Finset.not_nonempty_iff_eq_empty.mp hh] at hwindow
simp only [sum_empty] at hwindow
have hK : (0:β) β€ K := Nat.cast_nonneg K
nlinarith
obtain β¨j,hjw,hmaxβ© := Finset.exists_max_image (Ico (i+1) (i+K+1)) S hwindow_nonempty
have hsum : (β l β Ico (i+1) (i+K+1), S l) β€ (K:β)*S j := by
calc
_ β€ β _l β Ico (i+1) (i+K+1), S j := sum_le_sum hmax
_ = _ := by simp []
have hdouble : 2*S i < S j := by
have hK : (0:β) β€ K := Nat.cast_nonneg K
nlinarith
have hjpos : 0 < S j := by linarith
have hjA : j β A := by
simp only [A, mem_filter, mem_range]
exact β¨by by_contra hjN; rw [hsupp j (by omega)] at hjpos; linarith, hjposβ©
have hjbounds := Finset.mem_Ico.mp hjw
have hpartial : (β l β Ico (i+1) (j+1), S l) β€ (K:β)*S j := by
calc
_ β€ β l β Ico (i+1) (i+K+1), S l := by
apply sum_le_sum_of_subset_of_nonneg
Β· intro l hl
simp only [mem_Ico] at hl β’
omega
Β· intro l _ _; exact hS l
_ β€ _ := hsum
have hjinv : (β l β range (j+1), S l) β€ 2*(K+1:β)*S j := by
have hsplit := Finset.sum_range_add_sum_Ico S (by omega : i+1 β€ j+1)
have hK : (0:β) β€ K := Nat.cast_nonneg K
nlinarith
have hjB : j β B := mem_filter.mpr β¨hjA,hjinvβ©
have hji : j β€ i := B.le_max' j hjB
omega
end
end ErdosGallai
end
namespace ErdosGallai
def MainStatement : Prop :=
β C : β, 0 < C β§ β (n : β) (G : SimpleGraph (Fin n)),
β k : β, EdgeDecomposition G k β§ (k : β) β€ C * n
end ErdosGallai
end
end
end OAI
|