Download data/lean/OAI/Probability/BinarySweep/TensorBounds/SignedPinching.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.55 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/TensorBounds/SignedPinching.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/BinarySweep/TensorBounds/SignedPinching.lean
-
curl -L -o SignedPinching.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/TensorBounds/SignedPinching.lean
3.55 kB
| import Mathlib | |
| import OAI.Probability.BinarySweep.TensorBounds.EvenPostselection | |
| import OAI.Probability.BinarySweep.MatrixBounds.SparsePinching | |
| namespace OAI | |
| noncomputable section | |
| open scoped BigOperators Classical ComplexOrder | |
| open Equiv Equiv.Perm Matrix | |
| namespace BinaryCoordinateSweeps.Signed | |
| open Density | |
| variable {A : Type*} [Fintype A] [DecidableEq A] {n : β} | |
| lemma pinch_trace {I J : Type*} [Fintype I] [DecidableEq J] (f : I β J) (M : Matrix I I β) : | |
| (pinch f M).trace = M.trace := by | |
| simp only [Matrix.trace, Matrix.diag, pinch, ite_true] | |
| omit [Fintype A] [DecidableEq A] in | |
| lemma comp_parity_eq_iff (p : A β Bool) (x y : Fin n β A) (g : Equiv.Perm (Fin n)) : | |
| p β (x β g) = p β (y β g) β p β x = p β y := by | |
| constructor | |
| Β· intro h | |
| funext i | |
| simpa only [Function.comp_apply, Equiv.apply_symm_apply] using congrFun h (g.symm i) | |
| Β· intro h | |
| exact congrArg (fun f => f β g) h | |
| omit [Fintype A] [DecidableEq A] in | |
| lemma pinch_block (p : A β Bool) (M : Matrix (Fin n β A) (Fin n β A) β) | |
| (x y : Fin n β A) (h : p β x β p β y) : | |
| pinch (fun w => p β w) M x y = 0 := ite_eq_right h | |
| omit [Fintype A] [DecidableEq A] in | |
| lemma pinch_invariant (p : A β Bool) (M : Matrix (Fin n β A) (Fin n β A) β) | |
| (hM : Invariant p M) (g : Equiv.Perm (Fin n)) (x y : Fin n β A) : | |
| pinch (fun w => p β w) M (x β g) (y β g) = pinch (fun w => p β w) M x y := by | |
| simp only [pinch, comp_parity_eq_iff] | |
| split_ifs with h | |
| Β· exact invariant_same_parity p M hM g x y h | |
| Β· rfl | |
| omit [DecidableEq A] in | |
| lemma signed_sparse_pinching (p : A β Bool) (M : Matrix (Fin n β A) (Fin n β A) β) | |
| (hM : M.PosSemidef) (hInv : Invariant p M) : | |
| (((n+1 : β)^((Fintype.card A)^2) : β) β’ pinch (fun w => p β w) M - M).PosSemidef := by | |
| let R : (Fin n β Bool) β (Fin n β Bool) β Prop := | |
| fun a b => hamming a b β€ (Fintype.card A)^2 | |
| have hR : β β¦left rightβ¦, R left right β R right left := by | |
| intro a b h | |
| change hamming b a β€ (Fintype.card A)^2 | |
| rw [hamming_symm b a] | |
| exact h | |
| have hD : β a : Fin n β Bool, (Finset.univ.filter (R a)).card β€ | |
| (n+1)^((Fintype.card A)^2) := by | |
| intro a | |
| simpa only [Fintype.card_fin] using hamming_degree a ((Fintype.card A)^2) | |
| have hz : β x y : Fin n β A, Β¬R (p β x) (p β y) β M x y = 0 := by | |
| intro x y h | |
| by_contra hn | |
| exact h (invariant_mismatch_card p M hInv x y hn) | |
| simpa only [Nat.cast_pow] using | |
| sparse_pinching (fun w => p β w) R hR ((n+1)^((Fintype.card A)^2)) hD hM hz | |
| theorem signed_psd_postselection (n : β) (hn : 0 < n) (p : A β Bool) | |
| (M : Matrix (Fin n β A) (Fin n β A) β) (hM : M.PosSemidef) (hInv : Invariant p M) : | |
| ((((n+1 : β)^((Fintype.card A)^2) : β) * M.trace) β’ | |
| (β c : WordType (MatchedPair p) n, β t : MatchedPair p β ZMod (n+1), | |
| matrixTensorPower n (reducedPhaseDensity n (matchedEmbedding p) c t)) - M).PosSemidef := by | |
| let Q := pinch (fun w => p β w) M | |
| have hQ := pinch_posSemidef (fun w => p β w) hM | |
| have hd := even_block_postselection n hn p Q hQ (pinch_block p M) (pinch_invariant p M hInv) | |
| rw [pinch_trace] at hd | |
| have hc : (0 : β) β€ ((n+1 : β)^((Fintype.card A)^2) : β) := by | |
| exact_mod_cast Nat.zero_le ((n+1)^((Fintype.card A)^2)) | |
| have hh := (hd.smul hc).add (signed_sparse_pinching p M hM hInv) | |
| simp only [smul_sub, smul_smul] at hh | |
| convert hh using 1; dsimp only [Q]; abel | |
| end BinaryCoordinateSweeps.Signed | |
| end | |
| end OAI | |