Download data/lean/OAI/Probability/FreeIsing/Estimates/ComponentPairCount.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 10 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Estimates/ComponentPairCount.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/FreeIsing/Estimates/ComponentPairCount.lean
-
curl -L -o ComponentPairCount.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Estimates/ComponentPairCount.lean
10 kB
| import OAI.Probability.FreeIsing.Trees.Shells | |
| namespace OAI | |
| noncomputable section | |
| namespace Problem367 | |
| def componentPairWeight {d : β} (r : β) : List (Fin d) β List (Fin d) β β | |
| | [], v => r ^ v.length | |
| | _ :: u, [] => r ^ (u.length + 1) | |
| | a :: u, b :: v => | |
| if a = b then r * componentPairWeight r u v else r ^ (u.length + v.length + 2) | |
| def componentPairSum {d : β} (r : β) (c : Fin d) (k l : β) : β := | |
| β u : ReducedTail c k, β v : ReducedTail c l, componentPairWeight r u.1 v.1 | |
| private theorem tail_length {d : β} {c : Fin d} {n : β} (w : ReducedTail c n) : | |
| w.1.length = n := w.2.1 | |
| @[simp] theorem componentPairSum_zero_left {d : β} (r : β) (c : Fin d) (l : β) : | |
| componentPairSum r c 0 l = (((d - 1 : β) : β) * r) ^ l := by | |
| unfold componentPairSum | |
| rw [sum_reducedTail_zero c (fun u => | |
| β v : ReducedTail c l, componentPairWeight r u v.1)] | |
| simp only [componentPairWeight, tail_length, Finset.sum_const, Finset.card_univ, | |
| nsmul_eq_mul, card_reducedTail, Nat.cast_pow, mul_pow] | |
| @[simp] theorem componentPairSum_zero_right {d : β} (r : β) (c : Fin d) (k : β) : | |
| componentPairSum r c k 0 = (((d - 1 : β) : β) * r) ^ k := by | |
| unfold componentPairSum | |
| simp_rw [sum_reducedTail_zero] | |
| have hnil (u : List (Fin d)) : componentPairWeight r u [] = r ^ u.length := by | |
| cases u <;> simp [componentPairWeight] | |
| simp only [hnil, tail_length, Finset.sum_const, Finset.card_univ, | |
| nsmul_eq_mul, card_reducedTail, Nat.cast_pow, mul_pow] | |
| private theorem sum_diagonal_constant {A : Type*} [Fintype A] [DecidableEq A] (F : A β β) (C : β) : | |
| (β a : A, β b : A, if a = b then F a else C) = | |
| (β a : A, F a) + (Fintype.card A : β) * (Fintype.card A - 1 : β) * C := by | |
| classical | |
| have hrow (a : A) : (β b : A, if a = b then F a else C) = | |
| F a + (Fintype.card A - 1 : β) * C := by | |
| rw [β Finset.add_sum_erase Finset.univ _ (Finset.mem_univ a)] | |
| simp only [ite_true] | |
| rw [Finset.sum_congr rfl (fun b hb => | |
| ite_eq_right (Ne.symm (Finset.mem_erase.mp hb).1))] | |
| simp | |
| simp_rw [hrow] | |
| simp [Finset.sum_add_distrib, mul_assoc] | |
| theorem componentPairSum_succ {d : β} (r : β) (c : Fin d) (k l : β) : | |
| componentPairSum r c (k + 1) (l + 1) = | |
| r * (β a : {a : Fin d // c β a}, componentPairSum r a.1 k l) + | |
| ((d - 1 : β) : β) * ((d - 1 : β) - 1 : β) * | |
| (((d - 1 : β) : β) ^ k * ((d - 1 : β) : β) ^ l * r ^ (k + l + 2)) := by | |
| classical | |
| have hc : Fintype.card {a : Fin d // c β a} = d - 1 := by | |
| simp | |
| have hinner (a b : {a : Fin d // c β a}) : | |
| (β u : ReducedTail a.1 k, β v : ReducedTail b.1 l, | |
| componentPairWeight r (a.1 :: u.1) (b.1 :: v.1)) = | |
| if a = b then r * componentPairSum r a.1 k l else | |
| ((d - 1 : β) : β) ^ k * ((d - 1 : β) : β) ^ l * r ^ (k + l + 2) := by | |
| by_cases hab : a = b | |
| Β· subst b | |
| simp only [componentPairWeight, ite_true, componentPairSum] | |
| simp_rw [β Finset.mul_sum] | |
| Β· have hab' : a.1 β b.1 := fun h => hab (Subtype.ext h) | |
| simp only [ite_eq_right hab, componentPairWeight, ite_eq_right hab', tail_length, | |
| Finset.sum_const, Finset.card_univ, nsmul_eq_mul, card_reducedTail, Nat.cast_pow] | |
| ring | |
| change (β u : ReducedTail c (k + 1), β v : ReducedTail c (l + 1), | |
| componentPairWeight r u.1 v.1) = _ | |
| rw [sum_reducedTail_succ c k (fun u => | |
| β v : ReducedTail c (l + 1), componentPairWeight r u v.1)] | |
| simp_rw [sum_reducedTail_succ c l] | |
| have hcomm : | |
| (β a : {a : Fin d // c β a}, β u : ReducedTail a.1 k, | |
| β b : {a : Fin d // c β a}, β v : ReducedTail b.1 l, | |
| componentPairWeight r (a.1 :: u.1) (b.1 :: v.1)) = | |
| β a : {a : Fin d // c β a}, β b : {a : Fin d // c β a}, | |
| β u : ReducedTail a.1 k, β v : ReducedTail b.1 l, | |
| componentPairWeight r (a.1 :: u.1) (b.1 :: v.1) := by | |
| apply Finset.sum_congr rfl | |
| intro a _ | |
| rw [Finset.sum_comm] | |
| rw [hcomm] | |
| simp_rw [hinner] | |
| rw [sum_diagonal_constant] | |
| simp only [hc, β Finset.mul_sum] | |
| theorem componentPairSum_critical {d : β} (r : β) (c : Fin d) | |
| (hcritical : ((d - 1 : β) : β) * r = 1) (k l : β) : | |
| componentPairSum r c k l = 1 + (min k l : β) * (1 - r) := by | |
| have hb : 1 β€ d - 1 := by | |
| by_contra h | |
| have hz : d - 1 = 0 := by omega | |
| norm_num [hz] at hcritical | |
| have hc (a : Fin d) : Fintype.card {b : Fin d // a β b} = d - 1 := by | |
| simp | |
| induction k generalizing c l with | |
| | zero => simp [hcritical] | |
| | succ k ih => | |
| cases l with | |
| | zero => simp [hcritical] | |
| | succ l => | |
| rw [componentPairSum_succ] | |
| simp_rw [ih] | |
| have hcross : | |
| ((d - 1 : β) : β) * ((d - 1 : β) - 1 : β) * | |
| (((d - 1 : β) : β) ^ k * ((d - 1 : β) : β) ^ l * r ^ (k + l + 2)) = | |
| 1 - r := by | |
| rw [Nat.cast_sub hb] | |
| calc | |
| _ = ((((d - 1 : β) : β) * r) - r) * | |
| ((((d - 1 : β) : β) * r) ^ (k + l + 1)) := by | |
| simp only [pow_add, pow_one, pow_two, mul_pow] | |
| ring | |
| _ = 1 - r := by simp [hcritical] | |
| rw [hcross] | |
| simp only [Finset.sum_const, Finset.card_univ, hc, nsmul_eq_mul] | |
| rw [β mul_assoc, mul_comm r, hcritical, one_mul] | |
| have hmin : min (k + 1) (l + 1) = min k l + 1 := by omega | |
| simp only [hmin, Nat.cast_add, Nat.cast_one] | |
| ring | |
| theorem componentPairSum_critical_le {d : β} (r : β) (c : Fin d) | |
| (hcritical : ((d - 1 : β) : β) * r = 1) (k l : β) : | |
| componentPairSum r c k l β€ (min k l : β) + 1 := by | |
| have hr : 0 β€ r := by | |
| by_contra h | |
| have hp := mul_nonpos_of_nonneg_of_nonpos | |
| (Nat.cast_nonneg (d - 1) : (0 : β) β€ _) (le_of_lt (lt_of_not_ge h)) | |
| linarith | |
| rw [componentPairSum_critical r c hcritical] | |
| have hm : (0 : β) β€ (min k l : β) := Nat.cast_nonneg _ | |
| nlinarith [mul_nonneg hm hr] | |
| theorem sum_componentPairSum_critical_le {d : β} (r : β) (c : Fin d) | |
| (hcritical : ((d - 1 : β) : β) * r = 1) (n : β) : | |
| (β k β Finset.range (n + 1), β l β Finset.range (n + 1), componentPairSum r c k l) β€ | |
| (n + 1 : β) ^ 3 := by | |
| calc | |
| _ β€ β _k β Finset.range (n + 1), β _l β Finset.range (n + 1), (n + 1 : β) := by | |
| apply Finset.sum_le_sum | |
| intro k hk | |
| apply Finset.sum_le_sum | |
| intro l hl | |
| have hk' : k β€ n := Nat.le_of_lt_succ (Finset.mem_range.mp hk) | |
| have hmin : (min k l : β) β€ n := (Nat.min_le_left _ _).trans hk' | |
| have hmin' : ((min k l : β) : β) β€ n := by exact_mod_cast hmin | |
| exact (componentPairSum_critical_le r c hcritical k l).trans (by linarith) | |
| _ = _ := by simp; ring | |
| def componentWordDistance {Ξ± : Type*} [DecidableEq Ξ±] : List Ξ± β List Ξ± β β | |
| | [], v => v.length | |
| | _ :: u, [] => u.length + 1 | |
| | a :: u, b :: v => | |
| if a = b then componentWordDistance u v else u.length + v.length + 2 | |
| theorem componentPairWeight_eq_pow_distance {d : β} (theta : β) | |
| (u v : List (Fin d)) : | |
| componentPairWeight (theta ^ 2) u v = | |
| theta ^ (u.length + v.length + componentWordDistance u v) := by | |
| induction u generalizing v with | |
| | nil => | |
| simp only [componentPairWeight, componentWordDistance, List.length_nil, zero_add] | |
| rw [β pow_mul] | |
| congr 1 | |
| omega | |
| | cons a u ih => | |
| cases v with | |
| | nil => | |
| simp only [componentPairWeight, componentWordDistance, List.length_nil, | |
| List.length_cons, add_zero] | |
| rw [β pow_mul] | |
| congr 1 | |
| omega | |
| | cons b v => | |
| by_cases hab : a = b | |
| Β· simp only [componentPairWeight, componentWordDistance, ite_eq_left hab, List.length_cons] | |
| rw [ih, β pow_add] | |
| congr 1 | |
| omega | |
| Β· simp only [componentPairWeight, componentWordDistance, ite_eq_right hab, List.length_cons] | |
| rw [β pow_mul] | |
| congr 1 | |
| omega | |
| theorem componentPairWeight_eq_weighted_correlation {d : β} (theta : β) | |
| (u v : List (Fin d)) : | |
| componentPairWeight (theta ^ 2) u v = | |
| theta ^ u.length * theta ^ v.length * theta ^ componentWordDistance u v := by | |
| rw [componentPairWeight_eq_pow_distance, pow_add, pow_add] | |
| theorem sum_component_weighted_correlation_critical {d : β} (theta : β) (c : Fin d) | |
| (hcritical : ((d - 1 : β) : β) * theta ^ 2 = 1) (k l : β) : | |
| (β u : ReducedTail c k, β v : ReducedTail c l, | |
| theta ^ k * theta ^ l * theta ^ componentWordDistance u.1 v.1) = | |
| 1 + (min k l : β) * (1 - theta ^ 2) := by | |
| simpa only [componentPairSum, componentPairWeight_eq_weighted_correlation, tail_length] | |
| using componentPairSum_critical (theta ^ 2) c hcritical k l | |
| theorem sum_component_weighted_correlation_critical_le {d : β} (theta : β) (c : Fin d) | |
| (hcritical : ((d - 1 : β) : β) * theta ^ 2 = 1) (n : β) : | |
| (β k β Finset.range (n + 1), β l β Finset.range (n + 1), | |
| β u : ReducedTail c k, β v : ReducedTail c l, | |
| theta ^ k * theta ^ l * theta ^ componentWordDistance u.1 v.1) β€ | |
| (n + 1 : β) ^ 3 := by | |
| simpa only [componentPairSum, componentPairWeight_eq_weighted_correlation, tail_length] | |
| using sum_componentPairSum_critical_le (theta ^ 2) c hcritical n | |
| theorem sum_component_radial_sq_critical {d : β} (theta : β) (c : Fin d) | |
| (hcritical : ((d - 1 : β) : β) * theta ^ 2 = 1) (k : β) : | |
| (β u : ReducedTail c k, (theta ^ u.1.length) ^ 2) = 1 := by | |
| simp only [tail_length, Finset.sum_const, Finset.card_univ, card_reducedTail, | |
| nsmul_eq_mul, Nat.cast_pow] | |
| rw [β pow_mul, Nat.mul_comm k 2, pow_mul, β mul_pow, hcritical, one_pow] | |
| theorem sum_component_radial_sq_levels_critical {d : β} (theta : β) (c : Fin d) | |
| (hcritical : ((d - 1 : β) : β) * theta ^ 2 = 1) (n : β) : | |
| (β k β Finset.range (n + 1), β u : ReducedTail c k, (theta ^ u.1.length) ^ 2) = | |
| (n + 1 : β) := by | |
| simp [sum_component_radial_sq_critical theta c hcritical] | |
| end Problem367 | |
| end | |
| end OAI | |