Download data/lean/OAI/Probability/CoordinateSweeps/SparseMoment.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 21.1 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CoordinateSweeps/SparseMoment.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CoordinateSweeps/SparseMoment.lean
-
curl -L -o SparseMoment.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CoordinateSweeps/SparseMoment.lean
21.1 kB
| import Mathlib | |
| import OAI.Probability.CoordinateSweeps.TrajectoryMoment | |
| import OAI.Combinatorics.Graphs.Coverage | |
| import OAI.RepresentationTheory.Placement.Occurrence | |
| namespace OAI | |
| noncomputable section | |
| open scoped BigOperators Matrix.Norms.L2Operator ComplexOrder | |
| attribute [local instance] Classical.propDecidable | |
| noncomputable section | |
| open scoped BigOperators | |
| attribute [local instance] Classical.propDecidable | |
| noncomputable section | |
| open scoped BigOperators | |
| open MvPolynomial | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory Real Set Filter | |
| open scoped ENNReal NNReal BigOperators | |
| noncomputable section | |
| open scoped BigOperators | |
| namespace CoordinateSweeps.Grid.Holes | |
| variable {G : Grid} {h k : β} | |
| open Coverage | |
| def holeHeavy (H : G.Holes h) (Ξ· : β) (j : Fin G.b) : Finset (G.Line j) := | |
| heavySet (H.lineCount j) ((2^G.bits j : β)*Ξ·/2) | |
| def particleHeavy (p : Fin k β G.Slot Γ G.Slot) (Ξ· : β) (j : Fin G.b) : Finset (G.Line j) := | |
| heavySet (occupancy (fun a : G.Slot Γ G.Slot => G.pathLine a.1 a.2 j) p) | |
| ((2^G.bits j : β)*Ξ·/2) | |
| def holeHeavyHits (H : G.Holes h) (p : Fin k β G.Slot Γ G.Slot) (Ξ· : β) (j : Fin G.b) : Finset (Fin k) := | |
| Finset.univ.filter (fun i => G.pathLine (p i).1 (p i).2 j β H.holeHeavy Ξ· j) | |
| def particleHeavyHits (p : Fin k β G.Slot Γ G.Slot) (Ξ· : β) (j : Fin G.b) : Finset (Fin k) := | |
| Finset.univ.filter (fun i => G.pathLine (p i).1 (p i).2 j β particleHeavy p Ξ· j) | |
| theorem probability_holeHeavy_single (H : G.Holes h) {Ξ· : β} (hΞ· : 0 < Ξ·) (j : Fin G.b) : | |
| (β p : G.Slot Γ G.Slot, if G.pathLine p.1 p.2 j β H.holeHeavy Ξ· j then G.endpointWeight p else 0) β€ | |
| 2*h/((G.size : β)*Ξ·) := by | |
| have hs : 0 < (G.size : β) := by unfold Grid.size; positivity | |
| have hm : 0 < ((2^G.bits j : β) : β) := by positivity | |
| have ht : β l, (H.lineCount j l : β) = h := by exact_mod_cast H.sum_lineCount j | |
| have hc := heavySet_card_mul_le (H.lineCount j) (((2^G.bits j : β) : β)*Ξ·/2) | |
| rw [ht] at hc | |
| have hline : β l : G.Line j, | |
| (β p : G.Slot Γ G.Slot, if G.pathLine p.1 p.2 j = l then G.endpointWeight p else 0) β€ | |
| ((2^G.bits j : β) : β)/G.size := by | |
| intro l | |
| exact le_of_eq (by simpa using G.probability_path_line j l) | |
| apply (probability_lineSet_le G.endpointWeight (fun p : G.Slot Γ G.Slot => G.pathLine p.1 p.2 j) | |
| (H.holeHeavy Ξ· j) (((2^G.bits j : β) : β)/G.size) hline).trans | |
| change ((heavySet (H.lineCount j) _).card : β) * _ β€ _ | |
| apply (le_div_iffβ (mul_pos hs hΞ·)).mpr | |
| field_simp at β’ | |
| nlinarith | |
| theorem probability_holeHeavyHits_le (H : G.Holes h) {Ξ· : β} (hΞ· : 0 < Ξ·) | |
| (hp : 2*h/((G.size : β)*Ξ·) β€ 1) (j : Fin G.b) (u : β) (hu : 0 β€ u) : | |
| Coverage.probability G.endpointWeight (fun p : Fin k β G.Slot Γ G.Slot => | |
| u β€ ((H.holeHeavyHits p Ξ· j).card : β)) β€ | |
| (2 : β)^k * (2*h/((G.size : β)*Ξ·))^u := by | |
| convert (probability_many_hits_le_rpow (I := Fin k) G.endpointWeight G.endpointWeight_nonneg | |
| G.endpointWeight_total (fun p : G.Slot Γ G.Slot => G.pathLine p.1 p.2 j β H.holeHeavy Ξ· j) | |
| _ (by positivity) hp (by convert H.probability_holeHeavy_single hΞ· j using 1; congr!) u hu) using 1 <;> | |
| simp only [holeHeavyHits, Fintype.card_fin] | |
| congr! | |
| theorem probability_particleHeavyHits_le {Ξ· : β} (hΞ· : 0 < Ξ·) | |
| (hp : 2*k/((G.size : β)*Ξ·) β€ 1) (j : Fin G.b) (u : β) (hu : 0 β€ u) : | |
| Coverage.probability G.endpointWeight (fun p : Fin k β G.Slot Γ G.Slot => | |
| u β€ ((particleHeavyHits p Ξ· j).card : β)) β€ | |
| ((Fintype.card (G.Line j)+1 : β) : β)^β2*k/(((2^G.bits j : β) : β)*Ξ·)ββ * | |
| (2 : β)^k * (2*k/((G.size : β)*Ξ·))^u := by | |
| have hs : 0 < (G.size : β) := by unfold Grid.size; positivity | |
| have hm : 0 < ((2^G.bits j : β) : β) := by positivity | |
| have hv : 0 < ((2^G.bits j : β) : β)*Ξ·/2 := by positivity | |
| have he : (k : β)/(((2^G.bits j : β) : β)*Ξ·/2) = 2*k/(((2^G.bits j : β) : β)*Ξ·) := by ring | |
| have hf : (β(k : β)/(((2^G.bits j : β) : β)*Ξ·/2)ββ : β)* | |
| (((2^G.bits j : β) : β)/G.size) β€ 2*k/((G.size : β)*Ξ·) := by | |
| apply le_trans (mul_le_mul_of_nonneg_right (Nat.floor_le (by positivity)) (by positivity)) | |
| apply le_of_eq | |
| field_simp | |
| have hb := probability_heavy_occupancy_le (I := Fin k) | |
| G.endpointWeight G.endpointWeight_nonneg G.endpointWeight_total | |
| (fun p : G.Slot Γ G.Slot => G.pathLine p.1 p.2 j) hv | |
| (2*k/((G.size : β)*Ξ·)) (((2^G.bits j : β) : β)/G.size) | |
| (by positivity) (by positivity) hp | |
| (fun l => le_of_eq (by simpa using G.probability_path_line j l)) | |
| (by simpa using hf) u hu | |
| convert hb using 1 <;> | |
| simp only [particleHeavyHits, particleHeavy, Fintype.card_fin, he] | |
| congr! | |
| theorem not_vertexIsolated_iff (H : G.Holes h) (hH : H.Feasible) | |
| (p : Fin k β G.Slot Γ G.Slot) (i : Fin k) : | |
| Β¬ H.VertexIsolated (fun i => (p i).1) (fun i => (p i).2) i β | |
| i β sharingCoverage G.vertexShares H.endpointData p := by | |
| simp only [VertexIsolated, sharingCoverage, mem_covered, Grid.vertexShares] | |
| constructor | |
| Β· intro hi | |
| by_cases ha : β a s, G.pathBetween (p i).1 (p i).2 s β H.path a s | |
| Β· have hj : Β¬ β j, i β j β β s, G.pathBetween (p i).1 (p i).2 s β G.pathBetween (p j).1 (p j).2 s := fun h => hi β¨ha,hβ© | |
| push Not at hj | |
| obtain β¨j,hij,t,hjtβ© := hj | |
| exact Or.inl β¨j,hij,t,hjtβ© | |
| Β· push Not at ha | |
| obtain β¨a,t,hatβ© := ha | |
| exact Or.inr β¨a,t,hat.trans (H.path_eq_pathBetween hH a t)β© | |
| Β· rintro (β¨j,hij,t,heβ© | β¨a,t,heβ©) hv | |
| Β· exact hv.2 j hij t he | |
| Β· exact hv.1 a t (he.trans (H.path_eq_pathBetween hH a t).symm) | |
| end CoordinateSweeps.Grid.Holes | |
| namespace CoordinateSweeps.Grid.Holes | |
| variable {G : Grid} {h k : β} | |
| open Coverage | |
| theorem not_good_cover (H : G.Holes h) (hH : H.Feasible) | |
| (p : Fin k β G.Slot Γ G.Slot) (Ξ· : β) (i : Fin k) | |
| (hi : i β H.goodSet (fun i => (p i).1) (fun i => (p i).2) Ξ·) : | |
| i β sharingCoverage G.vertexShares H.endpointData p β¨ | |
| β j, i β H.holeHeavyHits p Ξ· j β¨ i β particleHeavyHits p Ξ· j := by | |
| have hn : Β¬ H.Good (fun i => (p i).1) (fun i => (p i).2) Ξ· i := by simpa using hi | |
| by_cases hv : H.VertexIsolated (fun i => (p i).1) (fun i => (p i).2) i | |
| Β· right | |
| have hj : Β¬ β j, H.Light (fun i => (p i).1) (fun i => (p i).2) Ξ· | |
| (G.stagePath (fun i => (p i).1) (fun i => (p i).2) i j) := fun ht => hn β¨hv,htβ© | |
| push Not at hj | |
| obtain β¨j,hjβ© := hj | |
| refine β¨j,?_β© | |
| simp only [Light, Grid.stagePath, Nat.cast_add, not_le] at hj | |
| simp only [holeHeavyHits, particleHeavyHits, holeHeavy, particleHeavy, | |
| heavySet, Finset.mem_filter, Finset.mem_univ, true_and] | |
| change ((2^G.bits j : β) : β)*Ξ·/2 < (H.lineCount j (G.pathLine (p i).1 (p i).2 j) : β) β¨ | |
| ((2^G.bits j : β) : β)*Ξ·/2 < (auxCount (fun i => (p i).1) (fun i => (p i).2) | |
| Finset.univ j (G.pathLine (p i).1 (p i).2 j) : β) | |
| by_contra hc | |
| push Not at hc | |
| linarith | |
| Β· exact Or.inl ((H.not_vertexIsolated_iff hH p i).mp hv) | |
| theorem card_covered_by_good_and_bad (H : G.Holes h) (hH : H.Feasible) | |
| (p : Fin k β G.Slot Γ G.Slot) (Ξ· : β) : | |
| k β€ (H.goodSet (fun i => (p i).1) (fun i => (p i).2) Ξ·).card + | |
| (sharingCoverage G.vertexShares H.endpointData p).card + | |
| β j, ((H.holeHeavyHits p Ξ· j).card + (particleHeavyHits p Ξ· j).card) := by | |
| let A := H.goodSet (fun i => (p i).1) (fun i => (p i).2) Ξ· | |
| let V := sharingCoverage G.vertexShares H.endpointData p | |
| let B := (Finset.univ : Finset (Fin G.b)).biUnion | |
| (fun j => H.holeHeavyHits p Ξ· j βͺ particleHeavyHits p Ξ· j) | |
| have hc : (Finset.univ : Finset (Fin k)) β (A βͺ V) βͺ B := by | |
| intro i _ | |
| by_cases hi : i β A | |
| Β· exact Finset.mem_union_left _ (Finset.mem_union_left _ hi) | |
| Β· rcases H.not_good_cover hH p Ξ· i hi with hv | β¨j,hjβ© | |
| Β· exact Finset.mem_union_left _ (Finset.mem_union_right _ hv) | |
| Β· exact Finset.mem_union_right _ (Finset.mem_biUnion.mpr | |
| β¨j,Finset.mem_univ _, Finset.mem_union.mpr hjβ©) | |
| calc | |
| k = (Finset.univ : Finset (Fin k)).card := by simp | |
| _ β€ ((A βͺ V) βͺ B).card := Finset.card_le_card hc | |
| _ β€ (A βͺ V).card + B.card := Finset.card_union_le _ _ | |
| _ β€ (A.card+V.card) + B.card := Nat.add_le_add_right (Finset.card_union_le _ _) _ | |
| _ β€ (A.card+V.card) + β j, ((H.holeHeavyHits p Ξ· j).card + (particleHeavyHits p Ξ· j).card) := by | |
| apply Nat.add_le_add_left | |
| apply (Finset.card_biUnion_le).trans | |
| exact Finset.sum_le_sum (fun j _ => Finset.card_union_le _ _) | |
| theorem fewGood_cover (H : G.Holes h) (hH : H.Feasible) | |
| (p : Fin k β G.Slot Γ G.Slot) (Ξ· : β) | |
| (he : ((H.goodSet (fun i => (p i).1) (fun i => (p i).2) Ξ·).card : β) < k/2) : | |
| (k : β)/4 β€ ((sharingCoverage G.vertexShares H.endpointData p).card : β) β¨ | |
| β j, (k : β)/(8*G.b) β€ ((H.holeHeavyHits p Ξ· j).card : β) β¨ | |
| (k : β)/(8*G.b) β€ ((particleHeavyHits p Ξ· j).card : β) := by | |
| have hb : 0 < (G.b : β) := by exact_mod_cast G.positive | |
| by_contra hf | |
| push Not at hf | |
| have hc : (k : β) β€ (H.goodSet (fun i => (p i).1) (fun i => (p i).2) Ξ·).card + | |
| (sharingCoverage G.vertexShares H.endpointData p).card + | |
| β j, (((H.holeHeavyHits p Ξ· j).card : β) + (particleHeavyHits p Ξ· j).card) := by | |
| exact_mod_cast H.card_covered_by_good_and_bad hH p Ξ· | |
| have hsum : (β j, (((H.holeHeavyHits p Ξ· j).card : β) + (particleHeavyHits p Ξ· j).card)) β€ | |
| (G.b : β)*((k : β)/(4*G.b)) := by | |
| calc | |
| _ β€ β _j : Fin G.b, (k : β)/(4*G.b) := by | |
| apply Finset.sum_le_sum | |
| intro j _ | |
| have h1 := (hf.2 j).1 | |
| have h2 := (hf.2 j).2 | |
| have hid : (k : β)/(4*G.b) = 2*((k : β)/(8*G.b)) := by ring | |
| rw [hid] | |
| linarith | |
| _ = _ := by simp | |
| have hid : (G.b : β)*((k : β)/(4*G.b)) = k/4 := by field_simp | |
| rw [hid] at hsum | |
| linarith [hf.1] | |
| /- Source04:eq12 prior to choosing absolute parameters and absorbing | |
| subpolynomial factors. There is no conditioning on a particle-selected line set. -/ | |
| theorem probability_fewGood_le (H : G.Holes h) (hH : H.Feasible) {Ξ· : β} (hΞ· : 0 < Ξ·) | |
| (hh : 2*h/((G.size : β)*Ξ·) β€ 1) (hk : 2*k/((G.size : β)*Ξ·) β€ 1) | |
| (hv : ((k+h : β) : β)*G.vertexSharingRate β€ 1) : | |
| Coverage.probability G.endpointWeight (fun p : Fin k β G.Slot Γ G.Slot => | |
| ((H.goodSet (fun i => (p i).1) (fun i => (p i).2) Ξ·).card : β) < k/2) β€ | |
| (2 : β)^k * (((k+h : β) : β)*G.vertexSharingRate)^((k : β)/8) + | |
| β j : Fin G.b, ((2 : β)^k * (2*h/((G.size : β)*Ξ·))^((k : β)/(8*G.b)) + | |
| ((Fintype.card (G.Line j)+1 : β) : β)^β2*k/(((2^G.bits j : β) : β)*Ξ·)ββ * | |
| (2 : β)^k * (2*k/((G.size : β)*Ξ·))^((k : β)/(8*G.b))) := by | |
| let V := fun p : Fin k β G.Slot Γ G.Slot => | |
| (k : β)/4 β€ ((sharingCoverage G.vertexShares H.endpointData p).card : β) | |
| let B := fun (j : Fin G.b) (p : Fin k β G.Slot Γ G.Slot) => | |
| (k : β)/(8*G.b) β€ ((H.holeHeavyHits p Ξ· j).card : β) β¨ | |
| (k : β)/(8*G.b) β€ ((particleHeavyHits p Ξ· j).card : β) | |
| have hu := probability_coverage_le_real (I := Fin k) G.vertexShares G.vertexShares_symm | |
| H.endpointData G.endpointWeight G.endpointWeight_nonneg G.endpointWeight_total | |
| G.vertexSharingRate G.vertexSharingRate_nonneg G.probability_vertexShares_le | |
| (by simpa using hv) ((k : β)/4) (by positivity) | |
| have hV : Coverage.probability G.endpointWeight V β€ | |
| (2 : β)^k * (((k+h : β) : β)*G.vertexSharingRate)^((k : β)/8) := by | |
| simpa only [V, Fintype.card_fin, div_div, show (4:β)*2=8 by norm_num] using hu | |
| have hB (j : Fin G.b) : Coverage.probability G.endpointWeight (B j) β€ | |
| (2 : β)^k * (2*h/((G.size : β)*Ξ·))^((k : β)/(8*G.b)) + | |
| ((Fintype.card (G.Line j)+1 : β) : β)^β2*k/(((2^G.bits j : β) : β)*Ξ·)ββ * | |
| (2 : β)^k * (2*k/((G.size : β)*Ξ·))^((k : β)/(8*G.b)) := by | |
| apply (probability_or_le G.endpointWeight G.endpointWeight_nonneg _ _).trans | |
| exact add_le_add (H.probability_holeHeavyHits_le hΞ· hh j _ (by positivity)) | |
| (probability_particleHeavyHits_le hΞ· hk j _ (by positivity)) | |
| calc | |
| _ β€ Coverage.probability G.endpointWeight (fun p => V p β¨ β j, B j p) := | |
| probability_mono G.endpointWeight G.endpointWeight_nonneg (fun p hp => H.fewGood_cover hH p Ξ· hp) | |
| _ β€ Coverage.probability G.endpointWeight V + | |
| Coverage.probability G.endpointWeight (fun p => β j, B j p) := | |
| probability_or_le G.endpointWeight G.endpointWeight_nonneg _ _ | |
| _ β€ Coverage.probability G.endpointWeight V + | |
| β j, Coverage.probability G.endpointWeight (B j) := | |
| add_le_add le_rfl (probability_exists_le G.endpointWeight G.endpointWeight_nonneg B) | |
| _ β€ _ := add_le_add hV (Finset.sum_le_sum (fun j _ => hB j)) | |
| end CoordinateSweeps.Grid.Holes | |
| namespace CoordinateSweeps.Grid.Holes | |
| variable {G : Grid} {h k : β} | |
| /- An explicit absolute prefactor used before asymptotic absorption. -/ | |
| def uniformSparsePrefactor (G : Grid) (h k : β) : β := | |
| (2 : β)^k * Real.exp ((G.b : β)*(h+k)+Real.log 4*k*G.b) * | |
| (16*Real.exp 2)^(G.b*k) * (1+16*Real.exp 2)^(G.b*k) | |
| /- The source's good/bad entry split, in counting HS normalization. -/ | |
| theorem placementHSsq_uniform_le_fewGood (H : G.Holes h) {Ξ· : β} | |
| (hΞ· : 0 β€ Ξ·) (hΞ·small : Ξ· β€ 1/8) : | |
| H.placementHSsq (k := k) (fun _ => FiniteLaw.uniform _) β€ | |
| (uniformSparsePrefactor G h k)^2 * | |
| (Ξ·^((k : β)/2) + Coverage.probability G.endpointWeight | |
| (fun p : Fin k β G.Slot Γ G.Slot => | |
| ((H.goodSet (fun i => (p i).1) (fun i => (p i).2) Ξ·).card : β) < k/2)) := by | |
| let M := uniformSparsePrefactor G h k | |
| let Bad := fun p : Fin k β G.Slot Γ G.Slot => | |
| ((H.goodSet (fun i => (p i).1) (fun i => (p i).2) Ξ·).card : β) < k/2 | |
| have hM : 0 β€ M := by dsimp [M, uniformSparsePrefactor]; positivity | |
| have hΞ·1 : Ξ· β€ 1 := by linarith | |
| have hsum : β p : Fin k β G.Slot Γ G.Slot, Coverage.productMass G.endpointWeight p = 1 := by | |
| unfold Coverage.productMass | |
| rw [β Fintype.prod_sum] | |
| simp only [G.endpointWeight_total, Finset.prod_const_one] | |
| rw [H.placementHSsq_eq_full] | |
| calc | |
| _ β€ β p : Fin k β G.Slot Γ G.Slot, | |
| Coverage.productMass G.endpointWeight p * (M^2 * | |
| (Ξ·^((k : β)/2) + if Bad p then 1 else 0)) := by | |
| apply Finset.sum_le_sum | |
| intro p _ | |
| apply mul_le_mul_of_nonneg_left _ | |
| (Coverage.productMass_nonneg G.endpointWeight G.endpointWeight_nonneg p) | |
| by_cases hp : H.ValidInput (fun i => (p i).1) β§ H.ValidOutput (fun i => (p i).2) | |
| Β· rw [ite_eq_left hp] | |
| have he := H.scaled_placementKernel_good_bound (fun i => (p i).1) (fun i => (p i).2) | |
| hp.1 hΞ· hΞ·small | |
| change |(G.size : β)^k * H.placementKernel _ _ _| β€ M * | |
| Ξ·^(((H.goodSet (fun i => (p i).1) (fun i => (p i).2) Ξ·).card : β)/2) at he | |
| have hpow : Ξ·^(((H.goodSet (fun i => (p i).1) (fun i => (p i).2) Ξ·).card : β)/2) β€ 1 := | |
| Real.rpow_le_one hΞ· hΞ·1 (by positivity) | |
| by_cases hb : Bad p | |
| Β· rw [ite_eq_left hb] | |
| have hf : |(G.size : β)^k * H.placementKernel _ _ _| β€ M := | |
| he.trans (mul_le_of_le_one_right hM hpow) | |
| have hsq := (sq_le_sqβ (abs_nonneg _) hM).mpr hf | |
| rw [sq_abs] at hsq | |
| have he0 := Real.rpow_nonneg hΞ· ((k : β)/2) | |
| nlinarith [sq_nonneg M] | |
| Β· rw [ite_eq_right hb, add_zero] | |
| have hc : (k : β)/4 β€ ((H.goodSet (fun i => (p i).1) (fun i => (p i).2) Ξ·).card : β)/2 := by | |
| dsimp [Bad] at hb | |
| linarith | |
| have hmono := Real.rpow_le_rpow_of_exponent_ge' hΞ· hΞ·1 (by positivity) hc | |
| have hf := he.trans (mul_le_mul_of_nonneg_left hmono hM) | |
| have hsq := (sq_le_sqβ (abs_nonneg _) (mul_nonneg hM (Real.rpow_nonneg hΞ· _))).mpr hf | |
| simp only [sq_abs, mul_pow] at hsq | |
| have hid : (Ξ·^((k : β)/4))^2 = Ξ·^((k : β)/2) := by | |
| rw [β Real.rpow_natCast, β Real.rpow_mul hΞ·] | |
| congr 1 | |
| ring | |
| simpa only [mul_pow, hid] using hsq | |
| Β· rw [ite_eq_right hp] | |
| positivity | |
| _ = _ := by | |
| simp only [mul_add, Finset.sum_add_distrib] | |
| rw [β Finset.sum_mul, hsum, one_mul] | |
| rw [Coverage.probability, Finset.mul_sum] | |
| congr 1 | |
| apply Finset.sum_congr rfl | |
| intro p _ | |
| split_ifs <;> ring | |
| end CoordinateSweeps.Grid.Holes | |
| /- Required top-placement compression for the conditional main. The top space | |
| is the annihilator of all functions depending on a proper set of coordinates. | |
| This is the exact top level used in source04 around eq7. -/ | |
| noncomputable section | |
| open scoped BigOperators Matrix.Norms.L2Operator | |
| attribute [local instance] Classical.propDecidable | |
| namespace CoordinateSweeps.Grid.Holes | |
| variable {G : Grid} {h k : β} | |
| abbrev InputPlacements (H : G.Holes h) (k : β) := {x : Fin k β G.Slot // H.ValidInput x} | |
| abbrev OutputPlacements (H : G.Holes h) (k : β) := {y : Fin k β G.Slot // H.ValidOutput y} | |
| def placementTop (H : G.Holes h) (k : β) : Submodule β (H.OutputPlacements k β β) := | |
| Placement.topSpace (fun y : H.OutputPlacements k => y.val) | |
| def transitionMatrix (H : G.Holes h) | |
| (ΞΌ : β j, FiniteLaw (Equiv.Perm (Cube (G.bits j)))) : | |
| Matrix (H.InputPlacements k) (H.OutputPlacements k) β := | |
| fun x y => (H.extraProbability x.val y.val Finset.univ ΞΌ : β) | |
| theorem extraProbability_dependsOn (H : G.Holes h) | |
| (ΞΌ : β j, FiniteLaw (Equiv.Perm (Cube (G.bits j)))) (A : Finset (Fin k)) | |
| (x : H.InputPlacements k) : | |
| Placement.DependsOn (fun y : H.OutputPlacements k => y.val) A | |
| (fun y => (H.extraProbability x.val y.val A ΞΌ : β)) := by | |
| intro y y' hy | |
| apply congrArg Complex.ofReal | |
| rw [H.extraProbability_eq_conditionalEndpoint, H.extraProbability_eq_conditionalEndpoint] | |
| have he (Ο : G.Choices) : G.endpointEvent x.val y.val A Ο β G.endpointEvent x.val y'.val A Ο := by | |
| constructor <;> intro hw i hi | |
| Β· exact (hw i hi).trans (hy i hi) | |
| Β· exact (hw i hi).trans (hy i hi).symm | |
| simp only [conditionalEndpointProbability, he] | |
| theorem alternatingKernel_eq_placementKernel (H : G.Holes h) | |
| (ΞΌ : β j, FiniteLaw (Equiv.Perm (Cube (G.bits j)))) | |
| (x : H.InputPlacements k) (y : H.OutputPlacements k) : | |
| Placement.alternatingKernel (G.size : β) | |
| (fun A (x : H.InputPlacements k) (y : H.OutputPlacements k) => H.extraProbability x.val y.val A ΞΌ) | |
| x y = (H.placementKernel x.val y.val ΞΌ : β) := by | |
| simp only [Placement.alternatingKernel, placementKernel, Fintype.card_fin] | |
| theorem placementHSsq_eq_subtype (H : G.Holes h) | |
| (ΞΌ : β j, FiniteLaw (Equiv.Perm (Cube (G.bits j)))) : | |
| H.placementHSsq (k := k) ΞΌ = | |
| β x : H.InputPlacements k, β y : H.OutputPlacements k, | |
| β(H.placementKernel x.val y.val ΞΌ : β)β^2 := by | |
| simp only [Complex.norm_real, Real.norm_eq_abs, sq_abs] | |
| unfold placementHSsq | |
| symm | |
| rw [sum_subtype_eq_sum_ite_of_iff (p := H.ValidInput) (q := H.ValidInput) | |
| (fun x : Fin k β G.Slot => Iff.rfl) | |
| (fun x => β y : H.OutputPlacements k, H.placementKernel x y.val ΞΌ ^ 2)] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| split_ifs with hx | |
| Β· rw [sum_subtype_eq_sum_ite_of_iff (p := H.ValidOutput) (q := H.ValidOutput) | |
| (fun y : Fin k β G.Slot => Iff.rfl) (fun y => H.placementKernel x y ΞΌ ^ 2)] | |
| apply Finset.sum_congr rfl | |
| intro y _ | |
| simp only [hx, true_and] | |
| Β· apply Eq.symm | |
| simp only [hx, false_and, ite_false, Finset.sum_const_zero] | |
| /- Exact top-placement restriction of the ACTUAL conditioned sweep, bounded | |
| by the already proved path-weight Q counting norm. No representation-theoretic | |
| conclusion is inserted as a hypothesis. -/ | |
| theorem transitionMatrix_top_norm_le (H : G.Holes h) | |
| (ΞΌ : β j, FiniteLaw (Equiv.Perm (Cube (G.bits j)))) | |
| (v : EuclideanSpace β (H.OutputPlacements k)) | |
| (hv : (fun y => v y) β H.placementTop k) : | |
| β(EuclideanSpace.equiv (H.InputPlacements k) β).symm ((H.transitionMatrix ΞΌ).mulVec v)β β€ | |
| Real.sqrt (H.placementHSsq (k := k) ΞΌ) * βvβ := by | |
| have hs : (G.size : β) β 0 := by unfold Grid.size; positivity | |
| have hh := Placement.fullKernel_top_norm_le (fun y : H.OutputPlacements k => y.val) | |
| (G.size : β) hs | |
| (fun A (x : H.InputPlacements k) (y : H.OutputPlacements k) => H.extraProbability x.val y.val A ΞΌ) | |
| (H.extraProbability_dependsOn ΞΌ) v hv | |
| change β(EuclideanSpace.equiv (H.InputPlacements k) β).symm | |
| (Matrix.mulVec (fun x y => (H.extraProbability x.val y.val Finset.univ ΞΌ : β)) v)β β€ _ | |
| simpa only [H.alternatingKernel_eq_placementKernel, β H.placementHSsq_eq_subtype] using hh | |
| end CoordinateSweeps.Grid.Holes | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| open scoped Matrix.Norms.L2Operator | |
| end OAI | |