Download data/lean/OAI/Geometry/PinnedDistances/LogBounds.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 19.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/PinnedDistances/LogBounds.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Geometry/PinnedDistances/LogBounds.lean
-
curl -L -o LogBounds.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/PinnedDistances/LogBounds.lean
19.4 kB
| import OAI.Geometry.PinnedDistances.WeightedSelection | |
| namespace OAI | |
| universe u1 u2 u3 u4 u5 u6 | |
| section | |
| /- Finite log-distance normalization. The diagonal is excluded in the energy | |
| and counted explicitly, with mass 1/n, in the ball estimate. -/ | |
| noncomputable section | |
| open scoped BigOperators | |
| namespace WeakPinned.Bounded | |
| variable {P : Type u1} [Fintype P] [DecidableEq P] | |
| def logCost (u : P β β) (x y : P) : β := | |
| if x=y then 0 else |Real.log βu x-u yβ| | |
| def logAverage (u : P β β) : β := | |
| (β x, β y, logCost u x y)/((Fintype.card P : β)*((Fintype.card P : β)-1)) | |
| omit [Fintype P] in | |
| lemma logCost_nonneg (u : P β β) (x y : P) : 0 β€ logCost u x y := by | |
| unfold logCost; split_ifs <;> positivity | |
| lemma logAverage_sum_bound (u : P β β) (C : β) (hn : 2 β€ Fintype.card P) | |
| (hC : logAverage u β€ C) : | |
| (β x, β y, logCost u x y) β€ C*(Fintype.card P : β)*((Fintype.card P : β)-1) := by | |
| have hnR : (2:β) β€ Fintype.card P := by exact_mod_cast hn | |
| have hp : 0 < (Fintype.card P : β)*((Fintype.card P : β)-1) := mul_pos (by linarith) (by linarith) | |
| simpa only [mul_assoc] using (div_le_iffβ hp).mp hC | |
| lemma logAverage_nonneg (u : P β β) (hn : 2 β€ Fintype.card P) : 0 β€ logAverage u := by | |
| have hnR : (2:β) β€ Fintype.card P := by exact_mod_cast hn | |
| exact div_nonneg (Finset.sum_nonneg (fun _ _ => Finset.sum_nonneg (fun _ _ => logCost_nonneg _ _ _))) (mul_nonneg (by linarith) (by linarith)) | |
| /-- One actual vertex serves as a tightness center: a row of the nonnegative | |
| distance-log matrix has at most the average row energy. -/ | |
| lemma log_center (u : P β β) (C : β) (hn : 2 β€ Fintype.card P) (hC : logAverage u β€ C) : | |
| β x : P, (β y, logCost u x y) β€ C*(Fintype.card P : β) := by | |
| have hnR : (2:β) β€ Fintype.card P := by exact_mod_cast hn | |
| have hC0 : 0 β€ C := (logAverage_nonneg u hn).trans hC | |
| have hsum := logAverage_sum_bound u C hn hC | |
| by_contra hnot | |
| push Not at hnot | |
| have hpos : Finset.univ.Nonempty (Ξ±:=P) := Finset.card_pos.mp (by simpa using (show 0<Fintype.card P by omega)) | |
| have hs := Finset.sum_lt_sum_of_nonempty hpos (fun x _ => hnot x) | |
| simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] at hs | |
| nlinarith | |
| omit [Fintype P] in | |
| lemma log_cost_large (u : P β β) (R : β) (hR : 1 < R) (x y : P) (hxy : R < βu x-u yβ) : | |
| Real.log R β€ logCost u x y := by | |
| have hne : x β y := by intro he; subst y; simp at hxy; linarith | |
| rw [logCost,ite_eq_right hne] | |
| have hl := Real.log_le_log (by linarith : 0<R) hxy.le | |
| exact hl.trans (le_abs_self _) | |
| /-- A normalized empirical tail bound from the average logarithmic cost. -/ | |
| lemma normalized_tail_card (u : P β β) (C : β) (x : P) | |
| (hx : (β y, logCost u x y) β€ C*(Fintype.card P : β)) | |
| (hn : 2 β€ Fintype.card P) (R : β) (hR : 1 < R) : | |
| ((Finset.univ.filter (fun y => R < βu y-u xβ)).card : β)/(Fintype.card P : β) β€ C/Real.log R := by | |
| let A := Finset.univ.filter (fun y => R < βu y-u xβ) | |
| have hlog := Real.log_pos hR | |
| have hn0 : (0:β)<Fintype.card P := by exact_mod_cast (show 0<Fintype.card P by omega) | |
| have hs : (A.card : β)*Real.log R β€ β y, logCost u x y := by | |
| calc | |
| (A.card : β)*Real.log R = β y β A, Real.log R := by simp | |
| _ β€ β y β A, logCost u x y := by | |
| apply Finset.sum_le_sum | |
| intro y hy | |
| apply log_cost_large u R hR x y | |
| simpa only [norm_sub_rev] using (Finset.mem_filter.mp hy).2 | |
| _ β€ β y, logCost u x y := Finset.sum_le_sum_of_subset_of_nonneg | |
| (Finset.subset_univ _) (fun y _ _ => logCost_nonneg u x y) | |
| apply (div_le_div_iffβ hn0 hlog).mpr | |
| nlinarith | |
| omit [Fintype P] in | |
| lemma log_cost_close (u : P β β) (hu : Function.Injective u) (z : β) (r : β) | |
| (_hr : 0<r) (_hr2 : r<1/2) (x y : P) (hx : βu x-zβ<r) (hy : βu y-zβ<r) (hxy : xβ y) : | |
| -Real.log (2*r) β€ logCost u x y := by | |
| have hne : u x-u y β 0 := sub_ne_zero.mpr (fun h => hxy (hu h)) | |
| have hp := norm_pos_iff.mpr hne | |
| have hd : βu x-u yβ<2*r := by | |
| have hh := norm_sub_le_norm_sub_add_norm_sub (u x) z (u y) | |
| rw [norm_sub_rev z] at hh | |
| linarith | |
| have hh := Real.log_le_log hp hd.le | |
| rw [logCost,ite_eq_right hxy] | |
| have habs := neg_le_abs (Real.log βu x-u yβ) | |
| linarith | |
| /-- The true n^-1 diagonal term in the concentration estimate. The points may | |
| be arbitrarily close; injectivity is the only geometric condition. -/ | |
| lemma small_ball_card (u : P β β) (hu : Function.Injective u) (C : β) | |
| (hn : 2 β€ Fintype.card P) (hC : logAverage u β€ C) (z : β) (r : β) | |
| (hr : 0<r) (hr2 : r<1/2) : | |
| (((Finset.univ.filter (fun x => βu x-zβ<r)).card : β)/(Fintype.card P : β))^2 β€ | |
| 1/(Fintype.card P : β)+C/(-Real.log (2*r)) := by | |
| let A := Finset.univ.filter (fun x => βu x-zβ<r) | |
| let T := -Real.log (2*r) | |
| have hT : 0<T := by dsimp [T]; exact neg_pos.mpr (Real.log_neg (by positivity) (by linarith)) | |
| have hnR : (2:β) β€ Fintype.card P := by exact_mod_cast hn | |
| have hn0 : (0:β)<Fintype.card P := by linarith | |
| have hC0 : 0 β€ C := (logAverage_nonneg u hn).trans hC | |
| have ha : (A.card : β) β€ Fintype.card P := by exact_mod_cast Finset.card_le_univ A | |
| have ha0 : (0:β) β€ A.card := Nat.cast_nonneg _ | |
| have hsum := logAverage_sum_bound u C hn hC | |
| have hpoint : β x y : P, (if xβA β§ yβA β§ xβ y then T else 0) β€ logCost u x y := by | |
| intro x y | |
| split_ifs with h | |
| Β· exact log_cost_close u hu z r hr hr2 x y (Finset.mem_filter.mp h.1).2 | |
| (Finset.mem_filter.mp h.2.1).2 h.2.2 | |
| Β· exact logCost_nonneg _ _ _ | |
| have hs := Finset.sum_le_sum (s:=Finset.univ) (fun x _ => | |
| Finset.sum_le_sum (s:=Finset.univ) (fun y _ => hpoint x y)) | |
| have heq : (β x : P, β y : P, if xβA β§ yβA β§ xβ y then T else 0) = | |
| (A.card : β)*((A.card : β)-1)*T := by | |
| have hrw (x : P) : (β y : P, if xβA β§ yβA β§ xβ y then T else 0) = | |
| if xβA then ((A.card : β)-1)*T else 0 := by | |
| by_cases hx : xβA | |
| Β· simp only [hx,true_and,ite_eq_left] | |
| have hf : Finset.univ.filter (fun y => yβA β§ xβ y)=A.erase x := by | |
| ext y; simp [ne_comm, and_comm] | |
| rw [β Finset.sum_filter,hf,Finset.sum_const,Finset.card_erase_of_mem hx,nsmul_eq_mul] | |
| rw [Nat.cast_sub (Finset.one_le_card.mpr β¨x,hxβ©),Nat.cast_one] | |
| Β· simp [hx] | |
| simp_rw [hrw] | |
| rw [β Finset.sum_filter] | |
| simp only [Finset.filter_mem_eq_inter,Finset.univ_inter,Finset.sum_const,nsmul_eq_mul] | |
| ring | |
| rw [heq] at hs | |
| have hcub : (A.card : β)^2*T β€ (Fintype.card P : β)*T+C*(Fintype.card P : β)^2 := by | |
| have hCT := mul_nonneg hC0 hn0.le | |
| have hAT := mul_le_mul_of_nonneg_right ha hT.le | |
| nlinarith | |
| change ((A.card : β)/(Fintype.card P : β))^2 β€ 1/(Fintype.card P : β)+C/T | |
| rw [div_pow] | |
| apply (div_le_iffβ (sq_pos_of_pos hn0)).mpr | |
| apply (mul_le_mul_iff_leftβ hT).mp | |
| have he : (1/(Fintype.card P : β)+C/T)*(Fintype.card P : β)^2*T = | |
| (Fintype.card P : β)*T+C*(Fintype.card P : β)^2 := by field_simp [ne_of_gt hn0, ne_of_gt hT] | |
| rw [he] | |
| exact hcub | |
| end WeakPinned.Bounded | |
| namespace WeakPinned.Bounded | |
| open Hierarchy Variance Global NumberField MeasureTheory | |
| open scoped BigOperators | |
| lemma weighted_deviation {J : Type u2} [Fintype J] (p f : J β β) (a : β) | |
| (hp : β j, 0β€ p j) (hs : β j, p j=1) : | |
| (β j, p j*|f j-β k, p k*f k|) β€ 2*β j, p j*|f j-a| := by | |
| have hm : |a-β j, p j*f j| β€ β j, p j*|f j-a| := by | |
| have he : a-(β j,p j*f j) = β j,p j*(a-f j) := by | |
| simp only [mul_sub,Finset.sum_sub_distrib,β Finset.sum_mul,hs,one_mul] | |
| rw [he] | |
| refine (Finset.abs_sum_le_sum_abs _ _).trans ?_ | |
| apply Finset.sum_le_sum | |
| intro j _ | |
| rw [abs_mul,abs_of_nonneg (hp j),abs_sub_comm] | |
| calc | |
| _ β€ β j, p j*(|f j-a|+|a-β k,p k*f k|) := by | |
| apply Finset.sum_le_sum | |
| intro j _ | |
| exact mul_le_mul_of_nonneg_left (abs_sub_le (f j) a _) (hp j) | |
| _ = (β j,p j*|f j-a|)+|a-β k,p k*f k| := by | |
| simp only [mul_add,Finset.sum_add_distrib,β Finset.sum_mul,hs,one_mul] | |
| _ β€ _ := by linarith | |
| variable {P : Type u3} [Fintype P] [DecidableEq P] | |
| def pairMean (f : P β P β β) : β := β x, β y, pairProb Finset.univ x y * f x y | |
| lemma pairWeight_nonneg (hn : 2β€ Fintype.card P) (x y : P) : 0 β€ pairProb Finset.univ x y := by | |
| have hn' : (2:β)β€ Fintype.card P := by exact_mod_cast hn | |
| simp only [pairProb,Finset.mem_univ,true_and,Finset.card_univ] | |
| split_ifs | |
| Β· exact div_nonneg zero_le_one (mul_nonneg (by positivity) (by linarith)) | |
| Β· exact le_rfl | |
| lemma pairMean_one (hn : 2β€ Fintype.card P) : pairMean (fun _ _ : P => 1)=1 := by | |
| simp only [pairMean,mul_one,sum_pairProb Finset.univ (by simpa using hn)] | |
| apply sum_prob | |
| exact Finset.card_pos.mp (by simpa using (show 0<Fintype.card P by omega)) | |
| lemma pairMean_mono (hn : 2β€ Fintype.card P) {f g : P β P β β} | |
| (h : β x y, xβ y β f x yβ€ g x y) : pairMean fβ€ pairMean g := by | |
| apply Finset.sum_le_sum | |
| intro x _ | |
| apply Finset.sum_le_sum | |
| intro y _ | |
| by_cases hxy : x=y | |
| Β· subst y; simp [pairProb] | |
| Β· exact mul_le_mul_of_nonneg_left (h x y hxy) (pairWeight_nonneg hn x y) | |
| lemma pairMean_add (f g : P β P β β) : pairMean (fun x y => f x y+g x y)=pairMean f+pairMean g := by | |
| simp only [pairMean,mul_add,Finset.sum_add_distrib] | |
| lemma pairMean_mul (c : β) (f : P β P β β) : pairMean (fun x y => c*f x y)=c*pairMean f := by | |
| simp only [pairMean,Finset.mul_sum]; congr 1; funext x | |
| apply Finset.sum_congr rfl; intro y _; ring | |
| lemma pairMean_left (hn : 2β€ Fintype.card P) (f : P β β) : | |
| pairMean (fun x _ => f x)=β x, prob Finset.univ x*f x := by | |
| simp only [pairMean,β Finset.sum_mul,sum_pairProb Finset.univ (by simpa using hn)] | |
| lemma pairMean_right (hn : 2β€ Fintype.card P) (f : P β β) : | |
| pairMean (fun _ y => f y)=β y, prob Finset.univ y*f y := by | |
| rw [pairMean,Finset.sum_comm] | |
| simp_rw [pairProb_symm Finset.univ _ _,β Finset.sum_mul,sum_pairProb Finset.univ (by simpa using hn)] | |
| lemma pairMean_deviation (hn : 2β€ Fintype.card P) (f : P β P β β) (a : β) : | |
| pairMean (fun x y => |f x y-pairMean f|)β€2*pairMean (fun x y => |f x y-a|) := by | |
| have h := weighted_deviation (fun z : PΓP => pairProb Finset.univ z.1 z.2) | |
| (fun z => f z.1 z.2) a (fun z => pairWeight_nonneg hn z.1 z.2) | |
| (by simpa only [Fintype.sum_prod_type,pairMean,mul_one] using pairMean_one (P:=P) hn) | |
| simpa only [Fintype.sum_prod_type,pairMean] using h | |
| lemma pairMean_overlap (d : Depth P) (_hn : 2β€ Fintype.card P) : | |
| pairMean (weightedOverlap d.mass)=weightedIntegral d.mass (pairCell Finset.univ) := by | |
| exact (weighted_pair d.mass (pairProb Finset.univ)).symm | |
| lemma depth_center_bound (d : Depth P) (hn : 2β€ Fintype.card P) : | |
| pairMean (fun x y => |d.value x y-d.M|) β€ weightedIntegral d.mass (pairCell Finset.univ)+ | |
| 2*(β x, prob Finset.univ x*d.potential x) := by | |
| calc | |
| _ β€ pairMean (fun x y => weightedOverlap d.mass x y+d.potential x+d.potential y) := by | |
| apply pairMean_mono hn | |
| intro x y hxy | |
| rw [show weightedOverlap d.mass x y=d.overlapLength x y hxy from d.mass_overlap hn x y hxy, | |
| d.depth_identity hn x y hxy] | |
| have hL := d.overlapLength_nonneg x y hxy | |
| have hx := d.potential_nonneg x | |
| have hy := d.potential_nonneg y | |
| exact abs_le.mpr β¨by linarith,by linarithβ© | |
| _ = _ := by rw [pairMean_add,pairMean_add,pairMean_overlap d hn,pairMean_left hn,pairMean_right hn]; ring | |
| end WeakPinned.Bounded | |
| namespace WeakPinned.Bounded | |
| open Hierarchy Variance Global NumberField MeasureTheory | |
| open scoped BigOperators | |
| variable {P : Type u4} [Fintype P] [DecidableEq P] | |
| def singleScale (d : Depth P) : β := | |
| weightedIntegral d.mass (pairCell Finset.univ)+β x, prob Finset.univ x*d.potential x | |
| lemma singleScale_nonneg (d : Depth P) : 0 β€ singleScale d := by | |
| refine add_nonneg (Finset.sum_nonneg (fun C _ => mul_nonneg (d.mass_nonneg C) (pairCell_nonneg _ _))) ?_ | |
| apply Finset.sum_nonneg | |
| intro x _ | |
| apply mul_nonneg _ (d.potential_nonneg x) | |
| simp only [prob,Finset.mem_univ,ite_true]; positivity | |
| lemma scaleEval_eq (d d' : Depth P) : scaleEval d d'=singleScale d+singleScale d' := by | |
| simp only [scaleEval,singleScale,massEval,potentialEval,mul_add,Finset.sum_add_distrib]; ring | |
| lemma singleScale_le_left (d d' : Depth P) : singleScale dβ€ scaleEval d d' := by | |
| rw [scaleEval_eq]; exact le_add_of_nonneg_right (singleScale_nonneg d') | |
| lemma singleScale_le_right (d d' : Depth P) : singleScale d'β€ scaleEval d d' := by | |
| rw [scaleEval_eq]; exact le_add_of_nonneg_left (singleScale_nonneg d) | |
| def rawDepth (u : P β β) (x y : P) : β := -Real.log βu x-u yβ | |
| def pairGridError (u : P β β) (Ο : Grid.FullSample) (x y : P) : β := | |
| if x=y then 0 else |Grid.error Ο (u x) (u y)| | |
| lemma raw_center_grid_bound (u : P β β) (d : Depth P) (Ο : Grid.FullSample) | |
| (hn : 2β€ Fintype.card P) (hd : β x y, xβ y β d.value x y=Grid.depth Ο (u x) (u y)) : | |
| pairMean (fun x y => |rawDepth u x y-pairMean (rawDepth u)|) β€ | |
| 4*singleScale d+2*pairMean (pairGridError u Ο) := by | |
| have h1 := pairMean_deviation hn (rawDepth u) d.M | |
| have h2 : pairMean (fun x y => |rawDepth u x y-d.M|) β€ | |
| pairMean (fun x y => |d.value x y-d.M|)+pairMean (pairGridError u Ο) := by | |
| rw [β pairMean_add] | |
| apply pairMean_mono hn | |
| intro x y hxy | |
| simp only [pairGridError,ite_eq_right hxy] | |
| have he : rawDepth u x y-d.M=(d.value x y-d.M)-Grid.error Ο (u x) (u y) := by | |
| rw [hd x y hxy]; simp only [rawDepth,Grid.error]; ring | |
| rw [he] | |
| exact abs_sub _ _ | |
| have h3 := depth_center_bound d hn | |
| have hL : 0β€ weightedIntegral d.mass (pairCell Finset.univ) := | |
| Finset.sum_nonneg (fun C _ => mul_nonneg (d.mass_nonneg C) (pairCell_nonneg _ _)) | |
| unfold singleScale | |
| linarith | |
| lemma pairGridError_integrable (u : P β β) (hu : Function.Injective u) : | |
| Integrable (fun Ο => pairMean (pairGridError u Ο)) Grid.fullLaw := by | |
| apply integrable_finsetSum | |
| intro x _ | |
| apply integrable_finsetSum | |
| intro y _ | |
| by_cases hxy : x=y | |
| Β· simp only [pairGridError,hxy,ite_true,mul_zero]; exact integrable_zero _ _ _ | |
| Β· simpa only [pairGridError,ite_eq_right hxy] using | |
| ((Grid.error_integrable_full (hu.ne hxy)).abs.const_mul (pairProb Finset.univ x y)) | |
| lemma mean_pairGridError (u : P β β) (hu : Function.Injective u) (hn : 2β€ Fintype.card P) : | |
| (β« Ο, pairMean (pairGridError u Ο) β Grid.fullLaw)β€4 := by | |
| have hi (x y : P) : Integrable (fun Ο => pairProb Finset.univ x y*pairGridError u Ο x y) Grid.fullLaw := by | |
| by_cases hxy : x=y | |
| Β· simp only [pairGridError,hxy,ite_true,mul_zero]; exact integrable_zero _ _ _ | |
| Β· simpa only [pairGridError,ite_eq_right hxy] using | |
| ((Grid.error_integrable_full (hu.ne hxy)).abs.const_mul (pairProb Finset.univ x y)) | |
| simp only [pairMean] | |
| rw [integral_finsetSum _ (fun x _ => integrable_finsetSum _ (fun y _ => hi x y))] | |
| simp_rw [integral_finsetSum _ (fun y _ => hi _ y),integral_const_mul] | |
| calc | |
| _ β€ β x,β y,pairProb Finset.univ x y*4 := by | |
| apply Finset.sum_le_sum; intro x _ | |
| apply Finset.sum_le_sum; intro y _ | |
| apply mul_le_mul_of_nonneg_left _ (pairWeight_nonneg hn x y) | |
| by_cases hxy : x=y | |
| Β· simp only [pairGridError,hxy,ite_true,integral_zero]; norm_num | |
| Β· simpa only [pairGridError,ite_eq_right hxy] using Grid.mean_abs_error_full (hu.ne hxy) | |
| _ = 4 := by | |
| have h := pairMean_one (P:=P) hn | |
| simp only [pairMean,mul_one] at h | |
| simp only [β Finset.sum_mul,h,one_mul] | |
| variable {K : Type u5} [Field K] [NumberField K] | |
| variable (Zβ Zβ : P β K) (hβ : Function.Injective Zβ) (hβ : Function.Injective Zβ) | |
| omit [NumberField K] in | |
| include hβ hβ in | |
| lemma arch_log_center_bound (hn : 2β€ Fintype.card P) (v : InfinitePlace K) : | |
| pairMean (fun x y => |rawDepth (fun x => v.embedding (Zβ x)) x y- | |
| pairMean (rawDepth (fun x => v.embedding (Zβ x)))|) β€ 4*archMean Zβ Zβ scaleEval v+8 := by | |
| let u : P β β := fun x => v.embedding (Zβ x) | |
| let L := pairMean (fun x y => |rawDepth u x y-pairMean (rawDepth u)|) | |
| have hu : Function.Injective u := v.embedding.injective.comp hβ | |
| have he := mean_pairGridError u hu hn | |
| have hbound : βα΅ Ο β Grid.fullLaw, Lβ€4*scaleEval (arch Zβ v Ο) (arch Zβ v Ο)+2*pairMean (pairGridError u Ο) := by | |
| filter_upwards [good_ae Zβ hβ v] with Ο hgood | |
| have h := raw_center_grid_bound u (arch Zβ v Ο) Ο hn (fun x y hxy => by simp [arch,hgood,hxy,u]) | |
| have hs := singleScale_le_left (arch Zβ v Ο) (arch Zβ v Ο) | |
| dsimp only [L] | |
| linarith | |
| have hh := integral_mono_ae (integrable_const L) | |
| (((integrable_scaleEval Zβ Zβ hβ hβ hn v).const_mul 4).add ((pairGridError_integrable u hu).const_mul 2)) hbound | |
| simp only [Pi.add_apply] at hh | |
| rw [integral_add ((integrable_scaleEval Zβ Zβ hβ hβ hn v).const_mul 4) | |
| ((pairGridError_integrable u hu).const_mul 2),integral_const_mul,integral_const_mul] at hh | |
| simp only [integral_const,MeasureTheory.probReal_univ,one_smul] at hh | |
| change Lβ€4*archMean Zβ Zβ scaleEval v+8 | |
| change Lβ€4*archMean Zβ Zβ scaleEval v+2*(β« Ο,pairMean (pairGridError u Ο) β Grid.fullLaw) at hh | |
| linarith | |
| end WeakPinned.Bounded | |
| namespace WeakPinned.Bounded | |
| open Variance | |
| variable {P : Type u6} [Fintype P] [DecidableEq P] | |
| def logNormalize (u : P β β) (x : P) : β := (Real.exp (pairMean (rawDepth u)) : β)*u x | |
| lemma logNormalize_injective (u : P β β) (hu : Function.Injective u) : | |
| Function.Injective (logNormalize u) := by | |
| intro x y h | |
| apply hu | |
| exact mul_left_cancelβ (by exact_mod_cast (Real.exp_ne_zero (pairMean (rawDepth u)))) h | |
| lemma logAverage_pairMean (u : P β β) : | |
| logAverage u=pairMean (fun x y => |Real.log βu x-u yβ|) := by | |
| unfold logAverage pairMean | |
| simp only [Finset.sum_div] | |
| apply Finset.sum_congr rfl; intro x _ | |
| apply Finset.sum_congr rfl; intro y _ | |
| by_cases hxy : x=y | |
| Β· simp [pairProb,logCost,hxy] | |
| Β· simp [pairProb,logCost,hxy,div_eq_mul_inv,mul_comm] | |
| lemma logNormalize_log (u : P β β) (hu : Function.Injective u) (x y : P) (hxy : xβ y) : | |
| Real.log βlogNormalize u x-logNormalize u yβ=pairMean (rawDepth u)+Real.log βu x-u yβ := by | |
| have hz : βu x-u yββ 0 := norm_ne_zero_iff.mpr (sub_ne_zero.mpr (hu.ne hxy)) | |
| simp only [logNormalize,β mul_sub,norm_mul,Complex.norm_real,Real.norm_eq_abs, | |
| abs_of_pos (Real.exp_pos _)] | |
| rw [Real.log_mul (Real.exp_ne_zero _) hz,Real.log_exp] | |
| lemma logNormalize_bound (u : P β β) (hu : Function.Injective u) (hn : 2β€Fintype.card P) : | |
| logAverage (logNormalize u)=pairMean (fun x y => |rawDepth u x y-pairMean (rawDepth u)|) := by | |
| rw [logAverage_pairMean] | |
| apply le_antisymm | |
| all_goals | |
| apply pairMean_mono hn | |
| intro x y hxy | |
| rw [logNormalize_log u hu x y hxy] | |
| have he : |pairMean (rawDepth u)+Real.log βu x-u yβ|=|rawDepth u x y-pairMean (rawDepth u)| := by | |
| rw [β abs_neg]; congr 1; unfold rawDepth; ring | |
| rw [he] | |
| lemma logAverage_translate (u : P β β) (b : β) : logAverage (fun x => u x+b)=logAverage u := by | |
| simp only [logAverage,logCost,add_sub_add_right_eq_sub] | |
| end WeakPinned.Bounded | |
| end | |
| end | |
| end OAI | |