Download data/lean/OAI/Combinatorics/MatchingPSD/GoodCells.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingPSD/GoodCells.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingPSD/GoodCells.lean
-
curl -L -o GoodCells.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingPSD/GoodCells.lean
4.4 kB
| import OAI.Combinatorics.MatchingPSD.MatrixInterpolation | |
| namespace OAI | |
| namespace MatchingInterpolation | |
| open MatchingSmoothing PerfectMatchingPSD Matrix | |
| open scoped BigOperators | |
| attribute [local instance] Classical.propDecidable | |
| abbrev SampleIndex (d : β) := Fin 5 β GridIndex d | |
| noncomputable def samplePoint (d : β) (L : β) : SampleIndex d β Point := | |
| Sum.elim specialPoint (scaledNode L) | |
| lemma specialPoint_explicit (j : Fin 5) : | |
| specialPoint j = (![![1,0,0], ![0,1,1], ![3,0,0], ![1,2,0], ![1,0,2]] j : Point) := by | |
| fin_cases j <;> ext a <;> fin_cases a <;> norm_num [specialPoint, origin, dirP, dirStar, dirA, dirB] | |
| lemma sample_witness {s l d : β} (hs : 1 β€ s) (hsl : 2*l*d β€ s) (t : SampleIndex d) : | |
| β M : Pairing (TripleVertices s), crossVector threeColor M = samplePoint d (2*l) t := by | |
| rcases t with j | g | |
| Β· rw [samplePoint, Sum.elim_inl, specialPoint_explicit] | |
| exact triple_pairing_five hs j | |
| Β· exact triple_pairing_grid hsl g | |
| lemma good_cell_polynomials (K : β) : | |
| β d H : β, 0 < d β§ β s q l r : β, H β€ 3*s+1 β 1 β€ s β 2*l*d β€ s β | |
| β (B : Pairing (GlobalVertices s q) β Matrix (Fin r) (Fin r) β), | |
| (β M, (B M).PosSemidef) β (β M, (B M).trace β€ (r:β)) β | |
| β Ξ· : β, 0 β€ Ξ· β | |
| (q:β)*r^4*(Fintype.card (SampleIndex d))*((2*(3*s+1):β)^(2*K))β»ΒΉ β€ Ξ·^2 β | |
| β a : Equiv.Perm (GlobalVertices s q), | |
| β P : Fin q β Fin r β Fin r β Point β β, | |
| (β i u v, P i u v β lowDegree coord d) β§ | |
| β i u v t, |cellMatrix i (fun M => B (Pairing.relabel a M)) | |
| (samplePoint d (2*l) t) u v-P i u v (samplePoint d (2*l) t)| β€ Ξ· := by | |
| classical | |
| obtain β¨d,H,hd,hmainβ© := simultaneous_cross_approximation K | |
| refine β¨d,H,hd,?_β© | |
| intro s q l r hH hs hsl B hB htr Ξ· hΞ· hnum | |
| let J := Fin q Γ (Fin r Γ Fin r) | |
| let T := SampleIndex d | |
| let M : T β Pairing (TripleVertices s) := fun t => (sample_witness hs hsl t).choose | |
| have hM (t : T) : crossVector threeColor (M t) = samplePoint d (2*l) t := | |
| (sample_witness hs hsl t).choose_spec | |
| let g (j : J) (a : Equiv.Perm (GlobalVertices s q)) (N : Pairing (TripleVertices s)) : β := | |
| extensionAverage j.1 (fun Z => B (Pairing.relabel a Z) j.2.1 j.2.2) N | |
| have hg (j : J) (a : Equiv.Perm (GlobalVertices s q)) (p : Equiv.Perm (TripleVertices s)) : | |
| g j (a * liftLocal j.1 p) = fun N => g j a (Pairing.relabel p N) := by | |
| funext N | |
| dsimp only [g] | |
| rw [extensionAverage_relabel] | |
| simp only [Pairing.relabel_mul] | |
| have hgb (j : J) (a : Equiv.Perm (GlobalVertices s q)) (N : Pairing (TripleVertices s)) : | |
| (g j a N)^2 β€ (r:β)^2 := | |
| extensionAverage_sq_bound j.1 _ (fun Z => hB _) (Nat.cast_nonneg r) | |
| (fun Z => htr _) j.2.1 j.2.2 N | |
| obtain β¨a,P,hP,hboundβ© := hmain (3*s+1) hH (TripleVertices s) | |
| (Equiv.Perm (GlobalVertices s q)) J T (tripleEquiv s) (fun _ => threeColor) | |
| (fun _ c => triple_histogram_pos (by omega) c) (fun _ => M) | |
| (fun j => liftLocal j.1) g hg (r:β) hgb | |
| refine β¨a,fun i u v => P (i,u,v),fun i u v => hP (i,u,v),?_β© | |
| intro i u v t | |
| let E (j : J) (t : T) := | |
| predicateAverage (fun N => crossVector threeColor N = crossVector threeColor (M t)) (g j a) - | |
| P j (crossVector threeColor (M t)) | |
| have hjt : (E (i,u,v) t)^2 β€ β j, β t, (E j t)^2 := by | |
| exact (Finset.single_le_sum (fun z _ => sq_nonneg (E (i,u,v) z)) (Finset.mem_univ t)).trans | |
| (Finset.single_le_sum (fun j _ => Finset.sum_nonneg (fun z _ => sq_nonneg (E j z))) | |
| (Finset.mem_univ (i,u,v))) | |
| have hb : (β j, β t, (E j t)^2) β€ Ξ·^2 := by | |
| apply hbound.trans | |
| have heq : (Fintype.card J : β)*(Fintype.card T)*((2*(3*s+1:β):β)^(2*K))β»ΒΉ*(r:β)^2 = | |
| (q:β)*r^4*(Fintype.card (SampleIndex d))*((2*(3*s+1):β)^(2*K))β»ΒΉ := by | |
| simp only [J, T, Fintype.card_prod, Fintype.card_fin, Nat.cast_mul, Nat.cast_add, Nat.cast_ofNat] | |
| ring | |
| rw [heq] | |
| exact hnum | |
| have hab : |E (i,u,v) t| β€ Ξ· := (sq_le_sqβ (abs_nonneg _) hΞ·).mp | |
| (by simpa only [sq_abs] using hjt.trans hb) | |
| have he : E (i,u,v) t = cellMatrix i (fun Z => B (Pairing.relabel a Z)) | |
| (samplePoint d (2*l) t) u v-P (i,u,v) (samplePoint d (2*l) t) := by | |
| rw [cellMatrix_apply] | |
| dsimp only [E, cellAverage, g] | |
| rw [hM] | |
| rwa [he] at hab | |
| end MatchingInterpolation | |
| end OAI | |