Download data/lean/OAI/Probability/ParisiFinite/Count.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 25.6 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/ParisiFinite/Count.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/ParisiFinite/Count.lean
-
curl -L -o Count.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/ParisiFinite/Count.lean
25.6 kB
| import Mathlib | |
| import OAI.Probability.ParisiFinite.Field | |
| import OAI.Probability.ParisiFinite.RotateIJApply | |
| namespace OAI | |
| /-! Count. -/ | |
| noncomputable section | |
| open scoped BigOperators ComplexConjugate InnerProductSpace Topology ComplexOrder | |
| open Filter | |
| open scoped BigOperators | |
| open scoped Matrix Matrix.Norms.L2Operator ComplexConjugate | |
| open scoped InnerProductSpace ComplexConjugate | |
| open Filter Topology | |
| open Filter Set Topology | |
| open scoped InnerProductSpace ComplexConjugate Topology | |
| open scoped InnerProductSpace | |
| open scoped BigOperators Topology InnerProductSpace | |
| open scoped BigOperators InnerProductSpace | |
| namespace BinaryOccupations | |
| open scoped InnerProductSpace | |
| def count (D : β) (s : Finset (Fin D)) : Fin (D+1) := | |
| β¨s.card,Nat.lt_succ_of_le (by simpa using Finset.card_le_univ s)β© | |
| @[simp] theorem count_eq_iff (D : β) (s : Finset (Fin D)) (m : Fin (D+1)) : | |
| count D s=m β s.card=m.val := Fin.ext_iff | |
| theorem count_surjective (D : β) : Function.Surjective (count D) := by | |
| intro m | |
| obtain β¨s,_,hsβ© := Finset.exists_subset_card_eq | |
| (show m.valβ€(Finset.univ : Finset (Fin D)).card by simpa using Nat.le_of_lt_succ m.isLt) | |
| exact β¨s,(count_eq_iff D s m).mpr hsβ© | |
| theorem fiber_card (D : β) (m : Fin (D+1)) : | |
| Fintype.card {s : Finset (Fin D) // count D s=m}=D.choose m.val := by | |
| calc | |
| _ = Fintype.card {s : Finset (Fin D) // s.card=m.val} := | |
| Fintype.card_congr (Equiv.subtypeEquivRight (fun s => count_eq_iff D s m)) | |
| _ = _ := by simp | |
| def embedding (D : β) : | |
| EuclideanSpace β (Fin (D+1)) ββα΅’[β] EuclideanSpace β (Finset (Fin D)) := | |
| FiniteOccupations.lift (count D) (count_surjective D) | |
| @[simp] theorem embedding_apply (D : β) (u : EuclideanSpace β (Fin (D+1))) | |
| (s : Finset (Fin D)) : | |
| embedding D u s=(Real.sqrt (D.choose s.card : β) : β)β»ΒΉ*u (count D s) := by | |
| change FiniteOccupations.weight (count D) (count D s)*u (count D s)=_ | |
| rw [FiniteOccupations.weight,fiber_card] | |
| rfl | |
| theorem mem_range_iff_card (D : β) (u : EuclideanSpace β (Finset (Fin D))) : | |
| uβSet.range (embedding D) β βs t : Finset (Fin D), s.card=t.card β u s=u t := by | |
| rw [embedding,FiniteOccupations.mem_range_iff] | |
| simp only [count,Fin.mk.injEq] | |
| end BinaryOccupations | |
| namespace SKQAOA | |
| def extendAngles {p : β} (Ξ³ : Fin p β β) : (k : β) β Fin (p+k) β β | |
| | 0 => Ξ³ | |
| | k+1 => Fin.snoc (extendAngles Ξ³ k) 0 | |
| @[simp] theorem expectedEnergy_extendAngles (n p k : β) (Ξ³ Ξ² : Fin p β β) : | |
| expectedEnergy n (p+k) (extendAngles Ξ³ k) (extendAngles Ξ² k)=expectedEnergy n p Ξ³ Ξ² := by | |
| induction k with | |
| | zero => rfl | |
| | succ k ih => simpa only [Nat.add_succ,extendAngles,expectedEnergy_pad] using ih | |
| @[simp] theorem value_extendAngles (p k : β) (Ξ³ Ξ² : Fin p β β) : | |
| value (p+k) (extendAngles Ξ³ k) (extendAngles Ξ² k)=value p Ξ³ Ξ² := by | |
| simp [value] | |
| end SKQAOA | |
| namespace SKQAOA | |
| theorem explicit_ground_lower_bound : Real.exp (-1/2)/2 β€ Pstar := by | |
| have ht : Tendsto (fun n => expectedEnergy n 1 (fun _ => 1/2) (fun _ => Real.pi/8)) | |
| atTop (π (Real.exp (-1/2)/2)) := by | |
| convert tendsto_expectedEnergy_one (fun _ => 1/2) (fun _ => Real.pi/8) using 1 | |
| norm_num | |
| rw [show 4*(Real.pi/8)=Real.pi/2 by ring,Real.sin_pi_div_two] | |
| ring | |
| exact le_of_tendsto_of_tendsto ht tendsto_expectedGround | |
| (Filter.Eventually.of_forall fun n => expectedEnergy_le_expectedGround n 1 _ _) | |
| theorem Pstar_pos : 0 < Pstar := | |
| lt_of_lt_of_le (div_pos (Real.exp_pos _) (by norm_num)) explicit_ground_lower_bound | |
| theorem exists_positive_word_every_depth (p : β) (hp : 1β€p) : | |
| βΞ³ Ξ² : Fin p β β, | |
| Tendsto (fun n => expectedEnergy n p Ξ³ Ξ²) atTop (π (Real.exp (-1/2)/2)) β§ | |
| value p Ξ³ Ξ²=Real.exp (-1/2)/2 := by | |
| obtain β¨k,rflβ© := Nat.exists_eq_add_of_le hp | |
| refine β¨extendAngles (fun _ : Fin 1 => 1/2) k, | |
| extendAngles (fun _ : Fin 1 => Real.pi/8) k,?_,?_β© | |
| Β· simp only [expectedEnergy_extendAngles] | |
| have ht := tendsto_expectedEnergy_one (fun _ => 1/2) (fun _ => Real.pi/8) | |
| rw [βvalue_one (fun _ => 1/2) (fun _ => Real.pi/8),explicit_one_layer_value] at ht | |
| exact ht | |
| Β· simpa only [value_extendAngles] using explicit_one_layer_value | |
| end SKQAOA | |
| namespace SKQAOA | |
| open MeasureTheory ProbabilityTheory Filter | |
| @[simp] theorem hamiltonian_neg_disorder (n : β) (J : Disorder n) (Ο : Configuration n) : | |
| hamiltonian n (-J) Ο = -hamiltonian n J Ο := by | |
| simp [hamiltonian,Finset.sum_neg_distrib] | |
| theorem neg_energyDensity_le_groundMaximum (n p : β) (J : Disorder n) | |
| (Ξ³ Ξ² : Fin p β β) : | |
| -energyDensity n p J Ξ³ Ξ² β€ groundMaximum n (-J)/(n : β) := by | |
| rw [energyDensity_eq,βneg_div] | |
| apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg n) | |
| calc | |
| -(βΟ,Complex.normSq (qaoaState n p J Ξ³ Ξ² Ο)*hamiltonian n J Ο) = | |
| βΟ,Complex.normSq (qaoaState n p J Ξ³ Ξ² Ο)*hamiltonian n (-J) Ο := by | |
| simp [Finset.sum_neg_distrib] | |
| _ β€ βΟ,Complex.normSq (qaoaState n p J Ξ³ Ξ² Ο)*groundMaximum n (-J) := | |
| Finset.sum_le_sum fun Ο _ => mul_le_mul_of_nonneg_left | |
| (hamiltonian_le_groundMaximum n (-J) Ο) (Complex.normSq_nonneg _) | |
| _ = groundMaximum n (-J) := by | |
| rw [βFinset.sum_mul] | |
| change mass (qaoaState n p J Ξ³ Ξ²)*groundMaximum n (-J)=_ | |
| rw [qaoaState_mass,one_mul] | |
| theorem disorder_neg_preserving (n : β) : | |
| MeasurePreserving (fun J : Disorder n => -J) (disorderLaw n) (disorderLaw n) := by | |
| refine measurePreserving_pi (fun _ : Edge n => gaussianReal 0 1) | |
| (fun _ : Edge n => gaussianReal 0 1) (f := fun (_ : Edge n) (x : β) => -x) ?_ | |
| intro e | |
| exact β¨measurable_neg,by simpa using gaussianReal_map_neg (ΞΌ := 0) (v := 1)β© | |
| theorem abs_expectedEnergy_le_expectedGround (n p : β) (Ξ³ Ξ² : Fin p β β) : | |
| |expectedEnergy n p Ξ³ Ξ²| β€ expectedGround n := by | |
| apply abs_le.mpr | |
| refine β¨?_,expectedEnergy_le_expectedGround n p Ξ³ Ξ²β© | |
| have hp := disorder_neg_preserving n | |
| have hi := hp.integrable_comp_of_integrable ((groundMaximum_integrable n).div_const (n : β)) | |
| have h := integral_mono (energyDensity_integrable n p Ξ³ Ξ²).neg hi | |
| (fun J => neg_energyDensity_le_groundMaximum n p J Ξ³ Ξ²) | |
| have he : (β«J : Disorder n,groundMaximum n (-J)/(n : β) βdisorderLaw n)=expectedGround n := by | |
| calc | |
| _ = β«J : Disorder n,groundMaximum n J/(n : β) βdisorderLaw n := | |
| hp.integral_comp (MeasurableEquiv.neg (Disorder n)).measurableEmbedding | |
| (fun J => groundMaximum n J/(n : β)) | |
| _ = _ := integral_div _ _ | |
| change (β«J : Disorder n,-energyDensity n p J Ξ³ Ξ² βdisorderLaw n) β€ | |
| (β«J : Disorder n,groundMaximum n (-J)/(n : β) βdisorderLaw n) at h | |
| rw [integral_neg,he] at h | |
| change -(β«J : Disorder n,energyDensity n p J Ξ³ Ξ² βdisorderLaw n) β€ _ at h | |
| change -expectedGround n β€ (β«J : Disorder n,energyDensity n p J Ξ³ Ξ² βdisorderLaw n) | |
| linarith | |
| theorem eventually_uniform_expectedEnergy_bound {Ξ΅ : β} (hΞ΅ : 0<Ξ΅) : | |
| βαΆ n in atTop, βp : β, βΞ³ Ξ² : Fin p β β, | |
| |expectedEnergy n p Ξ³ Ξ²| < Pstar+Ξ΅ := by | |
| have he : βαΆ n in atTop, expectedGround n < Pstar+Ξ΅ := | |
| tendsto_expectedGround.eventually (eventually_lt_nhds (lt_add_of_pos_right _ hΞ΅)) | |
| filter_upwards [he] with n hn p Ξ³ Ξ² | |
| exact (abs_expectedEnergy_le_expectedGround n p Ξ³ Ξ²).trans_lt hn | |
| end SKQAOA | |
| open scoped BigOperators Matrix Topology ComplexConjugate | |
| open MeasureTheory ProbabilityTheory Filter | |
| namespace SKQAOA.SiteHistories | |
| def Bits : β β Type | |
| | 0 => Unit | |
| | p+1 => Bool Γ Bits p | |
| instance bitsFintype : (p : β) β Fintype (Bits p) | |
| | 0 => inferInstanceAs (Fintype Unit) | |
| | p+1 => @instFintypeProd Bool (Bits p) inferInstance (bitsFintype p) | |
| instance bitsDecidableEq : (p : β) β DecidableEq (Bits p) | |
| | 0 => inferInstanceAs (DecidableEq Unit) | |
| | p+1 => @instDecidableEqProd Bool (Bits p) inferInstance (bitsDecidableEq p) | |
| def atVertex (n : β) : (p : β) β History n p β Fin n β Bits p | |
| | 0, _, _ => () | |
| | p+1, h, i => (h.1 i,atVertex n p h.2 i) | |
| def assemble (n : β) : (p : β) β (Fin n β Bits p) β History n p | |
| | 0, _ => () | |
| | p+1, h => (fun i => (h i).1,assemble n p (fun i => (h i).2)) | |
| @[simp] theorem atVertex_assemble (n p : β) (h : Fin n β Bits p) : | |
| atVertex n p (assemble n p h)=h := by | |
| induction p with | |
| | zero => funext i; change (():Unit)=h i; exact Subsingleton.elim _ _ | |
| | succ p ih => | |
| funext i | |
| change ((h i).1,atVertex n p (assemble n p (fun i => (h i).2)) i)=h i | |
| rw [ih] | |
| exact Prod.eta _ | |
| @[simp] theorem assemble_atVertex (n p : β) (h : History n p) : | |
| assemble n p (atVertex n p h)=h := by | |
| induction p with | |
| | zero => change (():Unit)=h; exact Subsingleton.elim _ _ | |
| | succ p ih => | |
| change (h.1,assemble n p (atVertex n p h.2))=h | |
| rw [ih] | |
| exact Prod.eta _ | |
| def historyEquiv (n p : β) : History n p β (Fin n β Bits p) where | |
| toFun := atVertex n p | |
| invFun := assemble n p | |
| left_inv := assemble_atVertex n p | |
| right_inv := atVertex_assemble n p | |
| def step (t : β) (Ο Ο : Bool) : β := | |
| if Ο=Ο then (Real.cos t:β) else -(Real.sin t:β)*Complex.I | |
| def mix : (p : β) β (Fin p β β) β Bool β Bits p β β | |
| | 0, _, _, _ => ((Real.sqrt 2)β»ΒΉ:β) | |
| | p+1, Ξ², Ο, h => step (Ξ² (Fin.last p)) Ο h.1 * mix p (fun i => Ξ² i.castSucc) h.1 h.2 | |
| lemma sqrt_nat_pow (x : β) (hx : 0 β€ x) (n : β) : Real.sqrt (x^n)=(Real.sqrt x)^n := by | |
| apply (Real.sqrt_eq_iff_mul_self_eq (pow_nonneg hx n) (pow_nonneg (Real.sqrt_nonneg x) n)).mpr | |
| rw [βmul_pow,Real.mul_self_sqrt hx] | |
| theorem historyMix_factor (n p : β) (Ξ² : Fin p β β) (Ο : Configuration n) | |
| (h : History n p) : | |
| historyMix n p Ξ² Ο h = βi, mix p Ξ² (Ο i) (atVertex n p h i) := by | |
| induction p generalizing Ο with | |
| | zero => simp [historyMix,mix,sqrt_nat_pow 2 (by norm_num)] | |
| | succ p ih => | |
| simp only [historyMix,mix,atVertex] | |
| rw [mixer_evolution_apply,ih,βFinset.prod_mul_distrib] | |
| rfl | |
| abbrev Site (p : β) := Bool Γ Bits p Γ Bits p | |
| def weight (p : β) (Ξ² : Fin p β β) (s : Site p) : β := | |
| star (mix p Ξ² s.1 s.2.1)*mix p Ξ² s.1 s.2.2 | |
| def trajectoriesEquiv (n p : β) : | |
| (Configuration n Γ History n p Γ History n p) β (Fin n β Site p) where | |
| toFun h i := (h.1 i,atVertex n p h.2.1 i,atVertex n p h.2.2 i) | |
| invFun h := (fun i => (h i).1,assemble n p (fun i => (h i).2.1), | |
| assemble n p (fun i => (h i).2.2)) | |
| left_inv h := by simp | |
| right_inv h := by funext i; simp | |
| @[simp] theorem trajectoriesEquiv_apply (n p : β) | |
| (h : Configuration n Γ History n p Γ History n p) (i : Fin n) : | |
| trajectoriesEquiv n p h i=(h.1 i,atVertex n p h.2.1 i,atVertex n p h.2.2 i) := rfl | |
| theorem pairedMix_factor (n p : β) (Ξ² : Fin p β β) (Ο : Configuration n) | |
| (a b : History n p) : | |
| pairedMix n p Ξ² Ο a b = βi, weight p Ξ² (Ο i,atVertex n p a i,atVertex n p b i) := by | |
| rw [pairedMix,historyMix_factor,historyMix_factor] | |
| simp only [star_prod,βFinset.prod_mul_distrib,weight] | |
| theorem sum_pairedMix (n p : β) (Ξ² : Fin p β β) : | |
| (βΟ : Configuration n, βa : History n p, βb : History n p, | |
| pairedMix n p Ξ² Ο a b)=1 := by | |
| have h (Ο : Configuration n) := qaoaState_pair_history n p (fun _ => 0) (fun _ => 0) Ξ² Ο | |
| simp only [Complex.ofReal_zero,mul_zero,Finset.sum_const_zero,Complex.exp_zero,mul_one] at h | |
| simp_rw [βh] | |
| change star (qaoaState n p (fun _ => 0) (fun _ => 0) Ξ²) β¬α΅₯ | |
| qaoaState n p (fun _ => 0) (fun _ => 0) Ξ² = 1 | |
| rw [βmass_eq_dot,qaoaState_mass] | |
| norm_num | |
| theorem sum_weight (p : β) (Ξ² : Fin p β β) : βs : Site p, weight p Ξ² s=1 := by | |
| have h := sum_pairedMix 1 p Ξ² | |
| simp_rw [pairedMix_factor] at h | |
| have hs := (trajectoriesEquiv 1 p).sum_comp (fun f => βi,weight p Ξ² (f i)) | |
| rw [Fintype.sum_prod_type] at hs | |
| simp_rw [Fintype.sum_prod_type] at hs | |
| simp only [trajectoriesEquiv_apply] at hs | |
| rw [hs] at h | |
| rw [βFintype.prod_sum] at h | |
| simpa using h | |
| lemma norm_step_le_one (t : β) (Ο Ο : Bool) : βstep t Ο Οβ β€ 1 := by | |
| unfold step | |
| split_ifs <;> simp only [norm_mul,norm_neg,Complex.norm_real,Real.norm_eq_abs, | |
| Complex.norm_I,mul_one] | |
| Β· exact Real.abs_cos_le_one t | |
| Β· exact Real.abs_sin_le_one t | |
| lemma norm_mix_le_one (p : β) (Ξ² : Fin p β β) (Ο : Bool) (h : Bits p) : | |
| βmix p Ξ² Ο hβ β€ 1 := by | |
| induction p generalizing Ο with | |
| | zero => | |
| simp only [mix,Complex.norm_real,Real.norm_eq_abs,abs_inv,abs_of_nonneg (Real.sqrt_nonneg _)] | |
| apply inv_le_one_of_one_leβ | |
| exact (Real.le_sqrt (by norm_num) (by norm_num)).mpr (by norm_num) | |
| | succ p ih => | |
| rw [mix,norm_mul] | |
| exact (mul_le_of_le_one_left (norm_nonneg _) (norm_step_le_one _ _ _)).trans (ih _ _ _) | |
| lemma norm_weight_le_one (p : β) (Ξ² : Fin p β β) (s : Site p) : | |
| βweight p Ξ² sβ β€ 1 := by | |
| rw [weight,norm_mul,norm_star] | |
| exact (mul_le_of_le_one_left (norm_nonneg _) (norm_mix_le_one _ _ _ _)).trans | |
| (norm_mix_le_one _ _ _ _) | |
| def bitSpin (b : Bool) : β := if b then -1 else 1 | |
| @[simp] theorem abs_bitSpin (b : Bool) : |bitSpin b|=1 := by cases b <;> norm_num [bitSpin] | |
| def interaction : (p : β) β (Fin p β β) β Bits p β Bits p β β | |
| | 0, _, _, _ => 0 | |
| | p+1, Ξ³, a, b => Ξ³ (Fin.last p)*bitSpin a.1*bitSpin b.1 + | |
| interaction p (fun i => Ξ³ i.castSucc) a.2 b.2 | |
| def angleMass : (p : β) β (Fin p β β) β β | |
| | 0, _ => 0 | |
| | p+1, Ξ³ => |Ξ³ (Fin.last p)|+angleMass p (fun i => Ξ³ i.castSucc) | |
| lemma angleMass_nonneg (p : β) (Ξ³ : Fin p β β) : 0 β€ angleMass p Ξ³ := by | |
| induction p with | |
| | zero => rfl | |
| | succ p ih => exact add_nonneg (abs_nonneg _) (ih _) | |
| lemma abs_interaction_le (p : β) (Ξ³ : Fin p β β) (a b : Bits p) : | |
| |interaction p Ξ³ a b| β€ angleMass p Ξ³ := by | |
| induction p with | |
| | zero => simp [interaction,angleMass] | |
| | succ p ih => | |
| calc | |
| _ β€ |Ξ³ (Fin.last p)*bitSpin a.1*bitSpin b.1| + | |
| |interaction p (fun i => Ξ³ i.castSucc) a.2 b.2| := abs_add_le _ _ | |
| _ β€ |Ξ³ (Fin.last p)|+angleMass p (fun i => Ξ³ i.castSucc) := by | |
| simp only [abs_mul,abs_bitSpin,mul_one] | |
| exact add_le_add le_rfl (ih _ _ _) | |
| _ = _ := rfl | |
| def delta (p : β) (Ξ³ : Fin p β β) (s t : Site p) : β := | |
| interaction p Ξ³ s.2.1 t.2.1 - interaction p Ξ³ s.2.2 t.2.2 | |
| lemma abs_delta_le (p : β) (Ξ³ : Fin p β β) (s t : Site p) : | |
| |delta p Ξ³ s t| β€ 2*angleMass p Ξ³ := by | |
| calc | |
| _ β€ |interaction p Ξ³ s.2.1 t.2.1|+|interaction p Ξ³ s.2.2 t.2.2| := abs_sub _ _ | |
| _ β€ angleMass p Ξ³+angleMass p Ξ³ := add_le_add (abs_interaction_le _ _ _ _) (abs_interaction_le _ _ _ _) | |
| _ = _ := by ring | |
| theorem historyPhase_local (n p : β) (Ξ³ : Fin p β β) (a : History n p) (e : Edge n) : | |
| historyPhase n p Ξ³ a e = -Complex.I*((Real.sqrt (n:β))β»ΒΉ:β)* | |
| (interaction p Ξ³ (atVertex n p a e.1.1) (atVertex n p a e.1.2):β) := by | |
| induction p with | |
| | zero => simp [historyPhase,interaction] | |
| | succ p ih => | |
| simp only [historyPhase,interaction,atVertex] | |
| rw [ih] | |
| simp only [skCoeff,spin,bitSpin,Complex.ofReal_add,Complex.ofReal_mul,Complex.ofReal_inv] | |
| ring | |
| theorem pairedPhase_local (n p : β) (Ξ³ : Fin p β β) | |
| (h : Configuration n Γ History n p Γ History n p) (e : Edge n) : | |
| pairedPhase n p Ξ³ h.2.1 h.2.2 e = Complex.I*((Real.sqrt (n:β))β»ΒΉ:β)* | |
| (delta p Ξ³ (trajectoriesEquiv n p h e.1.1) (trajectoriesEquiv n p h e.1.2):β) := by | |
| rw [pairedPhase,historyPhase_local,historyPhase_local] | |
| simp only [delta,trajectoriesEquiv_apply,star_mul,star_neg,Complex.star_def, | |
| Complex.conj_I,neg_neg,Complex.conj_ofReal,Complex.ofReal_sub,map_invβ] | |
| ring | |
| def edgeKernel (n p : β) (Ξ³ : Fin p β β) (s t : Site p) : β := | |
| Real.exp (-(delta p Ξ³ s t)^2*((n:β)β»ΒΉ)/2) | |
| lemma edgeKernel_pos (n p : β) (Ξ³ : Fin p β β) (s t : Site p) : | |
| 0 < edgeKernel n p Ξ³ s t := Real.exp_pos _ | |
| lemma edgeKernel_le_one (n p : β) (Ξ³ : Fin p β β) (s t : Site p) : | |
| edgeKernel n p Ξ³ s t β€ 1 := by | |
| apply Real.exp_le_one_iff.mpr | |
| exact div_nonpos_of_nonpos_of_nonneg (mul_nonpos_of_nonpos_of_nonneg | |
| (neg_nonpos.mpr (sq_nonneg _)) (inv_nonneg.mpr (Nat.cast_nonneg n))) (by norm_num) | |
| lemma abs_edgeKernel_sub_one_le (n p : β) (Ξ³ : Fin p β β) (s t : Site p) : | |
| |edgeKernel n p Ξ³ s t-1| β€ (2*angleMass p Ξ³)^2*((n:β)β»ΒΉ)/2 := by | |
| have hd := abs_delta_le p Ξ³ s t | |
| have hsq : (delta p Ξ³ s t)^2 β€ (2*angleMass p Ξ³)^2 := by | |
| nlinarith [sq_abs (delta p Ξ³ s t),abs_nonneg (delta p Ξ³ s t),angleMass_nonneg p Ξ³] | |
| have he := Real.add_one_le_exp (-(delta p Ξ³ s t)^2*((n:β)β»ΒΉ)/2) | |
| rw [abs_of_nonpos (sub_nonpos.mpr (edgeKernel_le_one n p Ξ³ s t))] | |
| have hmul := mul_le_mul_of_nonneg_right hsq (inv_nonneg.mpr (Nat.cast_nonneg n)) | |
| change _ β€ _ | |
| dsimp [edgeKernel] at * | |
| linarith | |
| theorem exp_pairedPhase_sq (n p : β) (Ξ³ : Fin p β β) | |
| (h : Configuration n Γ History n p Γ History n p) (e : Edge n) : | |
| Complex.exp ((pairedPhase n p Ξ³ h.2.1 h.2.2 e)^2/2)= | |
| (edgeKernel n p Ξ³ (trajectoriesEquiv n p h e.1.1) (trajectoriesEquiv n p h e.1.2):β) := by | |
| rw [pairedPhase_local,edgeKernel,Complex.ofReal_exp] | |
| congr 1 | |
| simp only [mul_pow,Complex.I_sq,βComplex.ofReal_pow,inv_pow,Real.sq_sqrt (Nat.cast_nonneg n)] | |
| push_cast | |
| ring | |
| end SKQAOA.SiteHistories | |
| open scoped BigOperators | |
| namespace FiniteHistory | |
| variable {V A : Type*} [Fintype V] [DecidableEq V] [Fintype A] | |
| def expectation (q : A β β) (F : (V β A) β β) : β := | |
| βa : V β A, (βi, q (a i))*F a | |
| theorem restrict_expectation (q : A β β) (hq : βa,q a=1) | |
| (S : Finset V) (F : (S β A) β β) : | |
| expectation q (fun (a : V β A) => F (fun i : S => a i)) = | |
| expectation q F := by | |
| let e := Equiv.piEquivPiSubtypeProd (fun i : V => iβS) (fun _ => A) | |
| let G : ((S β A) Γ ({i : V // iβS} β A)) β β := | |
| fun ab => ((βi:S,q (ab.1 i))*F ab.1)*(βi:{i:V // iβS},q (ab.2 i)) | |
| have hs := e.sum_comp G | |
| have hg (a : V β A) : G (e a) = (βi,q (a i))*F (fun i:S => a i) := by | |
| simp only [G,e,Equiv.piEquivPiSubtypeProd_apply] | |
| rw [mul_right_comm] | |
| congr 1 | |
| convert Fintype.prod_subtype_mul_prod_subtype (fun i : V => iβS) (fun i => q (a i)) using 1 | |
| congr 2 | |
| ext x | |
| simp | |
| simp_rw [hg] at hs | |
| dsimp only [expectation] | |
| rw [hs,Fintype.sum_prod_type] | |
| dsimp only [G] | |
| simp_rw [βFinset.mul_sum,βFintype.prod_sum (fun _ : {i:V // iβS} => q),hq] | |
| simp | |
| lemma norm_expectation_le (q : A β β) (F : (V β A) β β) {C : β} | |
| (hC : 0 β€ C) (hF : βa, βF aβ β€ C) : | |
| βexpectation q Fβ β€ (βa, βq aβ)^(Fintype.card V)*C := by | |
| calc | |
| _ β€ βa:VβA, β(βi,q (a i))*F aβ := norm_sum_le _ _ | |
| _ β€ βa:VβA, (βi,βq (a i)β)*C := by | |
| apply Finset.sum_le_sum | |
| intro a ha | |
| rw [norm_mul] | |
| exact (mul_le_mul_of_nonneg_left (hF a) (norm_nonneg _)).trans | |
| (mul_le_mul_of_nonneg_right (Finset.norm_prod_le _ _) hC) | |
| _ = (βa, βq aβ)^(Fintype.card V)*C := by | |
| rw [βFinset.sum_mul,βFintype.prod_sum (fun _ : V => fun a:A => βq aβ)] | |
| simp | |
| variable [Nonempty A] | |
| def extend (S : Finset V) (a : S β A) : V β A := | |
| fun i => if h : iβS then a β¨i,hβ© else Classical.choice (inferInstance : Nonempty A) | |
| omit [Fintype V] [Fintype A] in | |
| @[simp] lemma extend_apply (S : Finset V) (a : S β A) (i : S) : extend S a i=a i := by | |
| simp [extend,i.property] | |
| theorem norm_expectation_le_of_local (q : A β β) (hq : βa,q a=1) | |
| (S : Finset V) (F : (V β A) β β) | |
| (hlocal : βa b, (βiβS, a i=b i) β F a=F b) | |
| {C : β} (hC : 0 β€ C) (hF : βa, βF aβ β€ C) : | |
| βexpectation q Fβ β€ (βa, βq aβ)^S.card*C := by | |
| have he : F=(fun a => F (extend S (fun i:S => a i))) := by | |
| funext a | |
| apply hlocal | |
| intro i hi | |
| simp [extend,hi] | |
| rw [he,restrict_expectation q hq S (fun a => F (extend S a))] | |
| have hh := norm_expectation_le q (fun a:SβA => F (extend S a)) hC (fun a => hF _) | |
| simpa using hh | |
| end FiniteHistory | |
| open scoped BigOperators Topology | |
| open Filter | |
| namespace SKQAOA.SiteHistories | |
| lemma tendsto_scaled_exp (c : β) : | |
| Tendsto (fun n : β => (n:β)*(Real.exp (c/(n:β))-1)) atTop (π c) := by | |
| have hd : HasDerivAt (fun t : β => Real.exp (c*t)) c 0 := by | |
| convert ((hasDerivAt_id (0:β)).const_mul c).exp using 1 <;> simp | |
| have hi : Tendsto (fun n : β => (n:β)β»ΒΉ) atTop (π[β ] (0:β)) := by | |
| refine tendsto_nhdsWithin_iff.mpr β¨tendsto_inv_atTop_nhds_zero_nat,?_β© | |
| filter_upwards [eventually_ge_atTop 1] with n hn | |
| simpa only [Set.mem_compl_iff,Set.mem_singleton_iff,inv_eq_zero] using | |
| (show (n:β)β 0 by exact_mod_cast (by omega : nβ 0)) | |
| simpa only [Function.comp_def,zero_add,mul_zero,Real.exp_zero,smul_eq_mul,inv_inv, | |
| div_eq_mul_inv] using hd.tendsto_slope_zero.comp hi | |
| def kernelScaled (n p : β) (Ξ³ : Fin p β β) (u v : Site p) : β := | |
| (n:β)*(edgeKernel n p Ξ³ u v-1) | |
| lemma tendsto_kernel (p : β) (Ξ³ : Fin p β β) (u v : Site p) : | |
| Tendsto (fun n : β => edgeKernel n p Ξ³ u v) atTop (π 1) := by | |
| have ht : Tendsto (fun n : β => -(delta p Ξ³ u v)^2/(2*(n:β))) atTop (π 0) := by | |
| have := (tendsto_const_nhds (x := -(delta p Ξ³ u v)^2/2)).mul | |
| (tendsto_inv_atTop_nhds_zero_nat (π := β)) | |
| simpa only [mul_zero,zero_mul,div_eq_mul_inv,mul_inv_rev,mul_assoc,mul_left_comm,mul_comm] using this | |
| convert Real.continuous_exp.continuousAt.tendsto.comp ht using 1 | |
| Β· funext n | |
| simp only [edgeKernel,Function.comp_def] | |
| congr 1 | |
| ring | |
| Β· simp | |
| lemma tendsto_kernelScaled (p : β) (Ξ³ : Fin p β β) (u v : Site p) : | |
| Tendsto (fun n : β => kernelScaled n p Ξ³ u v) atTop (π (-(delta p Ξ³ u v)^2/2)) := by | |
| have ht := tendsto_scaled_exp (-(delta p Ξ³ u v)^2/2) | |
| convert ht using 1 | |
| funext n | |
| unfold kernelScaled edgeKernel | |
| congr 3 | |
| ring | |
| def graphCoefficient (N m p : β) (Ξ³ Ξ² : Fin p β β) (r : Edge m) | |
| (H : Finset (Edge m)) : β := | |
| FiniteHistory.expectation (weight p Ξ²) (fun a : Fin m β Site p => | |
| (bitSpin (a r.1.1).1:β)*(bitSpin (a r.1.2).1:β)*Complex.I* | |
| (delta p Ξ³ (a r.1.1) (a r.1.2):β)* | |
| (edgeKernel N p Ξ³ (a r.1.1) (a r.1.2):β)* | |
| βeβH,if e=r then 0 else (kernelScaled N p Ξ³ (a e.1.1) (a e.1.2):β)) | |
| def graphCoefficientLimit (m p : β) (Ξ³ Ξ² : Fin p β β) (r : Edge m) | |
| (H : Finset (Edge m)) : β := | |
| FiniteHistory.expectation (weight p Ξ²) (fun a : Fin m β Site p => | |
| (bitSpin (a r.1.1).1:β)*(bitSpin (a r.1.2).1:β)*Complex.I* | |
| (delta p Ξ³ (a r.1.1) (a r.1.2):β)* | |
| βeβH,if e=r then 0 else (-(delta p Ξ³ (a e.1.1) (a e.1.2):β)^2/2)) | |
| theorem tendsto_graphCoefficient (m p : β) (Ξ³ Ξ² : Fin p β β) (r : Edge m) | |
| (H : Finset (Edge m)) : | |
| Tendsto (fun N => graphCoefficient N m p Ξ³ Ξ² r H) atTop | |
| (π (graphCoefficientLimit m p Ξ³ Ξ² r H)) := by | |
| unfold graphCoefficient graphCoefficientLimit FiniteHistory.expectation | |
| apply tendsto_finsetSum | |
| intro a ha | |
| apply Tendsto.const_mul | |
| have hk := Complex.continuous_ofReal.continuousAt.tendsto.comp | |
| (tendsto_kernel p Ξ³ (a r.1.1) (a r.1.2)) | |
| have hp : Tendsto (fun N => βeβH,if e=r then (0:β) else | |
| (kernelScaled N p Ξ³ (a e.1.1) (a e.1.2):β)) atTop | |
| (π (βeβH,if e=r then 0 else (-(delta p Ξ³ (a e.1.1) (a e.1.2):β)^2/2))) := by | |
| apply tendsto_finsetProd | |
| intro e he | |
| by_cases her : e=r | |
| Β· simp only [her,ite_true] | |
| exact tendsto_const_nhds | |
| Β· simp only [her,ite_false] | |
| convert Complex.continuous_ofReal.continuousAt.tendsto.comp | |
| (tendsto_kernelScaled p Ξ³ (a e.1.1) (a e.1.2)) using 1 <;> push_cast <;> rfl | |
| simpa only [Function.comp_def,Complex.ofReal_one,mul_one] using (hk.const_mul | |
| ((bitSpin (a r.1.1).1:β)*(bitSpin (a r.1.2).1:β)*Complex.I* | |
| (delta p Ξ³ (a r.1.1) (a r.1.2):β))).mul hp | |
| end SKQAOA.SiteHistories | |
| open scoped BigOperators | |
| namespace FiniteHistory | |
| variable {V W A : Type*} [Fintype V] [Fintype W] [Fintype A] [DecidableEq V] [DecidableEq W] | |
| theorem expectation_equiv (q : A β β) (e : V β W) (F : (W β A) β β) : | |
| expectation q (fun a : V β A => F (a β e.symm))=expectation q F := by | |
| let Ο : (V β A) β (W β A) := Equiv.arrowCongr e (Equiv.refl A) | |
| have he (a : V β A) : (βi:V,q (a i))*(F (a β e.symm))= | |
| (βj:W,q (Ο a j))*F (Ο a) := by | |
| have hp : (βj:W,q (Ο a j))=(βi:V,q (a i)) := by | |
| simpa [Ο] using e.symm.prod_comp (fun i : V => q (a i)) | |
| rw [hp] | |
| rfl | |
| dsimp only [expectation] | |
| simp_rw [he] | |
| exact Ο.sum_comp (fun a : W β A => (βj:W,q (a j))*F a) | |
| theorem expectation_embedding (q : A β β) (hq : βa,q a=1) | |
| (f : W βͺ V) (F : (W β A) β β) : | |
| expectation q (fun a : V β A => F (a β f))=expectation q F := by | |
| classical | |
| let S : Finset V := Finset.univ.image f | |
| let e : W β S := Equiv.ofBijective (fun w => β¨f w,Finset.mem_image.mpr β¨w,Finset.mem_univ _,rflβ©β©) | |
| (by | |
| constructor | |
| Β· intro u v h | |
| exact f.injective (congrArg Subtype.val h) | |
| Β· intro v | |
| obtain β¨w,hw,heβ© := Finset.mem_image.mp v.property | |
| exact β¨w,Subtype.ext heβ©) | |
| have he (a : V β A) : F (a β f)=F ((fun i : S => a i) β e) := rfl | |
| simp_rw [he] | |
| rw [restrict_expectation q hq S (fun a => F (a β e))] | |
| exact expectation_equiv q e.symm F | |
| end FiniteHistory | |
| end | |
| end OAI | |