Download data/lean/OAI/Probability/RadialTransition/CellStability.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.06 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/RadialTransition/CellStability.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/RadialTransition/CellStability.lean
-
curl -L -o CellStability.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/RadialTransition/CellStability.lean
9.06 kB
| import OAI.Probability.RadialTransition.RadialKernel | |
| namespace OAI | |
| universe uI uV | |
| noncomputable section | |
| open scoped BigOperators NNReal ContDiff ENNReal | |
| open Filter MeasureTheory Set | |
| namespace RadialTransition | |
| theorem symmetric_row_quadratic {I : Type uI} [Fintype I] (J : I β I β β) (n : I β β) (M : β) | |
| (hJ : β i j, 0 β€ J i j) (hsymm : β i j, J i j = J j i) | |
| (hrow : β i, β j, J i j β€ M) : | |
| β i, β j, J i j * n i * n j β€ M * β i, (n i) ^ 2 := by | |
| have ht (i j : I) : 2 * (J i j * n i * n j) β€ | |
| J i j * (n i ^ 2 + n j ^ 2) := by | |
| nlinarith [mul_nonneg (hJ i j) (sq_nonneg (n i - n j))] | |
| have hl := Finset.sum_le_sum (s := Finset.univ) fun i _ => | |
| Finset.sum_le_sum (s := Finset.univ) fun j _ => ht i j | |
| have hs : (β i, β j, J i j * n j ^ 2) = β i, β j, J i j * n i ^ 2 := by | |
| rw [Finset.sum_comm] | |
| congr 1 | |
| funext i | |
| congr 1 | |
| funext j | |
| rw [hsymm] | |
| simp only [mul_add, Finset.sum_add_distrib, β Finset.mul_sum] at hl | |
| rw [hs] at hl | |
| have hb : (β i, β j, J i j * n i ^ 2) β€ M * β i, n i ^ 2 := by | |
| rw [Finset.mul_sum] | |
| apply Finset.sum_le_sum | |
| intro i _ | |
| rw [β Finset.sum_mul] | |
| exact mul_le_mul_of_nonneg_right (hrow i) (sq_nonneg _) | |
| linarith | |
| theorem core_ordered_lower_small_diameter {V : Type uV} [Fintype V] [DecidableEq V] {t : β} (ht : 0 β€ t) | |
| (x : V β Position) (hx : β i j, dist (x i) (x j) β€ 1) : | |
| t ^ 2 / 4 * (Fintype.card V : β) ^ 2 - t ^ 2 * Fintype.card V β€ | |
| β i, β j, if i β j then coreReal t (dist (x i) (x j)) else 0 := 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 * (Fintype.card V : β) ^ 2 := by | |
| have hh : 8 * G.edgeFinset.card β€ 3 * Fintype.card V ^ 2 := by | |
| simpa using shell_edge_bound G hG | |
| exact_mod_cast hh | |
| have hterm (i j : V) : | |
| 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 : V, β j : V, if i β j then (1 : β) else 0) = | |
| (Fintype.card V : β) ^ 2 - Fintype.card V := by | |
| have hite (i j : V) : (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, | |
| 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] at hsum | |
| have hb := mul_le_mul_of_nonneg_left hbound (sq_nonneg t) | |
| nlinarith [hsum, hb] | |
| def occupation {V : Type uV} {I : Type uI} [Fintype V] (q : V β I) (i : I) : β := by | |
| classical | |
| exact (Fintype.card {a : V // q a = i} : β) | |
| theorem sum_occupation {V : Type uV} {I : Type uI} [Fintype V] [Fintype I] (q : V β I) : | |
| β i, occupation q i = Fintype.card V := by | |
| classical | |
| simpa [occupation] using Fintype.sum_fiberwise q (fun _ => (1 : β)) | |
| theorem sum_subtype_le_of_nonneg {V : Type uV} [Fintype V] (p : V β Prop) | |
| (f : V β β) (hf : β a, 0 β€ f a) : | |
| (by classical exact β a : {a // p a}, f a) β€ β a, f a := by | |
| classical | |
| have hh := Fintype.sum_subtype_add_sum_subtype p f | |
| have hz : 0 β€ β a : {a // Β¬p a}, f a := Finset.sum_nonneg (fun a _ => hf a) | |
| linarith | |
| theorem core_ordered_cells {V : Type uV} {I : Type uI} [Fintype V] [Fintype I] [DecidableEq V] | |
| {t : β} (ht : 0 β€ t) (q : V β I) (x : V β Position) | |
| (c : V β V β β) (hc : β a b, 0 β€ c a b) | |
| (hsame : β a b, q a = q b β c a b = 1) | |
| (hdiam : β a b, q a = q b β dist (x a) (x b) β€ 1) : | |
| t ^ 2 / 4 * (β i, occupation q i ^ 2) - t ^ 2 * Fintype.card V β€ | |
| β a, β b, if a β b then c a b * coreReal t (dist (x a) (x b)) else 0 := by | |
| classical | |
| let F (a b : V) := if a β b then c a b * coreReal t (dist (x a) (x b)) else 0 | |
| have hF (a b : V) : 0 β€ F a b := by | |
| exact ite_nonneg (mul_nonneg (hc a b) (coreReal_nonneg _ _)) le_rfl | |
| have hlocal (i : I) : t ^ 2 / 4 * occupation q i ^ 2 - t ^ 2 * occupation q i β€ | |
| β a : {a // q a = i}, β b, F a b := by | |
| have hl := core_ordered_lower_small_diameter ht (fun a : {a // q a = i} => x a) | |
| (fun a b => hdiam a b (a.property.trans b.property.symm)) | |
| change t ^ 2 / 4 * occupation q i ^ 2 - t ^ 2 * occupation q i β€ _ at hl | |
| apply hl.trans | |
| apply Finset.sum_le_sum | |
| intro a _ | |
| have heq : (β b : {b // q b = i}, | |
| if a β b then coreReal t (dist (x a) (x b)) else 0) = | |
| β b : {b // q b = i}, F a b := by | |
| apply Finset.sum_congr rfl | |
| intro b _ | |
| by_cases hab : a = b | |
| Β· subst b; simp [F] | |
| Β· have hab' : (a : V) β (b : V) := fun hh => hab (Subtype.ext hh) | |
| simp [F, hab, hab', hsame a b (a.property.trans b.property.symm)] | |
| rw [heq] | |
| exact sum_subtype_le_of_nonneg (fun b => q b = i) (F a) (hF a) | |
| have hs := Finset.sum_le_sum (s := Finset.univ) (fun i _ => hlocal i) | |
| rw [Fintype.sum_fiberwise q (fun a => β b, F a b)] at hs | |
| simpa only [Finset.sum_sub_distrib, β Finset.mul_sum, sum_occupation] using hs | |
| theorem sum_by_occupation {V : Type uV} {I : Type uI} [Fintype V] [Fintype I] | |
| (q : V β I) (f : I β β) : | |
| (β a, f (q a)) = β i, occupation q i * f i := by | |
| classical | |
| rw [β Fintype.sum_fiberwise q (fun a => f (q a))] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| have heq : (fun a : {a // q a = i} => f (q a)) = (fun _ => f i) := by | |
| funext a | |
| rw [a.property] | |
| rw [heq] | |
| simp [occupation] | |
| theorem lifted_row_quadratic {V : Type uV} {I : Type uI} [Fintype V] [Fintype I] | |
| (q : V β I) (J : I β I β β) {M : β} | |
| (hJ : β i j, 0 β€ J i j) (hJsy : β i j, J i j = J j i) | |
| (hrow : β i, β j, J i j β€ M) : | |
| (β a, β b, J (q a) (q b)) β€ M * β i, occupation q i ^ 2 := by | |
| classical | |
| have heq : (β a, β b, J (q a) (q b)) = | |
| β i, β j, J i j * occupation q i * occupation q j := by | |
| calc | |
| _ = β a, β j, occupation q j * J (q a) j := by | |
| apply Finset.sum_congr rfl | |
| intro a _ | |
| exact sum_by_occupation q (J (q a)) | |
| _ = β i, occupation q i * β j, occupation q j * J i j := | |
| sum_by_occupation q (fun i => β j, occupation q j * J i j) | |
| _ = _ := by | |
| simp only [Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| apply Finset.sum_congr rfl | |
| intro j _ | |
| ring | |
| rw [heq] | |
| exact symmetric_row_quadratic J (occupation q) M hJ hJsy hrow | |
| theorem modified_energy_cell_bound {N : β} {I : Type uI} [Fintype I] | |
| {t M : β} (ht : 0 β€ t) (q : Fin N β I) (x : Fin N β Position) | |
| (c K : Fin N β Fin N β β) (J : I β I β β) | |
| (hc : β a b, 0 β€ c a b) (hcsy : β a b, c a b = c b a) | |
| (hsame : β a b, q a = q b β c a b = 1) | |
| (hdiam : β a b, q a = q b β dist (x a) (x b) β€ 1) | |
| (hK : β a b, 0 β€ K a b) (hKsy : β a b, K a b = K b a) | |
| (hKJ : β a b, K a b β€ J (q a) (q b)) | |
| (hJ : β i j, 0 β€ J i j) (hJsy : β i j, J i j = J j i) | |
| (hrow : β i, β j, J i j β€ M) : | |
| (t ^ 2 / 8 - M / 2) * (β i, occupation q i ^ 2) - t ^ 2 / 2 * N β€ | |
| β a, β b with a < b, (c a b * coreReal t (dist (x a) (x b)) - K a b) := by | |
| classical | |
| have hcore := core_ordered_cells ht q x c hc hsame hdiam | |
| have hrow' := lifted_row_quadratic q J hJ hJsy hrow | |
| have hatt : (β a, β b, if a β b then K a b else 0) β€ | |
| M * β i, occupation q i ^ 2 := by | |
| apply le_trans ?_ hrow' | |
| apply Finset.sum_le_sum | |
| intro a _ | |
| apply Finset.sum_le_sum | |
| intro b _ | |
| apply le_trans ?_ (hKJ a b) | |
| split_ifs | |
| Β· exact le_rfl | |
| Β· exact hK a b | |
| have hpair := twice_pair_sum | |
| (fun a b => c a b * coreReal t (dist (x a) (x b)) - K a b) | |
| (fun a b => by rw [hcsy a b, dist_comm (x a), hKsy a b]) | |
| have heq : (β a, β b, if a β b then | |
| c a b * coreReal t (dist (x a) (x b)) - K a b else 0) = | |
| (β a, β b, if a β b then c a b * coreReal t (dist (x a) (x b)) else 0) - | |
| (β a, β b, if a β b then K a b else 0) := by | |
| rw [β Finset.sum_sub_distrib] | |
| apply Finset.sum_congr rfl | |
| intro a _ | |
| rw [β Finset.sum_sub_distrib] | |
| apply Finset.sum_congr rfl | |
| intro b _ | |
| by_cases hab : a = b <;> simp [hab] | |
| rw [heq] at hpair | |
| simp only [Fintype.card_fin] at hcore | |
| nlinarith | |
| end RadialTransition | |
| end | |
| end OAI | |