Download data/lean/OAI/RepresentationTheory/RowColumn/LineStates.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 19.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/RepresentationTheory/RowColumn/LineStates.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/RepresentationTheory/RowColumn/LineStates.lean
-
curl -L -o LineStates.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/RepresentationTheory/RowColumn/LineStates.lean
19.4 kB
| import OAI.RepresentationTheory.RowColumn.TensorFilter | |
| import OAI.RepresentationTheory.RowColumn.HookIsometry | |
| namespace OAI | |
| section | |
| noncomputable section | |
| open scoped BigOperators Classical | |
| namespace RowColumn.Postselection | |
| open WordOrbits | |
| variable {S L A : Type*} [Fintype S] [DecidableEq S] [Fintype L] [DecidableEq L] | |
| [Fintype A] [DecidableEq A] | |
| def allocationPerm (line b : S β L) (hb : counts b = counts line) : Equiv.Perm S := | |
| (same_counts_permutation line b hb.symm).choose | |
| omit [DecidableEq S] [Fintype L] in | |
| lemma allocationPerm_spec (line b : S β L) (hb : counts b = counts line) (i : S) : | |
| b (allocationPerm line b hb i) = line i := | |
| (same_counts_permutation line b hb.symm).choose_spec i | |
| omit [DecidableEq S] [Fintype A] in | |
| lemma counts_precomp (w : S β A) (p : Equiv.Perm S) : counts (w β p) = counts w := by | |
| funext c | |
| apply Fin.ext | |
| exact Fintype.card_congr | |
| { toFun := fun i => β¨p i.1,i.2β© | |
| invFun := fun i => β¨p.symm i.1,by simpa using i.2β© | |
| left_inv := by intro i; apply Subtype.ext; simp | |
| right_inv := by intro i; apply Subtype.ext; simp } | |
| def symExtension (line : S β L) (v : (S β A) β β) (w : S β L Γ A) : β := | |
| if hb : counts (fun i => (w i).1) = counts line then | |
| v (fun i => (w (allocationPerm line _ hb i)).2) else 0 | |
| omit [Fintype A] [DecidableEq A] in | |
| omit [DecidableEq S] in | |
| lemma symExtension_on_line (line : S β L) (v : (S β A) β β) | |
| (hv : β p : Equiv.Perm S, (β i, line (p i) = line i) β β w, v (w β p) = v w) | |
| (w : S β A) : symExtension line v (fun i => (line i,w i)) = v w := by | |
| simp only [symExtension] | |
| exact hv (allocationPerm line line rfl) (allocationPerm_spec line line rfl) w | |
| omit [Fintype A] [DecidableEq A] in | |
| omit [DecidableEq S] in | |
| lemma symExtension_invariant (line : S β L) (v : (S β A) β β) | |
| (hv : β p : Equiv.Perm S, (β i, line (p i) = line i) β β w, v (w β p) = v w) | |
| (p : Equiv.Perm S) (w : S β L Γ A) : symExtension line v (w β p) = symExtension line v w := by | |
| have hc : counts (fun i => (w (p i)).1) = counts (fun i => (w i).1) := counts_precomp (fun i => (w i).1) p | |
| by_cases hb : counts (fun i => (w i).1) = counts line | |
| Β· have hb' : counts (fun i => (w (p i)).1) = counts line := hc.trans hb | |
| simp only [symExtension, Function.comp_apply, dite_eq_left hb, dite_eq_left hb'] | |
| let e := allocationPerm line (fun i => (w i).1) hb | |
| let e' := allocationPerm line (fun i => (w (p i)).1) hb' | |
| let q : Equiv.Perm S := e'.trans (p.trans e.symm) | |
| have hq (i : S) : line (q i) = line i := by | |
| rw [β allocationPerm_spec line (fun i => (w i).1) hb (q i)] | |
| change (w (e (e.symm (p (e' i))))).1 = line i | |
| rw [Equiv.apply_symm_apply] | |
| exact allocationPerm_spec line (fun i => (w (p i)).1) hb' i | |
| have hh := hv q hq (fun i => (w (e i)).2) | |
| change v (fun i => (w (p (e' i))).2) = v (fun i => (w (e i)).2) | |
| convert hh using 1 | |
| congr 1 | |
| ext i | |
| simp only [q, Equiv.trans_apply, Function.comp_apply, Equiv.apply_symm_apply] | |
| Β· have hb' : Β¬ counts (fun i => (w (p i)).1) = counts line := fun hh => hb (hc.symm.trans hh) | |
| simp only [symExtension, Function.comp_apply, dite_eq_right hb, dite_eq_right hb'] | |
| omit [Fintype A] in | |
| omit [DecidableEq S] in | |
| lemma symExtension_counts (line : S β L) (v : (S β A) β β) | |
| (hv : β p : Equiv.Perm S, (β i, line (p i) = line i) β β w, v (w β p) = v w) | |
| (w z : S β L Γ A) (he : counts w = counts z) : symExtension line v w = symExtension line v z := by | |
| obtain β¨p,hpβ© := same_counts_permutation w z he | |
| have hh : z β p = w := funext hp | |
| rw [β hh] | |
| exact symExtension_invariant line v hv p z | |
| abbrev Allocations (line : S β L) := {b : S β L // counts b = counts line} | |
| def labelWordEquiv : (S β L Γ A) β (S β L) Γ (S β A) where | |
| toFun w := (fun i => (w i).1, fun i => (w i).2) | |
| invFun w i := (w.1 i,w.2 i) | |
| left_inv := by intro w; rfl | |
| right_inv := by intro w; rfl | |
| def precompWordEquiv (p : Equiv.Perm S) : Equiv.Perm (S β A) where | |
| toFun w := w β p | |
| invFun w := w β p.symm | |
| left_inv := by intro w; ext i; simp | |
| right_inv := by intro w; ext i; simp | |
| omit [DecidableEq A] in | |
| lemma symExtension_norm (line : S β L) (v : (S β A) β β) : | |
| (β w : S β L Γ A, Complex.normSq (symExtension line v w)) = | |
| (Fintype.card (Allocations line) : β) * β w : S β A, Complex.normSq (v w) := by | |
| rw [β (labelWordEquiv (S := S) (L := L) (A := A)).symm.sum_comp, | |
| Fintype.sum_prod_type] | |
| change (β b : S β L, β w : S β A, Complex.normSq | |
| (if hb : counts b=counts line then v (w β allocationPerm line b hb) else 0)) = _ | |
| have he (b : S β L) : (β w : S β A, Complex.normSq | |
| (if hb : counts b=counts line then v (w β allocationPerm line b hb) else 0)) = | |
| if counts b=counts line then β w : S β A, Complex.normSq (v w) else 0 := by | |
| split_ifs with hb | |
| Β· exact Equiv.sum_comp (precompWordEquiv (A := A) (allocationPerm line b hb)) (fun w => Complex.normSq (v w)) | |
| Β· simp | |
| simp_rw [he] | |
| simp [Finset.sum_ite, Fintype.card_subtype, Allocations] | |
| def labelTest (line : S β L) (x : (S β A) β β) (w : S β L Γ A) : β := | |
| if (fun i => (w i).1)=line then x (fun i => (w i).2) else 0 | |
| omit [DecidableEq A] in | |
| lemma labeled_pair (line : S β L) (x : (S β A) β β) (f : (S β L Γ A) β β) : | |
| (β w, f w * labelTest line x w) = β w : S β A, f (fun i => (line i,w i)) * x w := by | |
| rw [β (labelWordEquiv (S := S) (L := L) (A := A)).symm.sum_comp, | |
| Fintype.sum_prod_type] | |
| change (β b : S β L, β w : S β A, f (fun i => (b i,w i)) * | |
| (if b=line then x w else 0)) = _ | |
| simp only [mul_ite, mul_zero, Finset.sum_ite_irrel, Finset.sum_const_zero] | |
| simp | |
| lemma allocation_probability (line : S β L) (r : L β β) | |
| (hr : β l, 0 β€ r l) (hs : β l, r l β€ 1) : | |
| (Fintype.card (Allocations line) : β) * (β i, r (line i)) β€ 1 := by | |
| have he (b : S β L) (hb : counts b=counts line) : | |
| (β i, r (b i)) = β i, r (line i) := by | |
| rw [prod_by_counts, prod_by_counts, hb] | |
| have hh : (β b : S β L, if counts b=counts line then β i, r (line i) else 0) β€ | |
| β b : S β L, β i, r (b i) := by | |
| apply Finset.sum_le_sum | |
| intro b _ | |
| split_ifs with hb | |
| Β· exact le_of_eq (he b hb).symm | |
| Β· exact Finset.prod_nonneg (fun _ _ => hr _) | |
| have hl : (β b : S β L, if counts b=counts line then β i, r (line i) else 0) = | |
| (Fintype.card (Allocations line) : β) * (β i, r (line i)) := by | |
| simp [Finset.sum_ite, Fintype.card_subtype, Allocations] | |
| rw [hl, β Fintype.prod_sum] at hh | |
| exact hh.trans (Finset.prod_le_oneβ (fun _ _ => Finset.sum_nonneg (fun l _ => hr l)) (fun _ _ => hs)) | |
| def lineMass (z : L Γ A β β) (l : L) : β := β a, Complex.normSq (z (l,a)) | |
| def normalizedLine (z : L Γ A β β) (l : L) (a : A) : β := | |
| (Real.sqrt (lineMass z l) : β)β»ΒΉ * z (l,a) | |
| omit [Fintype L] [DecidableEq L] [DecidableEq A] in | |
| lemma lineMass_nonneg (z : L Γ A β β) (l : L) : 0 β€ lineMass z l := | |
| Finset.sum_nonneg (fun _ _ => Complex.normSq_nonneg _) | |
| omit [Fintype L] [DecidableEq L] [DecidableEq A] in | |
| lemma lineMass_zero (z : L Γ A β β) (l : L) (h : lineMass z l=0) (a : A) : z (l,a)=0 := by | |
| apply Complex.normSq_eq_zero.mp | |
| have hh : Complex.normSq (z (l,a)) β€ lineMass z l := | |
| Finset.single_le_sum (fun b _ => Complex.normSq_nonneg (z (l,b))) (Finset.mem_univ a) | |
| exact le_antisymm (h βΈ hh) (Complex.normSq_nonneg _) | |
| omit [Fintype L] [DecidableEq L] [DecidableEq A] in | |
| lemma line_reconstruction (z : L Γ A β β) (l : L) (a : A) : | |
| z (l,a) = (Real.sqrt (lineMass z l) : β) * normalizedLine z l a := by | |
| by_cases hz : lineMass z l=0 | |
| Β· simp [normalizedLine, hz, lineMass_zero z l hz a] | |
| Β· have h : (Real.sqrt (lineMass z l) : β) β 0 := by | |
| exact_mod_cast (Real.sqrt_ne_zero'.mpr (lt_of_le_of_ne (lineMass_nonneg z l) (Ne.symm hz))) | |
| simp [normalizedLine, h] | |
| omit [Fintype L] [DecidableEq L] [DecidableEq A] in | |
| lemma normalizedLine_norm (z : L Γ A β β) (l : L) : | |
| (β a, Complex.normSq (normalizedLine z l a)) β€ 1 := by | |
| by_cases hz : lineMass z l=0 | |
| Β· simp [normalizedLine, hz] | |
| Β· have hp : 0 < lineMass z l := lt_of_le_of_ne (lineMass_nonneg z l) (Ne.symm hz) | |
| simp_rw [normalizedLine, map_mul, map_invβ, Complex.normSq_ofReal, Real.mul_self_sqrt (le_of_lt hp)] | |
| rw [β Finset.mul_sum] | |
| change (lineMass z l)β»ΒΉ * lineMass z l β€ 1 | |
| rw [inv_mul_cancelβ hz] | |
| omit [Fintype L] [DecidableEq L] [DecidableEq A] in | |
| lemma labeled_tensor_pair (line : S β L) (z : L Γ A β β) (x : (S β A) β β) : | |
| Complex.normSq (β w : S β A, tensorVector z (fun i => (line i,w i)) * x w) = | |
| (β i, lineMass z (line i)) * | |
| Complex.normSq (β w : S β A, (β i, normalizedLine z (line i) (w i)) * x w) := by | |
| have he (w : S β A) : tensorVector z (fun i => (line i,w i)) = | |
| (β i, (Real.sqrt (lineMass z (line i)) : β)) * β i, normalizedLine z (line i) (w i) := by | |
| rw [β Finset.prod_mul_distrib] | |
| exact Finset.prod_congr rfl (fun i _ => line_reconstruction z (line i) (w i)) | |
| simp_rw [he, mul_assoc] | |
| rw [β Finset.mul_sum, map_mul] | |
| congr 1 | |
| rw [map_prod] | |
| apply Finset.prod_congr rfl | |
| intro i _ | |
| exact (Complex.normSq_ofReal _).trans (Real.mul_self_sqrt (lineMass_nonneg z (line i))) | |
| omit [DecidableEq S] [Fintype A] [DecidableEq A] in | |
| lemma symExtension_supported (line : S β L) (v : (S β A) β β) | |
| (good : A β Prop) [DecidablePred good] | |
| (hv : β w, Β¬ (β i, good (w i)) β v w=0) | |
| (w : S β L Γ A) (hw : Β¬ β i, good (w i).2) : symExtension line v w=0 := by | |
| unfold symExtension | |
| split_ifs with hb | |
| Β· apply hv | |
| intro h | |
| apply hw | |
| intro i | |
| simpa using h ((allocationPerm line _ hb).symm i) | |
| Β· rfl | |
| def lineAmplitude (line : S β L) (aβ : S β A) (good : A β Prop) [DecidablePred good] | |
| (q : Types (S := S) (A := L Γ A)) (ΞΈ : Phases (L Γ A) (Fintype.card S)) (l : L) (a : A) : β := | |
| normalizedLine (truncateAmplitude (fun c : L Γ A => good c.2) | |
| (twistedAmplitude (typeRepresentative (fun i => (line i,aβ i)) q) ΞΈ)) l a | |
| omit [DecidableEq S] in | |
| omit [Fintype L] in | |
| lemma lineAmplitude_norm (line : S β L) (aβ : S β A) (good : A β Prop) [DecidablePred good] | |
| (q : Types (S := S) (A := L Γ A)) (ΞΈ : Phases (L Γ A) (Fintype.card S)) (l : L) : | |
| (β a, Complex.normSq (lineAmplitude line aβ good q ΞΈ l a)) β€ 1 := | |
| normalizedLine_norm _ _ | |
| omit [DecidableEq S] [Fintype L] in | |
| lemma lineAmplitude_support (line : S β L) (aβ : S β A) (good : A β Prop) [DecidablePred good] | |
| (q : Types (S := S) (A := L Γ A)) (ΞΈ : Phases (L Γ A) (Fintype.card S)) (l : L) (a : A) | |
| (ha : Β¬ good a) : lineAmplitude line aβ good q ΞΈ l a=0 := by | |
| simp [lineAmplitude, normalizedLine, truncateAmplitude, ha] | |
| /-- Independent fibre postselection, with the allocation factorial cancelled | |
| by the exact multinomial probability rather than included in the overhead. -/ | |
| theorem line_symmetric_postselection (line : S β L) (aβ : S β A) (hn : 0 < Fintype.card S) | |
| (good : A β Prop) [DecidablePred good] (v x : (S β A) β β) | |
| (hv : β p : Equiv.Perm S, (β i, line (p i)=line i) β β w, v (w β p)=v w) | |
| (hsupp : β w, Β¬ (β i, good (w i)) β v w=0) : | |
| Complex.normSq (β w, v w*x w) β€ | |
| (β w, Complex.normSq (v w)) * | |
| (((Fintype.card S+1)^(Fintype.card (L Γ A)) : β) / | |
| (Fintype.card (Phases (L Γ A) (Fintype.card S)) : β) * | |
| β q : Types (S := S) (A := L Γ A), β ΞΈ : Phases (L Γ A) (Fintype.card S), | |
| Complex.normSq (β w : S β A, (β i, lineAmplitude line aβ good q ΞΈ (line i) (w i)) * x w)) := by | |
| let z (q : Types (S := S) (A := L Γ A)) (ΞΈ : Phases (L Γ A) (Fintype.card S)) := | |
| truncateAmplitude (fun c : L Γ A => good c.2) | |
| (twistedAmplitude (typeRepresentative (fun i => (line i,aβ i)) q) ΞΈ) | |
| let R (q : Types (S := S) (A := L Γ A)) (ΞΈ : Phases (L Γ A) (Fintype.card S)) := | |
| Complex.normSq (β w : S β A, (β i, normalizedLine (z q ΞΈ) (line i) (w i)) * x w) | |
| have hz (q : Types (S := S) (A := L Γ A)) (ΞΈ : Phases (L Γ A) (Fintype.card S)) : | |
| (Fintype.card (Allocations line) : β) * (β i, lineMass (z q ΞΈ) (line i)) β€ 1 := by | |
| apply allocation_probability line _ (lineMass_nonneg _) | |
| rw [show (β l, lineMass (z q ΞΈ) l) = β c : L Γ A, Complex.normSq (z q ΞΈ c) from | |
| (Fintype.sum_prod_type (fun c : L Γ A => Complex.normSq (z q ΞΈ c))).symm] | |
| exact truncated_twisted_subnormalized _ _ hn _ | |
| have hh := supported_symmetric_postselection (fun i => (line i,aβ i)) hn | |
| (fun c : L Γ A => good c.2) (symExtension line v) (labelTest line x) | |
| (symExtension_counts line v hv) (symExtension_supported line v good hsupp) | |
| rw [labeled_pair] at hh | |
| simp_rw [symExtension_on_line line v hv] at hh | |
| rw [symExtension_norm] at hh | |
| simp_rw [labeled_pair, labeled_tensor_pair] at hh | |
| let c : β := ((Fintype.card S+1)^(Fintype.card (L Γ A)) : β) / | |
| (Fintype.card (Phases (L Γ A) (Fintype.card S)) : β) | |
| change _ β€ ((Fintype.card (Allocations line) : β) * β w, Complex.normSq (v w)) * | |
| (c * β q, β ΞΈ, (β i, lineMass (z q ΞΈ) (line i)) * R q ΞΈ) at hh | |
| change _ β€ (β w, Complex.normSq (v w)) * (c * β q, β ΞΈ, R q ΞΈ) | |
| apply hh.trans | |
| rw [show ((Fintype.card (Allocations line) : β) * β w, Complex.normSq (v w)) * | |
| (c * β q, β ΞΈ, (β i, lineMass (z q ΞΈ) (line i)) * R q ΞΈ) = | |
| (β w, Complex.normSq (v w)) * (c * ((Fintype.card (Allocations line) : β) * | |
| β q, β ΞΈ, (β i, lineMass (z q ΞΈ) (line i)) * R q ΞΈ)) by ring] | |
| apply mul_le_mul_of_nonneg_left _ (Finset.sum_nonneg (fun _ _ => Complex.normSq_nonneg _)) | |
| apply mul_le_mul_of_nonneg_left _ (by positivity : 0 β€ c) | |
| simp_rw [Finset.mul_sum, β mul_assoc] | |
| exact Finset.sum_le_sum (fun q _ => Finset.sum_le_sum (fun ΞΈ _ => | |
| (mul_le_mul_of_nonneg_right (hz q ΞΈ) (Complex.normSq_nonneg _)).trans_eq (one_mul _))) | |
| end RowColumn.Postselection | |
| end | |
| end | |
| section | |
| noncomputable section | |
| open scoped BigOperators Classical Matrix.Norms.L2Operator ComplexOrder MatrixOrder | |
| namespace RowColumn.Postselection | |
| open MatrixState WordOrbits | |
| variable {S L C : Type*} [Fintype S] [DecidableEq S] [Fintype L] [DecidableEq L] | |
| [Fintype C] [DecidableEq C] | |
| def lineState (line : S β L) (aβ : S β C Γ C) (odd : C β Prop) [DecidablePred odd] | |
| (q : Types (S := S) (A := L Γ (C Γ C))) (ΞΈ : Phases (L Γ (C Γ C)) (Fintype.card S)) | |
| (l : L) : Matrix C C β := | |
| gramState (lineAmplitude line aβ (fun p : C Γ C => odd p.1 β odd p.2) q ΞΈ l) | |
| omit [DecidableEq S] [Fintype L] in | |
| lemma lineState_positive (line : S β L) (aβ : S β C Γ C) (odd : C β Prop) [DecidablePred odd] | |
| (q : Types (S := S) (A := L Γ (C Γ C))) (ΞΈ : Phases (L Γ (C Γ C)) (Fintype.card S)) (l : L) : | |
| (lineState line aβ odd q ΞΈ l).PosSemidef := gramState_posSemidef _ | |
| omit [DecidableEq S] in | |
| omit [Fintype L] in | |
| lemma lineState_trace (line : S β L) (aβ : S β C Γ C) (odd : C β Prop) [DecidablePred odd] | |
| (q : Types (S := S) (A := L Γ (C Γ C))) (ΞΈ : Phases (L Γ (C Γ C)) (Fintype.card S)) (l : L) : | |
| (lineState line aβ odd q ΞΈ l).trace.re β€ 1 := by | |
| rw [lineState, gramState_trace] | |
| exact lineAmplitude_norm _ _ _ _ _ _ | |
| omit [DecidableEq S] [Fintype L] in | |
| lemma lineState_even (line : S β L) (aβ : S β C Γ C) (odd : C β Prop) [DecidablePred odd] | |
| (q : Types (S := S) (A := L Γ (C Γ C))) (ΞΈ : Phases (L Γ (C Γ C)) (Fintype.card S)) | |
| (l : L) (c d : C) (h : Β¬ (odd c β odd d)) : lineState line aβ odd q ΞΈ l c d=0 := by | |
| apply gramState_parity_supported odd _ _ c d h | |
| exact fun c d h => lineAmplitude_support _ _ _ _ _ _ _ h | |
| lemma variable_purification_pair (z : S β C Γ C β β) (x : (S β C) β β) (v : S β C) : | |
| (β a : S β C Γ C, (β i, z i (a i)) * purificationTest x v a) = | |
| β w : S β C, tensorMatrix (fun i => letterMatrix (z i)) w v * x w := by | |
| exact purification_pair (tensorMatrix (fun i => letterMatrix (z i))) x v | |
| lemma variable_purification_quadratic (z : S β C Γ C β β) (x : (S β C) β β) : | |
| (β v : S β C, Complex.normSq (β a : S β C Γ C, | |
| (β i, z i (a i)) * purificationTest x v a)) = | |
| quadratic (tensorMatrix (fun i => gramState (z i))) x := by | |
| simp_rw [variable_purification_pair] | |
| change factorQuadratic (tensorMatrix (fun i => letterMatrix (z i))) x = _ | |
| rw [factorQuadratic_eq, tensorMatrix_star, tensorMatrix_mul] | |
| rfl | |
| /-- Explicit local domination for independent row/column permutation fibres. | |
| All mixture terms are genuine even positive identical-slot substates within | |
| each fibre, irrespective of its size and the deletion layout. -/ | |
| theorem positive_line_postselection (line : S β L) (aβ : S β C Γ C) (hn : 0 < Fintype.card S) | |
| (odd : C β Prop) [DecidablePred odd] (A : Matrix (S β C) (S β C) β) | |
| (hA : A.PosSemidef) | |
| (hinv : β (p : Equiv.Perm S), (β i, line (p i)=line i) β β (w v : S β C), | |
| A (w β p) (v β p)=A w v) | |
| (hsupp : β w v, Β¬ (β i, odd (w i) β odd (v i)) β A w v=0) | |
| (x : (S β C) β β) : | |
| quadratic A x β€ A.trace.re * | |
| (((Fintype.card S+1)^(Fintype.card (L Γ (C Γ C))) : β) / | |
| (Fintype.card (Phases (L Γ (C Γ C)) (Fintype.card S)) : β) * | |
| β q : Types (S := S) (A := L Γ (C Γ C)), | |
| β ΞΈ : Phases (L Γ (C Γ C)) (Fintype.card S), | |
| quadratic (tensorMatrix (fun i : S => lineState line aβ odd q ΞΈ (line i))) x) := by | |
| let B : Matrix (S β C) (S β C) β := CFC.sqrt A | |
| have hi (p : Equiv.Perm S) (hp : β i, line (p i)=line i) (w v : S β C) : | |
| B (w β p) (v β p)=B w v := | |
| sqrt_permutation_invariant A hA (reindexWord p) (hinv p hp) w v | |
| have hz (w v : S β C) (hh : Β¬ β i, odd (w i) β odd (v i)) : B w v=0 := by | |
| apply sqrt_block_supported (fun u : S β C => fun i => odd (u i)) A hA | |
| (fun u v he => hsupp u v (fun ht => he (funext fun i => propext (ht i)))) w v | |
| intro he | |
| exact hh (fun i => Iff.of_eq (congrFun he i)) | |
| have hv (p : Equiv.Perm S) (hp : β i, line (p i)=line i) (w : S β C Γ C) : | |
| purificationVector B (w β p)=purificationVector B w := | |
| hi p hp (fun i => (w i).1) (fun i => (w i).2) | |
| have hs (w : S β C Γ C) (hw : Β¬ β i, odd (w i).1 β odd (w i).2) : purificationVector B w=0 := | |
| hz _ _ hw | |
| have hh (v : S β C) := line_symmetric_postselection line aβ hn | |
| (fun p : C Γ C => odd p.1 β odd p.2) (purificationVector B) (purificationTest x v) hv hs | |
| simp only [purification_pair B x, purification_normSq B] at hh | |
| have hsum := Finset.sum_le_sum (fun v (_ : v β Finset.univ) => hh v) | |
| change factorQuadratic B x β€ _ at hsum | |
| have ht : purifierTrace B=A.trace.re := sqrt_trace A hA | |
| rw [ht] at hsum | |
| change factorQuadratic (CFC.sqrt A) x β€ _ at hsum | |
| rw [sqrt_factorQuadratic A hA] at hsum | |
| apply hsum.trans_eq | |
| simp only [Finset.mul_sum] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro q _ | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro ΞΈ _ | |
| rw [β Finset.mul_sum, β Finset.mul_sum] | |
| congr 2 | |
| exact variable_purification_quadratic _ x | |
| end RowColumn.Postselection | |
| end | |
| end | |
| end OAI | |