File size: 9,400 Bytes
a2ee19a | 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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | import OAI.Probability.RadialTransition.ShellGeometry
namespace OAI
universe uV
noncomputable section
open scoped BigOperators NNReal ContDiff ENNReal
open Filter MeasureTheory Set
namespace RadialTransition
def clamp01 (x : ℝ) : ℝ := max 0 (min 1 x)
theorem clamp01_nonneg (x : ℝ) : 0 ≤ clamp01 x := le_max_left _ _
theorem clamp01_le_one (x : ℝ) : clamp01 x ≤ 1 :=
max_le (by norm_num) (min_le_left _ _)
theorem clamp01_eq_zero {x : ℝ} (hx : x ≤ 0) : clamp01 x = 0 := by
exact max_eq_left (le_trans (min_le_right _ _) hx)
theorem clamp01_eq_one {x : ℝ} (hx : 1 ≤ x) : clamp01 x = 1 := by
simp [clamp01, min_eq_left hx]
theorem clamp01_mono : Monotone clamp01 := by
intro x y hxy
exact max_le_max le_rfl (min_le_min le_rfl hxy)
theorem continuous_clamp01 : Continuous clamp01 := by
unfold clamp01
fun_prop
def microLength (t : ℝ) : ℝ := Real.exp (-t)
def shellStep (t : ℝ) : ℝ := microLength t / 3000
def coreReal (t r : ℝ) : ℝ :=
t ^ 2 * min
(1 - clamp01 ((r - microLength t) / shellStep t) +
clamp01 ((r - microLength t - 2 * shellStep t) / shellStep t))
(clamp01 (1 + t * (1 - r)))
def corePotential (t : ℝ) : Potential := fun r => coreReal t r
theorem microLength_pos (t : ℝ) : 0 < microLength t := Real.exp_pos _
theorem shellStep_pos (t : ℝ) : 0 < shellStep t := div_pos (microLength_pos t) (by norm_num)
theorem coreReal_nonneg (t r : ℝ) : 0 ≤ coreReal t r := by
apply mul_nonneg (sq_nonneg t)
apply le_min
· linarith [clamp01_le_one ((r - microLength t) / shellStep t),
clamp01_nonneg ((r - microLength t - 2 * shellStep t) / shellStep t)]
· exact clamp01_nonneg _
theorem coreReal_le (t r : ℝ) : coreReal t r ≤ t ^ 2 := by
have hh : min
(1 - clamp01 ((r - microLength t) / shellStep t) +
clamp01 ((r - microLength t - 2 * shellStep t) / shellStep t))
(clamp01 (1 + t * (1 - r))) ≤ 1 :=
(min_le_right _ _).trans (clamp01_le_one _)
simpa only [coreReal, mul_one] using mul_le_mul_of_nonneg_left hh (sq_nonneg t)
theorem continuous_coreReal (t : ℝ) : Continuous (coreReal t) := by
unfold coreReal
exact continuous_const.mul
(((continuous_const.sub (continuous_clamp01.comp
((continuous_id.sub continuous_const).div_const _))).add
(continuous_clamp01.comp
(((continuous_id.sub continuous_const).sub continuous_const).div_const _))).min
(continuous_clamp01.comp
(continuous_const.add (continuous_const.mul (continuous_const.sub continuous_id)))))
theorem continuous_corePotential (t : ℝ) : Continuous (corePotential t) :=
(continuous_coreReal t).comp NNReal.continuous_coe
theorem bounded_corePotential (t : ℝ) : IsBoundedPotential (corePotential t) := by
refine ⟨t ^ 2, sq_nonneg t, fun r => ?_⟩
change |coreReal t r| ≤ t ^ 2
rw [abs_of_nonneg (coreReal_nonneg t r)]
exact coreReal_le t r
theorem coreReal_zero_plateau (t r : ℝ)
(hlo : microLength t + shellStep t ≤ r)
(hhi : r ≤ microLength t + 2 * shellStep t) : coreReal t r = 0 := by
have hd := shellStep_pos t
have hdown : clamp01 ((r - microLength t) / shellStep t) = 1 :=
clamp01_eq_one ((le_div_iff₀ hd).mpr (by linarith))
have hup : clamp01 ((r - microLength t - 2 * shellStep t) / shellStep t) = 0 :=
clamp01_eq_zero (div_nonpos_of_nonpos_of_nonneg (by linarith) hd.le)
simp only [coreReal, hdown, hup, sub_self, add_zero,
min_eq_left (clamp01_nonneg _), mul_zero]
theorem coreReal_zero_outer {t r : ℝ} (ht : 0 < t) (hr : 1 + 1 / t ≤ r) :
coreReal t r = 0 := by
have hc : clamp01 (1 + t * (1 - r)) = 0 := by
apply clamp01_eq_zero
have hm := mul_le_mul_of_nonneg_left hr ht.le
have hd := div_mul_cancel₀ (1 : ℝ) (ne_of_gt ht)
nlinarith [hm, hd]
have hs : 0 ≤ 1 - clamp01 ((r - microLength t) / shellStep t) +
clamp01 ((r - microLength t - 2 * shellStep t) / shellStep t) := by
linarith [clamp01_le_one ((r - microLength t) / shellStep t),
clamp01_nonneg ((r - microLength t - 2 * shellStep t) / shellStep t)]
simp only [coreReal, hc, min_eq_right hs, mul_zero]
theorem coreReal_full_left {t r : ℝ} (ht : 0 ≤ t)
(hl : r ≤ microLength t) (hr : r ≤ 1) : coreReal t r = t ^ 2 := by
have hd := shellStep_pos t
have hdown : clamp01 ((r - microLength t) / shellStep t) = 0 :=
clamp01_eq_zero (div_nonpos_of_nonpos_of_nonneg (by linarith) hd.le)
have hup : clamp01 ((r - microLength t - 2 * shellStep t) / shellStep t) = 0 :=
clamp01_eq_zero (div_nonpos_of_nonpos_of_nonneg (by linarith) hd.le)
have hc : clamp01 (1 + t * (1 - r)) = 1 :=
clamp01_eq_one (by nlinarith [mul_nonneg ht (sub_nonneg.mpr hr)])
simp [coreReal, hdown, hup, hc]
theorem coreReal_full_right {t r : ℝ} (ht : 0 ≤ t)
(hl : microLength t + 3 * shellStep t ≤ r) (hr : r ≤ 1) :
coreReal t r = t ^ 2 := by
have hd := shellStep_pos t
have hdown : clamp01 ((r - microLength t) / shellStep t) = 1 :=
clamp01_eq_one ((le_div_iff₀ hd).mpr (by linarith))
have hup : clamp01 ((r - microLength t - 2 * shellStep t) / shellStep t) = 1 :=
clamp01_eq_one ((le_div_iff₀ hd).mpr (by linarith))
have hc : clamp01 (1 + t * (1 - r)) = 1 :=
clamp01_eq_one (by nlinarith [mul_nonneg ht (sub_nonneg.mpr hr)])
simp [coreReal, hdown, hup, hc]
theorem coreReal_full_of_not_shell {t r : ℝ} (ht : 0 ≤ t) (hr : r ≤ 1)
(hs : ¬(microLength t ≤ r ∧ r ≤ (1 + (1 : ℝ) / 1000) * microLength t)) :
coreReal t r = t ^ 2 := by
by_cases hlo : microLength t ≤ r
· apply coreReal_full_right ht ?_ hr
have hhi : (1 + (1 : ℝ) / 1000) * microLength t < r :=
lt_of_not_ge (fun hh => hs ⟨hlo, hh⟩)
dsimp [shellStep]
linarith [hhi]
· exact coreReal_full_left ht (le_of_not_ge hlo) hr
theorem twice_pair_sum {N : ℕ} (F : Fin N → Fin N → ℝ)
(hF : ∀ i j, F i j = F j i) :
2 * (∑ i, ∑ j with i < j, F i j) =
∑ i, ∑ j, if i ≠ j then F i j else 0 := by
classical
simp only [Finset.sum_filter]
have hswap : (∑ i, ∑ j, if j < i then F i j else 0) =
∑ i, ∑ j, if i < j then F i j else 0 := by
rw [Finset.sum_comm]
apply Finset.sum_congr rfl
intro i _
apply Finset.sum_congr rfl
intro j _
rw [hF j i]
calc
2 * (∑ i, ∑ j, if i < j then F i j else 0) =
(∑ i, ∑ j, if i < j then F i j else 0) +
(∑ i, ∑ j, if j < i then F i j else 0) := by rw [hswap]; ring
_ = _ := by
rw [← Finset.sum_add_distrib]
apply Finset.sum_congr rfl
intro i _
rw [← Finset.sum_add_distrib]
apply Finset.sum_congr rfl
intro j _
rcases lt_trichotomy i j with h | h | h
· simp [h, ne_of_lt h, not_lt_of_ge h.le]
· simp [h]
· simp [h, ne_of_gt h, not_lt_of_ge h.le]
theorem sum_adj_indicator {V : Type uV} [Fintype V] (G : SimpleGraph V)
[DecidableRel G.Adj] :
(∑ i, ∑ j, if G.Adj i j then (1 : ℝ) else 0) = 2 * G.edgeFinset.card := by
classical
have hi (i : V) : (∑ j, if G.Adj i j then (1 : ℝ) else 0) = G.degree i := by
rw [← G.card_neighborFinset_eq_degree, G.neighborFinset_eq_filter]
simp
simp_rw [hi]
exact_mod_cast G.sum_degrees_eq_twice_card_edges
theorem core_energy_lower_small_diameter {N : ℕ} {t : ℝ} (ht : 0 ≤ t)
(x : Fin N → Position) (hx : ∀ i j, dist (x i) (x j) ≤ 1) :
t ^ 2 / 8 * (N : ℝ) ^ 2 - t ^ 2 / 2 * N ≤ energy (corePotential t) x := by
classical
let G := shellGraph x (microLength t)
have hG : G.CliqueFree 5 := shellGraph_cliqueFree x (microLength_pos t)
have hbound : (8 : ℝ) * G.edgeFinset.card ≤ 3 * (N : ℝ) ^ 2 := by
have hh : 8 * G.edgeFinset.card ≤ 3 * N ^ 2 := by
simpa using shell_edge_bound G hG
exact_mod_cast hh
have hpair := twice_pair_sum
(fun i j => coreReal t (dist (x i) (x j))) (fun i j => by rw [dist_comm])
have heq : (∑ i, ∑ j with i < j, coreReal t (dist (x i) (x j))) =
energy (corePotential t) x := by rfl
rw [heq] at hpair
have hterm (i j : Fin N) :
t ^ 2 * ((if i ≠ j then (1 : ℝ) else 0) - (if G.Adj i j then 1 else 0)) ≤
(if i ≠ j then coreReal t (dist (x i) (x j)) else 0) := by
by_cases hij : i = j
· subst j
simp
· simp only [ite_eq_left hij]
by_cases hA : G.Adj i j
· simp only [hA, ite_true, sub_self, mul_zero]
exact coreReal_nonneg _ _
· simp only [hA, ite_false, sub_zero, mul_one]
rw [coreReal_full_of_not_shell ht (hx i j)]
intro h
exact hA ⟨hij, h⟩
have hsum := Finset.sum_le_sum (s := Finset.univ) fun i _ =>
Finset.sum_le_sum (s := Finset.univ) fun j _ => hterm i j
have hcount : (∑ i : Fin N, ∑ j : Fin N, if i ≠ j then (1 : ℝ) else 0) =
(N : ℝ) ^ 2 - N := by
have hite (i j : Fin N) : (if i ≠ j then (1 : ℝ) else 0) =
1 - (if i = j then 1 else 0) := by by_cases h : i = j <;> simp [h]
simp_rw [hite]
simp only [Finset.sum_sub_distrib, Finset.sum_const, Finset.card_univ,
Fintype.card_fin, nsmul_eq_mul, mul_one, Finset.sum_ite_eq,
Finset.mem_univ, ite_true]
ring
simp only [mul_sub, Finset.sum_sub_distrib, ← Finset.mul_sum] at hsum
rw [hcount, sum_adj_indicator G, ← hpair] at hsum
have hb := mul_le_mul_of_nonneg_left hbound (sq_nonneg t)
nlinarith [hsum, hb]
end RadialTransition
end
end OAI
|