File size: 6,036 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | import OAI.Combinatorics.MatchingPSD.DominationDecoder
namespace OAI
namespace MatchingInterpolation
open MatchingSmoothing PerfectMatchingPSD Matrix
open scoped BigOperators MatrixOrder
attribute [local instance] Classical.propDecidable
noncomputable def cutValue (b : Bool) (x : Point) : β := x 0+x (if b then 2 else 1)-1
lemma cell_trace_value {s q r : β}
(Q : (Fin q β Bool) β Matrix (Fin r) (Fin r) β)
(B : Pairing (GlobalVertices s q) β Matrix (Fin r) (Fin r) β)
(hpair : β y M, (Q y*B M).trace = tableCoordinate (globalCutColor y) (true,false) M-1)
(y : Fin q β Bool) (i : Fin q) (x : Point)
(hx : β M : Pairing (TripleVertices s), crossVector threeColor M=x) :
(Q y*cellMatrix i B x).trace = cutValue (y i) x := by
have : Nonempty (Pairing (Fin s Γ Bool)) := β¨standardPairingβ©
rw [trace_cellMatrix]
apply cellAverage_const i _ x _ hx
intro M hM N
rw [hpair, extendLocal_cut, hM]
rfl
lemma cutValue_p (b : Bool) : cutValue b (origin+dirP) = 0 := by
cases b <;> norm_num [cutValue, origin, dirP, Matrix.cons_val_two, Matrix.vecHead, Matrix.vecTail]
lemma cutValue_star (b : Bool) : cutValue b (origin+dirStar) = 2 := by
cases b <;> norm_num [cutValue, origin, dirStar, Matrix.cons_val_two, Matrix.vecHead, Matrix.vecTail]
lemma cutValue_bit (b : Bool) : cutValue b (if b then origin+dirB else origin+dirA) = 2 := by
cases b <;> norm_num [cutValue, origin, dirA, dirB, Matrix.cons_val_two, Matrix.vecHead, Matrix.vecTail]
lemma cutValue_grid {d : β} {L : β} (hL : 0 β€ L) (g : GridIndex d) (b : Bool) :
cutValue b (scaledNode L g) β€ 2*(d:β)*L := by
have hk (a : Fin 3) : (g a : β) β€ (d:β) := by exact_mod_cast (Nat.le_of_lt_succ (g a).isLt)
have h0 := mul_le_mul_of_nonneg_left (hk 0) hL
have h1 := mul_le_mul_of_nonneg_left (hk 1) hL
have h2 := mul_le_mul_of_nonneg_left (hk 2) hL
cases b <;> norm_num [cutValue, scaledNode, origin, Matrix.cons_val_two, Matrix.vecHead, Matrix.vecTail] <;> nlinarith
lemma origin_star_eq : origin+dirStar = (![3,0,0] : Point) := by
ext a
fin_cases a <;> norm_num [origin, dirStar]
lemma weightMass_bound (d : β) : β c : β, 0 < c β§ β L : β, 1 β€ L β
weightMass d L β€ c/L^2 := by
obtain β¨c,hc,hboundβ© := weights_bound d
refine β¨(Fintype.card (GridIndex d) : β)*c, mul_pos (by positivity) hc, ?_β©
intro L hL
have he := Finset.sum_le_sum (s := Finset.univ) (fun g _ => hbound L hL g)
simpa only [weightMass, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_div_assoc] using he
lemma cell_decoder {s q l r d : β} (hs : 1 β€ s) (hq : 1 β€ q) (hsl : 2*l*d β€ s)
(Q : (Fin q β Bool) β Matrix (Fin r) (Fin r) β)
(B : Pairing (GlobalVertices s q) β Matrix (Fin r) (Fin r) β)
(hQ : β y, (Q y).PosSemidef) (hB : β M, (B M).PosSemidef)
(hpair : β y M, (Q y*B M).trace = tableCoordinate (globalCutColor y) (true,false) M-1)
(P : Fin q β Fin r β Fin r β Point β β)
(hP : β i u v, P i u v β lowDegree coord d)
{Ξ· m Ξ΄ : β} (hΞ· : 0 β€ Ξ·) (hΞ΄ : 0 < Ξ΄) (hl : 0 < l)
(hm : β y, (Q y).trace β€ m)
(happrox : β i u v t, |cellMatrix i B (samplePoint d (2*l) t) u v-
P i u v (samplePoint d (2*l) t)| β€ Ξ·)
(hΞ΅ : 0 β€ (q:β)*(weightMass d (2*l)*(2*d*(2*l))+
(r:β)*(6+weightMass d (2*l))*Ξ·*m)+Ξ΄*m)
(hsmall : (q:β)*Real.sqrt ((q:β)*(weightMass d (2*l)*(2*d*(2*l))+
(r:β)*(6+weightMass d (2*l))*Ξ·*m)+Ξ΄*m) β€ 1/4) :
(2:β)^q/2 β€ r := by
let L : β := 2*l
have hL : 0 < L := by dsimp [L]; positivity
let C := fun i => cellMatrix i B
have hC (i : Fin q) (x : Point) : (C i x).PosSemidef := cellMatrix_psd i B hB x
have hsamp (y : Fin q β Bool) (i : Fin q) (t : SampleIndex d) :
(Q y*C i (samplePoint d L t)).trace = cutValue (y i) (samplePoint d L t) :=
cell_trace_value Q B hpair y i _ (sample_witness hs hsl t)
have hfive (y : Fin q β Bool) (i : Fin q) (j : Fin 5) :
(Q y*C i (specialPoint j)).trace = cutValue (y i) (specialPoint j) := hsamp y i (.inl j)
have hp (y : Fin q β Bool) (i : Fin q) : (Q y*C i (origin+dirP)).trace=0 :=
(hfive y i 1).trans (cutValue_p _)
have hstar (y : Fin q β Bool) (i : Fin q) : (Q y*C i (origin+dirStar)).trace=2 :=
(hfive y i 2).trans (cutValue_star _)
have hgrid (y : Fin q β Bool) (i : Fin q) (g : GridIndex d) :
(Q y*C i (scaledNode L g)).trace β€ 2*(d:β)*L :=
(hsamp y i (.inr g)).le.trans (cutValue_grid hL.le g (y i))
have hEex (i : Fin q) := interpolation_matrix_domination d (C i) (hC i) (P i) (hP i)
hL.ne' hΞ· (fun j u v => happrox i u v (.inl j)) (fun g u v => happrox i u v (.inr g))
choose E hE hdom hEb using hEex
let iβ : Fin q := β¨0,by omegaβ©
let S := C iβ (origin+dirStar)
have hcommon (i : Fin q) : C i (origin+dirStar)=S := by
dsimp only [S,C]
rw [origin_star_eq]
exact cellMatrix_star i iβ B 3
let T := fun i (b : Bool) => if b then C i (origin+dirB) else C i (origin+dirA)
have hT (i : Fin q) (b : Bool) : (T i b).PosSemidef := by
cases b <;> exact hC i _
have hTdom (i : Fin q) : T i false+T i true β€ S+(2:β) β’ C i (origin+dirP)+E i := by
change C i (origin+dirA)+C i (origin+dirB) β€ S+(2:β) β’ C i (origin+dirP)+E i
rw [β hcommon i]
exact hdom i
have hbit (y : Fin q β Bool) (i : Fin q) : (Q y*T i (y i)).trace=2 := by
cases hy : y i
Β· exact (hfive y i 3).trans (by rw [hy]; exact cutValue_bit false)
Β· exact (hfive y i 4).trans (by rw [hy]; exact cutValue_bit true)
have he (y : Fin q β Bool) (i : Fin q) : (Q y*E i).trace β€
weightMass d L*(2*(d:β)*L)+(r:β)*(6+weightMass d L)*Ξ·*m := by
simpa only [Fintype.card_fin] using hEb i (Q y) m (2*(d:β)*L) (hm y) (hgrid y i)
simpa only [Fintype.card_fin] using domination_decoder Q T (fun i => C i (origin+dirP)) E S hQ hT
(fun i => hC i _) hE (hC iβ _) hTdom hp (fun y => hstar y iβ) hbit hΞ΄ hm he hΞ΅ hsmall
end MatchingInterpolation
end OAI
|