Buckets:
| import OAI.Combinatorics.MatchingPSD.MatrixBounds | |
| namespace OAI | |
| universe u_1 u_2 u_3 u_4 u_5 u_6 | |
| namespace PerfectMatchingPSD | |
| open Matrix MatchingSmoothing | |
| open scoped BigOperators MatrixOrder | |
| attribute [local instance] Classical.propDecidable | |
| variable {R : Type u_1} {X : Type u_2} [Fintype R] [DecidableEq R] [Fintype X] | |
| omit [Fintype R] [DecidableEq R] in | |
| lemma matrix_expect_eq (f : X โ Matrix R R โ) : | |
| (๐ผ x, f x) = ((Fintype.card X : โ)โปยน) โข (โ x, f x) := by | |
| ext i j | |
| simp [Finset.expect, NNRat.smul_def] | |
| omit [Fintype R] [DecidableEq R] in | |
| lemma matrix_expect_apply (f : X โ Matrix R R โ) (u v : R) : | |
| (๐ผ x, f x) u v = ๐ผ x, f x u v := by | |
| rw [matrix_expect_eq, Fintype.expect_eq_sum_div_card] | |
| simp only [Matrix.smul_apply, Matrix.sum_apply, smul_eq_mul, div_eq_inv_mul] | |
| omit [Fintype R] [DecidableEq R] in | |
| lemma matrix_expect_psd (f : X โ Matrix R R โ) (hf : โ x, (f x).PosSemidef) : | |
| (๐ผ x, f x).PosSemidef := by | |
| rw [matrix_expect_eq] | |
| exact (matrix_sum_psd Finset.univ f (fun x _ => hf x)).smul | |
| (inv_nonneg.mpr (Nat.cast_nonneg _)) | |
| lemma trace_mul_expect (Q : Matrix R R โ) (f : X โ Matrix R R โ) : | |
| (Q * (๐ผ x, f x)).trace = ๐ผ x, (Q*f x).trace := by | |
| rw [matrix_expect_eq, mul_smul_comm, Matrix.trace_smul, | |
| Finset.mul_sum, Matrix.trace_sum, Fintype.expect_eq_sum_div_card] | |
| change (Fintype.card X : โ)โปยน * _ = _ / Fintype.card X | |
| rw [div_eq_inv_mul] | |
| lemma expect_abs_bound (f : X โ โ) {b : โ} (hb : 0 โค b) (hf : โ x, |f x| โค b) : | |
| |๐ผ x, f x| โค b := by | |
| by_cases hX : Nonempty X | |
| ยท let := hX | |
| have h0 (x : X) : -b โค f x := (abs_le.mp (hf x)).1 | |
| have h1 (x : X) : f x โค b := (abs_le.mp (hf x)).2 | |
| apply abs_le.mpr | |
| constructor | |
| ยท simpa using Finset.expect_le_expect (s := Finset.univ) (fun x _ => h0 x) | |
| ยท simpa using Finset.expect_le_expect (s := Finset.univ) (fun x _ => h1 x) | |
| ยท have : IsEmpty X := not_nonempty_iff.mp hX | |
| simpa using hb | |
| section CellMatrices | |
| variable {A : Type u_3} {B : Type u_4} {C : Type u_5} {I : Type u_6} [Fintype A] [Fintype B] [Fintype C] [Fintype I] [DecidableEq I] | |
| noncomputable def extensionMatrix (i : I) | |
| (Bf : Pairing ((A โ B) โ (I ร C)) โ Matrix R R โ) | |
| (M : Pairing ((A โ B) โ C)) : Matrix R R โ := | |
| ๐ผ N : {j : I // j โ i} โ Pairing C, Bf (extendLocal i M N) | |
| noncomputable def cellMatrix (i : I) | |
| (Bf : Pairing ((A โ B) โ (I ร C)) โ Matrix R R โ) | |
| (x : Fin 3 โ โ) : Matrix R R โ := | |
| ๐ผ M : {M : Pairing ((A โ B) โ C) // crossVector threeColor M = x}, extensionMatrix i Bf M.1 | |
| omit [Fintype R] [DecidableEq R] in | |
| lemma cellMatrix_apply (i : I) (Bf : Pairing ((A โ B) โ (I ร C)) โ Matrix R R โ) | |
| (x : Fin 3 โ โ) (u v : R) : | |
| cellMatrix i Bf x u v = cellAverage i (fun M => Bf M u v) x := by | |
| rw [cellAverage, predicateAverage_eq_expect] | |
| simp only [cellMatrix, extensionMatrix, extensionAverage, matrix_expect_apply] | |
| apply Finset.expect_congr (by ext; simp) | |
| intro M _ | |
| rfl | |
| omit [Fintype R] [DecidableEq R] in | |
| lemma cellMatrix_psd (i : I) (Bf : Pairing ((A โ B) โ (I ร C)) โ Matrix R R โ) | |
| (hB : โ M, (Bf M).PosSemidef) (x : Fin 3 โ โ) : | |
| (cellMatrix i Bf x).PosSemidef := by | |
| apply matrix_expect_psd | |
| intro M | |
| apply matrix_expect_psd | |
| intro N | |
| exact hB _ | |
| omit [Fintype R] [DecidableEq R] in | |
| lemma cellMatrix_star (i j : I) (Bf : Pairing ((A โ B) โ (I ร C)) โ Matrix R R โ) | |
| (x : โ) : cellMatrix i Bf ![x,0,0] = cellMatrix j Bf ![x,0,0] := by | |
| ext u v | |
| simp only [cellMatrix_apply, cellAverage_star] | |
| lemma trace_cellMatrix (i : I) (Bf : Pairing ((A โ B) โ (I ร C)) โ Matrix R R โ) | |
| (Q : Matrix R R โ) (x : Fin 3 โ โ) : | |
| (Q*cellMatrix i Bf x).trace = cellAverage i (fun M => (Q*Bf M).trace) x := by | |
| rw [cellAverage, predicateAverage_eq_expect, cellMatrix, trace_mul_expect] | |
| apply Finset.expect_congr (by ext; simp) | |
| intro M _ | |
| exact trace_mul_expect Q _ | |
| omit [Fintype A] [Fintype B] in | |
| lemma extensionAverage_sq_bound (i : I) | |
| (Bf : Pairing ((A โ B) โ (I ร C)) โ Matrix R R โ) | |
| (hB : โ M, (Bf M).PosSemidef) {b : โ} (hb : 0 โค b) | |
| (htr : โ M, (Bf M).trace โค b) (u v : R) (M : Pairing ((A โ B) โ C)) : | |
| (extensionAverage i (fun N => Bf N u v) M)^2 โค b^2 := by | |
| have he := expect_abs_bound (fun N => Bf (extendLocal i M N) u v) hb | |
| (fun N => (posSemidef_entry_abs_le_trace (hB _) u v).trans (htr _)) | |
| have hex : extensionAverage i (fun N => Bf N u v) M = | |
| ๐ผ N : {j : I // j โ i} โ Pairing C, Bf (extendLocal i M N) u v := by | |
| apply Finset.expect_congr (by ext; simp) | |
| intro N _ | |
| rfl | |
| rw [hex] | |
| simpa only [sq_abs] using (sq_le_sqโ (abs_nonneg _) hb).mpr he | |
| end CellMatrices | |
| end PerfectMatchingPSD | |
| end OAI | |
Xet Storage Details
- Size:
- 4.81 kB
- Xet hash:
- 1f6ed0b1165c8407c808995f06e2ed31d3f5e14802acaa442529b9c43f83235d
ยท
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.