Download data/lean/OAI/Combinatorics/MatchingPSD/DominationDecoder.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.16 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingPSD/DominationDecoder.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingPSD/DominationDecoder.lean
-
curl -L -o DominationDecoder.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingPSD/DominationDecoder.lean
3.16 kB
| import OAI.Combinatorics.MatchingPSD.GoodCells | |
| namespace OAI | |
| universe u_1 | |
| namespace PerfectMatchingPSD | |
| open Matrix | |
| open scoped BigOperators MatrixOrder | |
| attribute [local instance] Classical.propDecidable | |
| lemma domination_decoder {R : Type u_1} [Fintype R] [DecidableEq R] {q : β} | |
| (Q : (Fin q β Bool) β Matrix R R β) | |
| (T : Fin q β Bool β Matrix R R β) (P E : Fin q β Matrix R R β) | |
| (S : Matrix R R β) | |
| (hQ : β y, (Q y).PosSemidef) (hT : β i b, (T i b).PosSemidef) | |
| (hP : β i, (P i).PosSemidef) (hE : β i, (E i).PosSemidef) (hS : S.PosSemidef) | |
| (hdom : β i, T i false + T i true β€ S+(2:β) β’ P i+E i) | |
| (hzero : β y i, (Q y*P i).trace=0) (hstar : β y, (Q y*S).trace=2) | |
| (hbit : β y i, (Q y*T i (y i)).trace=2) | |
| {m e Ξ΄ : β} (hΞ΄ : 0 < Ξ΄) (hm : β y, (Q y).trace β€ m) | |
| (he : β y i, (Q y*E i).trace β€ e) | |
| (hΞ΅ : 0 β€ (q:β)*e+Ξ΄*m) | |
| (hsmall : (q:β)*Real.sqrt ((q:β)*e+Ξ΄*m) β€ 1/4) : | |
| (2:β)^q/2 β€ Fintype.card R := by | |
| let F := fun i => (2:β) β’ P i+E i | |
| have hF (i : Fin q) : (F i).PosSemidef := (hP i).smul (by norm_num) |>.add (hE i) | |
| let D := S+(β i, F i)+Ξ΄ β’ (1 : Matrix R R β) | |
| have hsum : (β i, F i).PosSemidef := matrix_sum_psd _ _ (fun i _ => hF i) | |
| have hdelt : (Ξ΄ β’ (1 : Matrix R R β)).PosDef := Matrix.PosDef.one.smul hΞ΄ | |
| have hD : D.PosDef := by | |
| simpa only [D, add_comm] using hdelt.add_posSemidef (hS.add hsum) | |
| have hleS : S β€ D := by | |
| have he := add_nonneg hsum.nonneg hdelt.posSemidef.nonneg | |
| dsimp [D] | |
| simpa only [add_assoc] using le_add_of_nonneg_right he | |
| have hdomD (i : Fin q) : T i false+T i true β€ D := by | |
| apply (hdom i).trans | |
| have hi : F i β€ β j, F j := Finset.single_le_sum (fun j _ => (hF j).nonneg) (Finset.mem_univ i) | |
| calc | |
| S+(2:β) β’ P i+E i = S+F i := by dsimp [F]; abel | |
| _ β€ S+(β j, F j) := by simpa only [add_comm] using add_le_add_left hi S | |
| _ β€ D := le_add_of_nonneg_right hdelt.posSemidef.nonneg | |
| have htr (y : Fin q β Bool) : 2 β€ (Q y*D).trace β§ (Q y*D).trace β€ 2+((q:β)*e+Ξ΄*m) := by | |
| constructor | |
| Β· rw [β hstar y] | |
| exact trace_mul_le_of_le (hQ y) hleS | |
| Β· dsimp [D] | |
| rw [mul_add, mul_add, Matrix.trace_add, Matrix.trace_add, hstar, | |
| Finset.mul_sum, Matrix.trace_sum, mul_smul_comm, Matrix.trace_smul, mul_one] | |
| have hsumtr : (β i, (Q y*F i).trace) β€ (q:β)*e := by | |
| have hh := Finset.sum_le_sum (s := Finset.univ) (fun i _ => he y i) | |
| have hFi (i : Fin q) : (Q y*F i).trace = (Q y*E i).trace := by | |
| simp only [F, mul_add, Matrix.trace_add, mul_smul_comm, Matrix.trace_smul, | |
| hzero, smul_zero, zero_add] | |
| simpa only [hFi, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] using hh | |
| have hΞ΄m := mul_le_mul_of_nonneg_left (hm y) hΞ΄.le | |
| change _ + Ξ΄*(Q y).trace β€ _ | |
| linarith | |
| obtain β¨Ο,H,hΟ,htΟ,hH,hpair,hbit'β© := states_of_domination Q T D hD hQ hT hdomD | |
| ((q:β)*e+Ξ΄*m) hΞ΅ htr hbit | |
| exact nearly_perfect_bit_tests Ο H hΟ htΟ hH hpair _ hΞ΅ hsmall hbit' | |
| end PerfectMatchingPSD | |
| end OAI | |