Download data/lean/OAI/RepresentationTheory/SignedTensor/Domination.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 59.2 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/RepresentationTheory/SignedTensor/Domination.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/RepresentationTheory/SignedTensor/Domination.lean
-
curl -L -o Domination.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/RepresentationTheory/SignedTensor/Domination.lean
59.2 kB
import Mathlib
import OAI.RepresentationTheory.SignedTensor.Basic
import OAI.RepresentationTheory.Tensor.Postselection
import OAI.Analysis.Matrix.TensorMoment
namespace OAI
noncomputable section
open scoped BigOperators Matrix.Norms.L2Operator ComplexOrder
attribute [local instance] Classical.propDecidable
noncomputable section
open scoped BigOperators ComplexConjugate Matrix.Norms.L2Operator
attribute [local instance] Classical.propDecidable
noncomputable section
open scoped BigOperators ComplexOrder MatrixOrder
attribute [local instance] Classical.propDecidable
namespace CoordinateSweeps.SignedTensor
open PositiveTensor
/- Partial-trace invariance of the actual regrouping signs on each fixed
exception sector. No assumption of complex conditional probabilities occurs. -/
theorem partialTrace_regroup {p l : β} (E : Finset (Fin l))
(v : Word p l Γ Word p l β β)
(hv : β u w, v (u,w) β 0 β β i,
(odd (u i) β Β¬ odd (w i)) β i β E) :
partialTrace (PositiveTensor.outer (fun uw => regroupPhase uw.1 uw.2 * v uw)) =
partialTrace (PositiveTensor.outer v) := by
ext u u'
apply Finset.sum_congr rfl
intro w _
change (regroupPhase u w * v (u,w)) * star (regroupPhase u' w * v (u',w)) =
v (u,w)*star (v (u',w))
by_cases hu : v (u,w) = 0
Β· simp [hu]
by_cases hu' : v (u',w) = 0
Β· simp [hu']
have he : regroupPhase u w = regroupPhase u' w := by
apply regroupPhase_of_same_parity
intro i
have hi := hv u w hu i
have hi' := hv u' w hu' i
tauto
rw [star_mul,regroupPhase_star,he]
calc
_ = (regroupPhase u' w * regroupPhase u' w) * (v (u,w)*star (v (u',w))) := by ring
_ = _ := by rw [regroupPhase_square,one_mul]
abbrev Pair (p : β) := Letter p Γ Letter p
abbrev MatchedPair (p : β) := {a : Pair p // odd a.1 β odd a.2}
/- Valid pinned exceptional data. Injectivity is essential: it is supplied
by the proved repeated-mismatch cancellation, not imposed on the kernel. -/
structure ExceptionPattern (p l : β) where
sites : Finset (Fin l)
pair : sites β Pair p
mismatch : β i, odd (pair i).1 β Β¬ odd (pair i).2
injective : Function.Injective pair
deriving Fintype
/- Every nonzero commuting matrix entry has literal valid exceptional data. -/
def entryPattern {p l : β} (A : commutant p l) (u w : Word p l) (h : A.val u w β 0) :
ExceptionPattern p l where
sites := mismatchSlots u w
pair i := (u i.val,w i.val)
mismatch i := (Finset.mem_filter.mp i.property).2
injective := by
intro i j he
apply Subtype.ext
by_contra hij
exact h (commutant_entry_zero_repeated_mismatch A u w i.val j.val hij
(congrArg Prod.fst he) (congrArg Prod.snd he) (Finset.mem_filter.mp i.property).2)
namespace ExceptionPattern
variable {p l : β}
def encode (F : ExceptionPattern p l) (a : Pair p) : Option (Fin l) :=
if h : β i : F.sites, F.pair i = a then some (Classical.choose h).val else none
lemma encode_eq_some (F : ExceptionPattern p l) (a : Pair p) (i : Fin l) :
F.encode a = some i β β hi : i β F.sites, F.pair β¨i,hiβ© = a := by
unfold encode
split_ifs with h
Β· constructor
Β· intro he
have hi := Option.some.inj he
subst i
exact β¨(Classical.choose h).property, Classical.choose_spec hβ©
Β· rintro β¨hi,heβ©
have hh : Classical.choose h = β¨i,hiβ© := F.injective ((Classical.choose_spec h).trans he.symm)
rw [hh]
Β· constructor
Β· intro he; cases he
Β· rintro β¨hi,heβ©
exact (h β¨β¨i,hiβ©,heβ©).elim
lemma mem_sites_iff (F : ExceptionPattern p l) (i : Fin l) :
i β F.sites β β a, F.encode a = some i := by
constructor
Β· intro hi
exact β¨F.pair β¨i,hiβ©,(F.encode_eq_some _ i).mpr β¨hi,rflβ©β©
Β· rintro β¨a,haβ©
exact ((F.encode_eq_some a i).mp ha).choose
lemma encode_injective : Function.Injective (encode (p := p) (l := l)) := by
intro F G he
have hs : F.sites = G.sites := by
ext i
rw [F.mem_sites_iff,G.mem_sites_iff]
simp only [he]
cases F with | mk E f hf hfi =>
cases G with | mk E' g hg hgi =>
dsimp at hs
subst E'
have hp : f = g := by
funext i
have hh : (ExceptionPattern.mk E f hf hfi).encode (f i) = some i.val :=
((ExceptionPattern.mk E f hf hfi).encode_eq_some _ _).mpr β¨i.property,rflβ©
rw [congrFun he (f i)] at hh
obtain β¨hi,hvβ© := ((ExceptionPattern.mk E g hg hgi).encode_eq_some _ _).mp hh
exact hv.symm
subst g
rfl
lemma card_le : Fintype.card (ExceptionPattern p l) β€ (l+1)^((2*p)*(2*p)) := by
have hc := Fintype.card_le_of_injective (encode (p := p) (l := l)) encode_injective
simpa only [Fintype.card_fun,Fintype.card_option,Fintype.card_fin,
Fintype.card_prod] using hc
lemma sites_card_le (F : ExceptionPattern p l) : F.sites.card β€ (2*p)*(2*p) := by
have hc := Fintype.card_le_of_injective F.pair F.injective
simpa only [Fintype.card_coe,Fintype.card_prod,Fintype.card_fin] using hc
/- Slots not occupied by a pinned exceptional symbol. -/
abbrev Free (F : ExceptionPattern p l) := {i : Fin l // i β F.sites}
abbrev FreeWord (F : ExceptionPattern p l) := F.Free β MatchedPair p
def fillPair (F : ExceptionPattern p l) (x : F.FreeWord) (i : Fin l) : Pair p :=
if hi : i β F.sites then F.pair β¨i,hiβ© else (x β¨i,hiβ©).val
def fill (F : ExceptionPattern p l) (x : F.FreeWord) : Word p l Γ Word p l :=
(fun i => (F.fillPair x i).1, fun i => (F.fillPair x i).2)
lemma fillPair_at_pin (F : ExceptionPattern p l) (x : F.FreeWord) (i : F.sites) :
F.fillPair x i.val = F.pair i := by simp [fillPair,i.property]
lemma fillPair_at_free (F : ExceptionPattern p l) (x : F.FreeWord) (i : F.Free) :
F.fillPair x i.val = (x i).val := by simp [fillPair,i.property]
lemma fill_mismatch_iff (F : ExceptionPattern p l) (x : F.FreeWord) (i : Fin l) :
(odd ((F.fill x).1 i) β Β¬ odd ((F.fill x).2 i)) β i β F.sites := by
change (odd (F.fillPair x i).1 β Β¬ odd (F.fillPair x i).2) β _
by_cases hi : i β F.sites
Β· rw [show F.fillPair x i = F.pair β¨i,hiβ© from F.fillPair_at_pin x β¨i,hiβ©]
exact iff_of_true (F.mismatch β¨i,hiβ©) hi
Β· rw [show F.fillPair x i = (x β¨i,hiβ©).val from F.fillPair_at_free x β¨i,hiβ©]
have hm := (x β¨i,hiβ©).property
tauto
lemma fill_injective (F : ExceptionPattern p l) : Function.Injective F.fill := by
intro x y he
funext i
apply Subtype.ext
have hh : F.fillPair x i.val = F.fillPair y i.val :=
Prod.ext (congrFun (congrArg Prod.fst he) i.val) (congrFun (congrArg Prod.snd he) i.val)
simpa only [F.fillPair_at_free] using hh
lemma fill_disjoint {F G : ExceptionPattern p l} (x : F.FreeWord) (y : G.FreeWord)
(he : F.fill x = G.fill y) : F = G := by
have hs : F.sites = G.sites := by
ext i
rw [β F.fill_mismatch_iff x i,β G.fill_mismatch_iff y i,he]
cases F with | mk E f hf hfi =>
cases G with | mk E' g hg hgi =>
dsimp at hs
subst E'
have hp : f = g := by
funext i
have hh : (ExceptionPattern.mk E f hf hfi).fillPair x i.val =
(ExceptionPattern.mk E g hg hgi).fillPair y i.val :=
Prod.ext (congrFun (congrArg Prod.fst he) i.val) (congrFun (congrArg Prod.snd he) i.val)
simpa only [fillPair_at_pin] using hh
subst g
rfl
lemma entry_in_range (A : commutant p l) (u w : Word p l) (h : A.val u w β 0) :
β x : (entryPattern A u w h).FreeWord, (entryPattern A u w h).fill x = (u,w) := by
let F := entryPattern A u w h
let x : F.FreeWord := fun i => β¨(u i.val,w i.val),by
have hi : i.val β mismatchSlots u w := i.property
have hm : Β¬ (odd (u i.val) β Β¬ odd (w i.val)) := by
simpa only [mismatchSlots,Finset.mem_filter,Finset.mem_univ,true_and] using hi
tautoβ©
refine β¨x,?_β©
have he (i : Fin l) : F.fillPair x i = (u i,w i) := by
unfold fillPair
split_ifs <;> rfl
exact Prod.ext (funext fun i => congrArg Prod.fst (he i))
(funext fun i => congrArg Prod.snd (he i))
/- Extend a permutation of the free slots by the identity on the exceptions. -/
def extendPerm (F : ExceptionPattern p l) (Ο : Equiv.Perm F.Free) : Equiv.Perm (Fin l) :=
Equiv.Perm.ofSubtype Ο
lemma extendPerm_pin (F : ExceptionPattern p l) (Ο : Equiv.Perm F.Free) (i : F.sites) :
F.extendPerm Ο i.val = i.val := by
simp [extendPerm,Equiv.Perm.ofSubtype_apply_of_not_mem,i.property]
lemma extendPerm_free (F : ExceptionPattern p l) (Ο : Equiv.Perm F.Free) (i : F.Free) :
F.extendPerm Ο i.val = (Ο i).val := by
exact Equiv.Perm.ofSubtype_apply_of_mem Ο i.property
lemma fill_transport (F : ExceptionPattern p l) (Ο : Equiv.Perm F.Free) (x : F.FreeWord) :
F.fill (fun i => x (Οβ»ΒΉ i)) =
(wordPerm (F.extendPerm Ο) (F.fill x).1, wordPerm (F.extendPerm Ο) (F.fill x).2) := by
have hinv : (F.extendPerm Ο)β»ΒΉ = F.extendPerm Οβ»ΒΉ := by
simp only [extendPerm,map_inv]
have he (i : Fin l) : F.fillPair (fun i => x (Οβ»ΒΉ i)) i =
F.fillPair x ((F.extendPerm Ο)β»ΒΉ i) := by
rw [hinv]
by_cases hi : i β F.sites
Β· rw [show F.extendPerm Οβ»ΒΉ i = i from F.extendPerm_pin Οβ»ΒΉ β¨i,hiβ©]
simp [fillPair,hi]
Β· rw [show F.extendPerm Οβ»ΒΉ i = (Οβ»ΒΉ β¨i,hiβ©).val from F.extendPerm_free Οβ»ΒΉ β¨i,hiβ©]
rw [show F.fillPair (fun i => x (Οβ»ΒΉ i)) i = (x (Οβ»ΒΉ β¨i,hiβ©)).val from
F.fillPair_at_free (fun i => x (Οβ»ΒΉ i)) β¨i,hiβ©,F.fillPair_at_free]
exact Prod.ext (funext fun i => congrArg Prod.fst (he i))
(funext fun i => congrArg Prod.snd (he i))
def purified (F : ExceptionPattern p l) (A : commutant p l) (x : F.FreeWord) : β :=
regroupPhase (F.fill x).1 (F.fill x).2 * A.val (F.fill x).1 (F.fill x).2
lemma purified_invariant (F : ExceptionPattern p l) (A : commutant p l)
(Ο : Equiv.Perm F.Free) (x : F.FreeWord) :
F.purified A (fun i => x (Οβ»ΒΉ i)) = F.purified A x := by
unfold purified
rw [F.fill_transport]
apply regrouped_commutant_invariant
intro i hi
exact F.extendPerm_pin Ο β¨i,(F.fill_mismatch_iff x i).mp hiβ©
end ExceptionPattern
end CoordinateSweeps.SignedTensor
namespace CoordinateSweeps.SignedTensor.ExceptionPattern
open PositiveTensor
variable {p l : β}
def embedding (F : ExceptionPattern p l) : F.FreeWord βͺ (Word p l Γ Word p l) :=
β¨F.fill,F.fill_injectiveβ©
def component (F : ExceptionPattern p l) (A : commutant p l) (uw : Word p l Γ Word p l) : β :=
if uw β Set.range F.fill then A.val uw.1 uw.2 else 0
lemma component_image (F : ExceptionPattern p l) (A : commutant p l) (x : F.FreeWord) :
F.component A (F.fill x) = A.val (F.fill x).1 (F.fill x).2 := by
simp [component]
lemma component_inclusion (F : ExceptionPattern p l) (A : commutant p l) :
F.component A = (inclusion F.embedding).mulVec (fun x => A.val (F.fill x).1 (F.fill x).2) := by
funext q
by_cases hq : q β Set.range F.fill
Β· obtain β¨x,rflβ© := hq
have hh := inclusion_mulVec_image F.embedding (fun x => A.val (F.fill x).1 (F.fill x).2) x
change (inclusion F.embedding).mulVec (fun x => A.val (F.fill x).1 (F.fill x).2) (F.fill x) = _ at hh
exact (F.component_image A x).trans hh.symm
Β· rw [show F.component A q = 0 from ite_eq_right hq]
exact (inclusion_mulVec_notin F.embedding _ q hq).symm
lemma purified_inclusion (F : ExceptionPattern p l) (A : commutant p l) :
(inclusion F.embedding).mulVec (F.purified A) =
fun q => regroupPhase q.1 q.2 * F.component A q := by
funext q
by_cases hq : q β Set.range F.fill
Β· obtain β¨x,rflβ© := hq
have hh := inclusion_mulVec_image F.embedding (F.purified A) x
change (inclusion F.embedding).mulVec (F.purified A) (F.fill x) = _ at hh
rw [hh,F.component_image]
rfl
Β· rw [inclusion_mulVec_notin F.embedding _ q hq]
simp [component,hq]
lemma component_partialTrace (F : ExceptionPattern p l) (A : commutant p l) :
partialTrace (PositiveTensor.outer ((inclusion F.embedding).mulVec (F.purified A))) =
partialTrace (PositiveTensor.outer (F.component A)) := by
rw [F.purified_inclusion]
apply partialTrace_regroup F.sites
intro u w h i
have hq : (u,w) β Set.range F.fill := by
by_contra hn
exact h (ite_eq_right hn)
obtain β¨x,hxβ© := hq
have he := F.fill_mismatch_iff x i
simpa only [hx] using he
lemma component_sum (A : commutant p l) :
β F : ExceptionPattern p l, F.component A = fun q => A.val q.1 q.2 := by
funext q
rw [Finset.sum_apply]
by_cases hq : A.val q.1 q.2 = 0
Β· simp [component,hq]
Β· let F := entryPattern A q.1 q.2 hq
obtain β¨x,hxβ© := entry_in_range A q.1 q.2 hq
have hmem : q β Set.range F.fill := β¨x,hxβ©
rw [Finset.sum_eq_single F]
Β· exact ite_eq_left hmem
Β· intro G _ hG
apply ite_eq_right
rintro β¨y,hyβ©
exact hG (fill_disjoint y x (hy.trans hx.symm))
Β· simp
lemma component_square_sum (A : commutant p l) (q : Word p l Γ Word p l) :
β F : ExceptionPattern p l, F.component A q * star (F.component A q) =
A.val q.1 q.2 * star (A.val q.1 q.2) := by
by_cases hq : A.val q.1 q.2 = 0
Β· simp [component,hq]
Β· let F := entryPattern A q.1 q.2 hq
obtain β¨x,hxβ© := entry_in_range A q.1 q.2 hq
have hmem : q β Set.range F.fill := β¨x,hxβ©
rw [Finset.sum_eq_single F]
Β· simp [component,hmem]
Β· intro G _ hG
have hn : q β Set.range G.fill := by
rintro β¨y,hyβ©
exact hG (fill_disjoint y x (hy.trans hx.symm))
simp [component,hn]
Β· simp
lemma purified_trace (F : ExceptionPattern p l) (A : commutant p l) :
Matrix.trace (OrdinaryTensor.outer (F.purified A)) =
Matrix.trace (PositiveTensor.outer (F.component A)) := by
rw [show OrdinaryTensor.outer (F.purified A) = Matrix.vecMulVec (F.purified A) (star (F.purified A)) from rfl,
β inclusion_trace_outer F.embedding,F.purified_inclusion]
apply Finset.sum_congr rfl
intro q _
change (regroupPhase q.1 q.2 * F.component A q) *
star (regroupPhase q.1 q.2 * F.component A q) = F.component A q * star (F.component A q)
rw [star_mul,regroupPhase_star]
calc
_ = (regroupPhase q.1 q.2 * regroupPhase q.1 q.2) * (F.component A q * star (F.component A q)) := by ring
_ = _ := by rw [regroupPhase_square,one_mul]
lemma sum_purified_trace (A : commutant p l) :
β F : ExceptionPattern p l, Matrix.trace (OrdinaryTensor.outer (F.purified A)) =
Matrix.trace (A.val*A.val.conjTranspose) := by
simp_rw [purified_trace]
simp only [PositiveTensor.outer,Matrix.trace,Matrix.diag_apply,Matrix.vecMulVec_apply,Pi.star_apply]
rw [Finset.sum_comm]
simp_rw [component_square_sum]
simp only [Fintype.sum_prod_type,Matrix.mul_apply,Matrix.conjTranspose_apply]
end CoordinateSweeps.SignedTensor.ExceptionPattern
namespace CoordinateSweeps.SignedTensor.ExceptionPattern
open PositiveTensor
variable {p l : β}
lemma free_card (F : ExceptionPattern p l) : Fintype.card F.Free = l-F.sites.card := by
simp only [Free,Fintype.card_subtype_compl,Fintype.card_coe,Fintype.card_fin]
lemma free_card_pos (F : ExceptionPattern p l) (hl : (2*p)*(2*p) < l) : 0 < Fintype.card F.Free := by
rw [F.free_card]
exact Nat.sub_pos_of_lt (lt_of_le_of_lt F.sites_card_le hl)
lemma free_card_le (F : ExceptionPattern p l) : Fintype.card F.Free β€ l := by
rw [F.free_card]
exact Nat.sub_le _ _
lemma matchedPair_nonempty (hp : 0 < p) : Nonempty (MatchedPair p) :=
β¨β¨(β¨0,by omegaβ©,β¨0,by omegaβ©),Iff.rflβ©β©
/- Exact domination of a pinned component by a finite product mixture on its
free slots, after the proved sign cancellation in the genuine partial trace. -/
theorem component_postselection (F : ExceptionPattern p l) (hp : 0 < p)
(hl : (2*p)*(2*p) < l) (A : commutant p l) :
((Matrix.trace (OrdinaryTensor.outer (F.purified A)) *
((Fintype.card F.Free+1 : β) : β)^(2*Fintype.card (MatchedPair p))) β’
partialTrace (inclusion F.embedding * (OrdinaryTensor.finiteMixture (I := F.Free) (A := MatchedPair p)) * (inclusion F.embedding).conjTranspose) -
partialTrace (PositiveTensor.outer (F.component A))).PosSemidef := by
let : Nonempty (MatchedPair p) := matchedPair_nonempty hp
have h := OrdinaryTensor.invariant_vector_postselection (I := F.Free) (A := MatchedPair p) (F.free_card_pos hl)
(F.purified A) (F.purified_invariant A)
have hc := h.mul_mul_conjTranspose_same (inclusion F.embedding)
rw [Matrix.mul_sub,Matrix.sub_mul,Matrix.mul_smul,Matrix.smul_mul] at hc
have ho : inclusion F.embedding * OrdinaryTensor.outer (F.purified A) * (inclusion F.embedding).conjTranspose =
PositiveTensor.outer ((inclusion F.embedding).mulVec (F.purified A)) :=
mul_outer_mul_star _ _
rw [ho] at hc
have hp := partialTrace_posSemidef _ hc
simpa only [partialTrace_sub,partialTrace_smul,F.component_partialTrace A] using hp
end CoordinateSweeps.SignedTensor.ExceptionPattern
namespace CoordinateSweeps.SignedTensor
def pairAmplitude {p : β} (z : MatchedPair p β β) : Matrix (Letter p) (Letter p) β :=
fun a b => if h : odd a β odd b then z β¨(a,b),hβ© else 0
lemma pairAmplitude_unit_trace {p : β} (z : MatchedPair p β β)
(hz : β a, z a * star (z a) = 1) :
Matrix.trace (pairAmplitude z * (pairAmplitude z).conjTranspose) = 1 := by
have hs := Fintype.sum_of_injective
(Subtype.val : MatchedPair p β Pair p) Subtype.val_injective
(fun a => z a * star (z a))
(fun a : Pair p => pairAmplitude z a.1 a.2 * star (pairAmplitude z a.1 a.2))
(by
intro a ha
have hn : Β¬ (odd a.1 β odd a.2) := by
intro h
exact ha β¨β¨a,hβ©,rflβ©
simp [pairAmplitude,hn])
(by intro a; simp [pairAmplitude,a.property])
rw [hz] at hs
simpa only [Matrix.trace,Matrix.diag_apply,Matrix.mul_apply,Matrix.conjTranspose_apply,
Fintype.sum_prod_type] using hs.symm
lemma pairAmplitude_even {p : β} (z : MatchedPair p β β) (a b : Letter p)
(hab : odd a β Β¬ odd b) :
(pairAmplitude z * (pairAmplitude z).conjTranspose) a b = 0 := by
rw [Matrix.mul_apply]
apply Finset.sum_eq_zero
intro c _
by_cases hac : odd a β odd c
Β· have hbc : Β¬ (odd b β odd c) := by tauto
simp [Matrix.conjTranspose_apply,pairAmplitude,hbc]
Β· simp [Matrix.conjTranspose_apply,pairAmplitude,hac]
/- The real even one-site density obtained by the literal auxiliary partial
trace of a unit matched-pair vector. -/
def pairDensity {p : β} (z : MatchedPair p β β) (hz : β a, z a * star (z a) = 1) : EvenDensity p :=
β¨pairAmplitude z * (pairAmplitude z).conjTranspose,
Matrix.posSemidef_self_mul_conjTranspose _, pairAmplitude_unit_trace z hz,
pairAmplitude_even zβ©
end CoordinateSweeps.SignedTensor
namespace CoordinateSweeps.SignedTensor
variable {p : β}
def basisDensity (a : Letter p) : Matrix (Letter p) (Letter p) β :=
Matrix.diagonal (fun b => if b=a then 1 else 0)
lemma basisDensity_posSemidef (a : Letter p) : (basisDensity a).PosSemidef := by
apply Matrix.PosSemidef.diagonal
intro b
change (0 : β) β€ if b=a then _ else _
split_ifs <;> norm_num
lemma basisDensity_le_one (a : Letter p) : (1-basisDensity a).PosSemidef := by
have he : (1-basisDensity a) = Matrix.diagonal (fun b => if b=a then (0 : β) else 1) := by
ext i j
by_cases hij : i=j
Β· subst j
by_cases hi : i=a <;> simp [basisDensity,Matrix.diagonal,hi]
Β· simp [basisDensity,Matrix.diagonal,hij]
rw [he]
apply Matrix.PosSemidef.diagonal
intro b
change (0 : β) β€ if b=a then _ else _
split_ifs <;> norm_num
lemma basisDensity_trace (a : Letter p) : Matrix.trace (basisDensity a) = 1 := by
simp [basisDensity,Matrix.trace_diagonal]
def pinAmplitude (a : Pair p) : Matrix (Letter p) (Letter p) β :=
fun i j => if (i,j)=a then 1 else 0
lemma pinAmplitude_density (a : Pair p) : pinAmplitude a * (pinAmplitude a).conjTranspose = basisDensity a.1 := by
ext i j
simp only [Matrix.mul_apply,Matrix.conjTranspose_apply,pinAmplitude]
rw [Finset.sum_eq_single a.2]
Β· by_cases hi : i=a.1 <;> by_cases hj : j=a.1 <;>
simp [Prod.ext_iff,hi,hj,basisDensity,Matrix.diagonal,eq_comm]
Β· intro k _ hk
simp [Prod.ext_iff,hk]
Β· simp
def keep (s : β) : β := s/(s+1)
def noise (s p : β) : β := 1/((s+1)*(2*p))
lemma keep_nonneg (s : β) : 0 β€ keep s := div_nonneg (Nat.cast_nonneg _) (by positivity)
lemma noise_nonneg (s p : β) : 0 β€ noise s p := by unfold noise; positivity
lemma keep_add_noise (s p : β) (hp : 0 < p) : keep s + noise s p*(2*p) = 1 := by
have hp' : (p : β) β 0 := Nat.cast_ne_zero.mpr hp.ne'
have hs : (s : β)+1 β 0 := by positivity
unfold keep noise
field_simp
def depolarized (s : β) (r : EvenDensity p) : Matrix (Letter p) (Letter p) β :=
(keep s : β) β’ r.val + (noise s p : β) β’ 1
lemma depolarized_posSemidef (s : β) (r : EvenDensity p) : (depolarized s r).PosSemidef := by
exact (r.property.1.smul (by exact_mod_cast keep_nonneg s)).add
(Matrix.PosSemidef.one.smul (by exact_mod_cast noise_nonneg s p))
lemma depolarized_trace (s : β) (hp : 0 < p) (r : EvenDensity p) : Matrix.trace (depolarized s r) = 1 := by
rw [depolarized,Matrix.trace_add,Matrix.trace_smul,Matrix.trace_smul,r.property.2.1]
simp only [Matrix.trace_one,Fintype.card_fin,smul_eq_mul,mul_one]
exact_mod_cast keep_add_noise s p hp
lemma depolarized_even (s : β) (r : EvenDensity p) (i j : Letter p)
(hij : odd i β Β¬ odd j) : depolarized s r i j = 0 := by
have hne : i β j := by intro h; subst j; tauto
simp [depolarized,Matrix.smul_apply,r.property.2.2 i j hij,hne]
def depolarizedDensity (s : β) (hp : 0 < p) (r : EvenDensity p) : EvenDensity p :=
β¨depolarized s r,depolarized_posSemidef s r,depolarized_trace s hp r,depolarized_even s rβ©
lemma depolarized_free (s : β) (r : EvenDensity p) :
(depolarized s r - (keep s : β) β’ r.val).PosSemidef := by
simpa only [depolarized,add_sub_cancel_left] using
(Matrix.PosSemidef.one (n := Letter p) (R := β)).smul (by exact_mod_cast noise_nonneg s p)
lemma depolarized_pin (s : β) (r : EvenDensity p) (a : Letter p) :
(depolarized s r - (noise s p : β) β’ basisDensity a).PosSemidef := by
have ht : (0 : β) β€ (keep s : β) := by exact_mod_cast keep_nonneg s
have hu : (0 : β) β€ (noise s p : β) := by exact_mod_cast noise_nonneg s p
have h := (r.property.1.smul ht).add ((basisDensity_le_one a).smul hu)
simpa only [depolarized,smul_sub,add_sub_assoc] using h
end CoordinateSweeps.SignedTensor
namespace CoordinateSweeps.SignedTensor
open PositiveTensor
variable {p l : β}
def pinnedDensity (E : Finset (Fin l)) (a : E β Letter p) (r : EvenDensity p) :
Matrix (Word p l) (Word p l) β :=
productMatrix (fun i => if hi : i β E then basisDensity (a β¨i,hiβ©) else r.val)
lemma pinnedDensity_posSemidef (E : Finset (Fin l)) (a : E β Letter p) (r : EvenDensity p) :
(pinnedDensity E a r).PosSemidef := by
apply productMatrix_posSemidef
intro i
split_ifs with hi
Β· exact basisDensity_posSemidef _
Β· exact r.property.1
lemma keep_pow_lower (s n : β) (hn : n β€ s) : 1 β€ (s+1 : β) * (keep s)^n := by
have hs : (0 : β) < s+1 := by positivity
have hi : (s+1 : β)β»ΒΉ β€ 1 := (inv_le_oneβ hs).mpr (by linarith [Nat.cast_nonneg (Ξ± := β) s])
have hb := one_add_mul_le_pow (a := -((s+1 : β)β»ΒΉ)) (by linarith : -2 β€ -((s+1 : β)β»ΒΉ)) n
have he : (1 - (s+1 : β)β»ΒΉ) = keep s := by unfold keep; field_simp; ring
calc
1 β€ (s+1 : β)-n := by
have hn' : (n : β) β€ s := by exact_mod_cast hn
linarith
_ = (s+1 : β)*(1+n * (-((s+1 : β)β»ΒΉ))) := by field_simp; ring
_ β€ (s+1 : β)*(1+(-((s+1 : β)β»ΒΉ)))^n := mul_le_mul_of_nonneg_left hb hs.le
_ = _ := by rw [show 1+(-((s+1 : β)β»ΒΉ)) = keep s from he]
lemma pin_coefficient_le (s p k : β) (hp : 0 < p) (hps : p β€ s)
(hk : k β€ (2*p)*(2*p)) :
(s+1 : β) * ((s+1 : β)*(2*p))^k β€ (s+1 : β)^(13*p^2) := by
have hs : (1 : β) β€ s+1 := by linarith [Nat.cast_nonneg (Ξ± := β) s]
have hp' : (p : β) β€ s := by exact_mod_cast hps
have ha : (2*p : β) β€ (s+1 : β)^2 := by nlinarith [sq_nonneg (s : β)]
have hbase : (s+1 : β)*(2*p) β€ (s+1 : β)^3 := by
nlinarith [mul_le_mul_of_nonneg_left ha (by positivity : (0 : β) β€ s+1)]
have hexp : 3*k+1 β€ 13*p^2 := by
have hp1 : 1 β€ p*p := by nlinarith
nlinarith [hk]
calc
_ β€ (s+1 : β) * ((s+1 : β)^3)^k :=
mul_le_mul_of_nonneg_left (pow_le_pow_leftβ (by positivity) hbase k) (by positivity)
_ = (s+1 : β)^(3*k+1) := by rw [β pow_mul,pow_succ]; ring
_ β€ _ := pow_le_pow_rightβ hs hexp
/- Each pinned ordinary product density is dominated by a tensor power of a
single even density, with only polynomial cost per actual exception. -/
theorem pinned_absorption (s : β) (hp : 0 < p) (hls : l β€ s)
(E : Finset (Fin l)) (a : E β Letter p) (r : EvenDensity p) :
(((s+1 : β) * ((s+1 : β)*(2*p))^E.card : β) : β) β’
densityPower l (depolarized s r) - pinnedDensity E a r |>.PosSemidef := by
let c : Fin l β β := fun i => if i β E then (noise s p : β) else (keep s : β)
let f : Fin l β Matrix (Letter p) (Letter p) β :=
fun i => if hi : i β E then basisDensity (a β¨i,hiβ©) else r.val
have hlocal (i : Fin l) : (c i β’ f i).PosSemidef := by
by_cases hi : i β E
Β· simpa only [c,f,ite_eq_left hi,dite_eq_left hi] using
(basisDensity_posSemidef (a β¨i,hiβ©)).smul (show (0 : β) β€ (noise s p : β) by exact_mod_cast noise_nonneg s p)
Β· simpa only [c,f,ite_eq_right hi,dite_eq_right hi] using
r.property.1.smul (show (0 : β) β€ (keep s : β) by exact_mod_cast keep_nonneg s)
have hdiff (i : Fin l) : (depolarized s r - c i β’ f i).PosSemidef := by
by_cases hi : i β E
Β· simpa only [c,f,ite_eq_left hi,dite_eq_left hi] using depolarized_pin s r (a β¨i,hiβ©)
Β· simpa only [c,f,ite_eq_right hi,dite_eq_right hi] using depolarized_free s r
have h := productMatrix_mono (fun i => c i β’ f i) (fun _ => depolarized s r) hlocal hdiff
rw [productMatrix_smul] at h
have hc : (β i, c i) = ((keep s)^(l-E.card) * (noise s p)^E.card : β) := by
have hE : Finset.univ.filter (fun i : Fin l => i β E) = E := by ext i; simp
have hC : Finset.univ.filter (fun i : Fin l => i β E) = EαΆ := by ext i; simp
simp only [c,Finset.prod_ite,hE,hC,Finset.prod_const,Finset.card_compl,Fintype.card_fin]
push_cast
ring
rw [hc] at h
let C : β := (s+1 : β) * ((s+1 : β)*(2*p))^E.card
have hC : (0 : β) β€ C := by dsimp [C]; positivity
have hu : ((s+1 : β)*(2*p))*noise s p = 1 := by
have hp' : (p : β) β 0 := Nat.cast_ne_zero.mpr hp.ne'
unfold noise
field_simp
have hCW : 1 β€ C*((keep s)^(l-E.card)*(noise s p)^E.card) := by
calc
_ β€ (s+1 : β)*(keep s)^(l-E.card) := keep_pow_lower s _ (le_trans (Nat.sub_le _ _) hls)
_ = _ := by
dsimp [C]
calc
_ = ((s+1 : β)*(keep s)^(l-E.card))*((((s+1 : β)*(2*p))*noise s p)^E.card) := by rw [hu,one_pow,mul_one]
_ = _ := by rw [mul_pow]; ring
have hh := h.smul (show (0 : β) β€ (C : β) by exact_mod_cast hC)
have hz := (pinnedDensity_posSemidef E a r).smul
(show (0 : β) β€ ((C*((keep s)^(l-E.card)*(noise s p)^E.card)-1 : β) : β) by exact_mod_cast sub_nonneg.mpr hCW)
have ht := hh.add hz
change ((C : β) β’ (densityPower l (depolarized s r) -
(((keep s)^(l-E.card)*(noise s p)^E.card : β) : β) β’ pinnedDensity E a r) +
((C*((keep s)^(l-E.card)*(noise s p)^E.card)-1 : β) : β) β’ pinnedDensity E a r).PosSemidef at ht
change ((C : β) β’ densityPower l (depolarized s r) - pinnedDensity E a r).PosSemidef
convert ht using 1
simp only [smul_sub,smul_smul,Complex.ofReal_sub,Complex.ofReal_mul,Complex.ofReal_one,
sub_smul,one_smul]
module
end CoordinateSweeps.SignedTensor
namespace CoordinateSweeps.SignedTensor
open PositiveTensor
variable {p l : β}
theorem pinned_absorption_uniform (s : β) (hp : 0 < p) (hps : p β€ s) (hls : l β€ s)
(E : Finset (Fin l)) (hE : E.card β€ (2*p)*(2*p)) (a : E β Letter p) (r : EvenDensity p) :
((((s+1 : β)^(13*p^2)) : β) β’ densityPower l (depolarized s r) - pinnedDensity E a r).PosSemidef := by
have h := pinned_absorption s hp hls E a r
have hle := pin_coefficient_le s p E.card hp hps hE
have hr : (densityPower l (depolarized s r)).PosSemidef :=
productMatrix_posSemidef (fun _ : Fin l => depolarized s r) (fun _ => depolarized_posSemidef s r)
have hh := (hr.smul (show (0 : β) β€ (((s+1 : β)^(13*p^2) -
(s+1 : β)*((s+1 : β)*(2*p))^E.card : β) : β) by exact_mod_cast sub_nonneg.mpr hle)).add h
convert hh using 1
push_cast
module
end CoordinateSweeps.SignedTensor
namespace CoordinateSweeps.SignedTensor.ExceptionPattern
open PositiveTensor
variable {p l : β}
def siteAmplitude (F : ExceptionPattern p l) (z : MatchedPair p β β) (i : Fin l) :
Matrix (Letter p) (Letter p) β :=
if hi : i β F.sites then pinAmplitude (F.pair β¨i,hiβ©) else pairAmplitude z
def pairProduct (F : ExceptionPattern p l) (z : MatchedPair p β β)
(q : Word p l Γ Word p l) : β := β i, F.siteAmplitude z i (q.1 i) (q.2 i)
lemma siteAmplitude_pin (F : ExceptionPattern p l) (z : MatchedPair p β β) (x : F.FreeWord) (i : F.sites) :
F.siteAmplitude z i.val ((F.fill x).1 i.val) ((F.fill x).2 i.val) = 1 := by
change F.siteAmplitude z i.val (F.fillPair x i.val).1 (F.fillPair x i.val).2 = 1
rw [F.fillPair_at_pin]
simp [siteAmplitude,i.property,pinAmplitude]
lemma siteAmplitude_free (F : ExceptionPattern p l) (z : MatchedPair p β β) (x : F.FreeWord) (i : F.Free) :
F.siteAmplitude z i.val ((F.fill x).1 i.val) ((F.fill x).2 i.val) = z (x i) := by
change F.siteAmplitude z i.val (F.fillPair x i.val).1 (F.fillPair x i.val).2 = z (x i)
rw [F.fillPair_at_free]
simp [siteAmplitude,i.property,pairAmplitude,(x i).property]
lemma pairProduct_fill (F : ExceptionPattern p l) (z : MatchedPair p β β) (x : F.FreeWord) :
F.pairProduct z (F.fill x) = OrdinaryTensor.tensorVector z x := by
unfold pairProduct
rw [β Fintype.prod_subtype_mul_prod_subtype (fun i => i β F.sites)]
simp only [F.siteAmplitude_pin,F.siteAmplitude_free,Finset.prod_const_one,one_mul]
rfl
lemma pairProduct_nonzero (F : ExceptionPattern p l) (z : MatchedPair p β β)
(q : Word p l Γ Word p l) (hq : F.pairProduct z q β 0) : q β Set.range F.fill := by
have hi (i : Fin l) : F.siteAmplitude z i (q.1 i) (q.2 i) β 0 :=
(Finset.prod_ne_zero_iff.mp hq) i (Finset.mem_univ i)
have hp (i : F.sites) : (q.1 i.val,q.2 i.val) = F.pair i := by
by_contra hn
exact hi i.val (by simp [siteAmplitude,i.property,pinAmplitude,hn])
have hf (i : F.Free) : odd (q.1 i.val) β odd (q.2 i.val) := by
by_contra hn
exact hi i.val (by simp [siteAmplitude,i.property,pairAmplitude,hn])
let x : F.FreeWord := fun i => β¨(q.1 i.val,q.2 i.val),hf iβ©
have he (i : Fin l) : F.fillPair x i = (q.1 i,q.2 i) := by
by_cases hi : i β F.sites
Β· exact (F.fillPair_at_pin x β¨i,hiβ©).trans (hp β¨i,hiβ©).symm
Β· exact F.fillPair_at_free x β¨i,hiβ©
exact β¨x,Prod.ext (funext fun i => congrArg Prod.fst (he i)) (funext fun i => congrArg Prod.snd (he i))β©
lemma pairProduct_inclusion (F : ExceptionPattern p l) (z : MatchedPair p β β) :
(inclusion F.embedding).mulVec (OrdinaryTensor.tensorVector z) = F.pairProduct z := by
funext q
by_cases hq : q β Set.range F.fill
Β· obtain β¨x,rflβ© := hq
have hh := inclusion_mulVec_image F.embedding (OrdinaryTensor.tensorVector z) x
change (inclusion F.embedding).mulVec (OrdinaryTensor.tensorVector z) (F.fill x) = _ at hh
exact hh.trans (F.pairProduct_fill z x).symm
Β· rw [inclusion_mulVec_notin F.embedding _ q hq]
exact (not_ne_iff.mp (fun hh => hq (F.pairProduct_nonzero z q hh))).symm
/- Partial tracing a filled product vector yields pinned basis densities at
the true exceptions and the same even density at every remaining slot. -/
lemma filled_product_partialTrace (F : ExceptionPattern p l) (z : MatchedPair p β β)
(hz : β a, z a * star (z a) = 1) :
partialTrace (PositiveTensor.outer ((inclusion F.embedding).mulVec (OrdinaryTensor.tensorVector z))) =
pinnedDensity F.sites (fun i => (F.pair i).1) (pairDensity z hz) := by
rw [F.pairProduct_inclusion]
have he : partialTrace (PositiveTensor.outer (F.pairProduct z)) =
productMatrix (fun i => F.siteAmplitude z i * (F.siteAmplitude z i).conjTranspose) := by
ext u v
simpa only [partialTrace,PositiveTensor.outer,Matrix.vecMulVec_apply,Pi.star_apply,pairProduct] using
pair_product_partialTrace (F.siteAmplitude z) u v
rw [he]
congr 1
funext i
by_cases hi : i β F.sites
Β· simp only [siteAmplitude,hi,dite_eq_left,pinAmplitude_density]
Β· simp [siteAmplitude,hi,pairDensity]
end CoordinateSweeps.SignedTensor.ExceptionPattern
namespace CoordinateSweeps.SignedTensor.ExceptionPattern
open PositiveTensor
variable {p l : β}
lemma purified_trace_le (F : ExceptionPattern p l) (A : commutant p l) :
Matrix.trace (OrdinaryTensor.outer (F.purified A)) β€ Matrix.trace (A.val*A.val.conjTranspose) := by
rw [β sum_purified_trace A]
exact Finset.single_le_sum (fun G _ => OrdinaryTensor.outer_trace_nonneg (G.purified A)) (Finset.mem_univ F)
abbrev Data (F : ExceptionPattern p l) :=
OrdinaryTensor.Histogram F.Free (MatchedPair p) Γ OrdinaryTensor.PhaseSpace F.Free (MatchedPair p)
def dataDensity (F : ExceptionPattern p l) (hn : 0 < Fintype.card F.Free) (d : F.Data) : EvenDensity p :=
pairDensity (OrdinaryTensor.empiricalVector d.1 d.2) (OrdinaryTensor.empiricalVector_unit hn d.1 d.2)
def dataPoint (F : ExceptionPattern p l) (s : β) (hp : 0 < p)
(hn : 0 < Fintype.card F.Free) (d : F.Data) : EvenDensity p :=
depolarizedDensity s hp (F.dataDensity hn d)
def rawPinned (F : ExceptionPattern p l) (hn : 0 < Fintype.card F.Free) :
Matrix (Word p l) (Word p l) β :=
β d : F.Data, pinnedDensity F.sites (fun i => (F.pair i).1) (F.dataDensity hn d)
def rawDensity (F : ExceptionPattern p l) (s : β) (hp : 0 < p) (hn : 0 < Fintype.card F.Free) :
Matrix (Word p l) (Word p l) β :=
β d : F.Data, densityPower l (F.dataPoint s hp hn d).val
lemma rawPinned_posSemidef (F : ExceptionPattern p l) (hn : 0 < Fintype.card F.Free) :
(F.rawPinned hn).PosSemidef := by
exact Matrix.posSemidef_sum _ (fun d _ => pinnedDensity_posSemidef _ _ _)
lemma rawDensity_posSemidef (F : ExceptionPattern p l) (s : β) (hp : 0 < p) (hn : 0 < Fintype.card F.Free) :
(F.rawDensity s hp hn).PosSemidef := by
exact Matrix.posSemidef_sum _ (fun d _ => densityPower_posSemidef _ _ (F.dataPoint s hp hn d).property.1)
lemma rawMixture_partialTrace (F : ExceptionPattern p l) (hn : 0 < Fintype.card F.Free) :
partialTrace (inclusion F.embedding *
(OrdinaryTensor.rawMixture (I := F.Free) (A := MatchedPair p)) * (inclusion F.embedding).conjTranspose) =
F.rawPinned hn := by
unfold OrdinaryTensor.rawMixture rawPinned
rw [Fintype.sum_prod_type]
simp only [Matrix.mul_sum,Matrix.sum_mul,partialTrace_sum]
apply Finset.sum_congr rfl
intro h _
apply Finset.sum_congr rfl
intro t _
have he := congrArg (partialTrace (J := Word p l) (K := Word p l))
(mul_outer_mul_star (inclusion F.embedding)
(OrdinaryTensor.tensorVector (OrdinaryTensor.empiricalVector h t)))
exact he.trans (F.filled_product_partialTrace _ (OrdinaryTensor.empiricalVector_unit hn h t))
lemma rawPinned_domination (F : ExceptionPattern p l) (hp : 0 < p) (hn : 0 < Fintype.card F.Free) :
(F.rawPinned hn - partialTrace (inclusion F.embedding *
(OrdinaryTensor.finiteMixture (I := F.Free) (A := MatchedPair p)) * (inclusion F.embedding).conjTranspose)).PosSemidef := by
let : Nonempty (MatchedPair p) := matchedPair_nonempty hp
have h := (OrdinaryTensor.rawMixture_domination (I := F.Free) (A := MatchedPair p)).mul_mul_conjTranspose_same (inclusion F.embedding)
rw [Matrix.mul_sub,Matrix.sub_mul] at h
have hh := partialTrace_posSemidef _ h
simpa only [partialTrace_sub,F.rawMixture_partialTrace hn] using hh
lemma rawPinned_absorption (F : ExceptionPattern p l) (s : β) (hp : 0 < p)
(hps : p β€ s) (hls : l β€ s) (hn : 0 < Fintype.card F.Free) :
((((s+1 : β)^(13*p^2)) : β) β’ F.rawDensity s hp hn - F.rawPinned hn).PosSemidef := by
have hh := Matrix.posSemidef_sum Finset.univ (fun d _ =>
pinned_absorption_uniform s hp hps hls F.sites F.sites_card_le
(fun i => (F.pair i).1) (F.dataDensity hn d))
simpa only [Finset.sum_sub_distrib,β Finset.smul_sum,rawPinned,rawDensity,dataPoint,depolarizedDensity] using hh
end CoordinateSweeps.SignedTensor.ExceptionPattern
namespace CoordinateSweeps.SignedTensor
open PositiveTensor
variable {p l : β}
lemma matchedPair_card_le (p : β) : Fintype.card (MatchedPair p) β€ (2*p)*(2*p) := by
simpa only [Pair,Fintype.card_prod,Letter,Fintype.card_fin] using
(Fintype.card_subtype_le (fun a : Pair p => odd a.1 β odd a.2))
namespace ExceptionPattern
def empty (p l : β) : ExceptionPattern p l where
sites := β
pair i := False.elim (Finset.notMem_empty i.val i.property)
mismatch i := False.elim (Finset.notMem_empty i.val i.property)
injective i := False.elim (Finset.notMem_empty i.val i.property)
instance : Nonempty (ExceptionPattern p l) := β¨empty p lβ©
lemma data_card_le (F : ExceptionPattern p l) : Fintype.card F.Data β€ (l+1)^(8*p^2) := by
have hh := OrdinaryTensor.histogram_card_le (I := F.Free) (A := MatchedPair p)
have ht : Fintype.card (OrdinaryTensor.PhaseSpace F.Free (MatchedPair p)) =
(Fintype.card F.Free+1)^Fintype.card (MatchedPair p) := by
simp [OrdinaryTensor.PhaseSpace]
rw [Fintype.card_prod,ht]
calc
_ β€ (Fintype.card F.Free+1)^(2*Fintype.card (MatchedPair p)) := by
rw [two_mul (Fintype.card (MatchedPair p)),pow_add]
exact Nat.mul_le_mul_right _ hh
_ β€ (l+1)^(2*Fintype.card (MatchedPair p)) :=
Nat.pow_le_pow_left (Nat.add_le_add_right F.free_card_le 1) _
_ β€ _ := Nat.pow_le_pow_right (by omega) (by nlinarith [matchedPair_card_le p])
lemma free_power_le (F : ExceptionPattern p l) (s : β) (hls : l β€ s) :
(Fintype.card F.Free+1 : β)^(2*Fintype.card (MatchedPair p)) β€ (s+1)^(8*p^2) := by
calc
_ β€ (s+1)^(2*Fintype.card (MatchedPair p)) :=
Nat.pow_le_pow_left (Nat.add_le_add_right (F.free_card_le.trans hls) 1) _
_ β€ _ := Nat.pow_le_pow_right (by omega) (by nlinarith [matchedPair_card_le p])
lemma component_uniform_domination (F : ExceptionPattern p l) (s : β) (hp : 0 < p)
(hps : p β€ s) (hls : l β€ s) (hl : (2*p)*(2*p) < l) (A : commutant p l) :
((Matrix.trace (A.val*A.val.conjTranspose) * ((s+1 : β) : β)^(21*p^2)) β’
F.rawDensity s hp (F.free_card_pos hl) - partialTrace (PositiveTensor.outer (F.component A))).PosSemidef := by
let hn := F.free_card_pos hl
let M := partialTrace (inclusion F.embedding *
(OrdinaryTensor.finiteMixture (I := F.Free) (A := MatchedPair p)) * (inclusion F.embedding).conjTranspose)
have hM : M.PosSemidef := partialTrace_posSemidef _
(OrdinaryTensor.finiteMixture_posSemidef.mul_mul_conjTranspose_same _)
have ht : (0 : β) β€ Matrix.trace (A.val*A.val.conjTranspose) :=
(Matrix.posSemidef_self_mul_conjTranspose A.val).trace_nonneg
have ha : (0 : β) β€ Matrix.trace (A.val*A.val.conjTranspose) * ((s+1 : β) : β)^(8*p^2) :=
mul_nonneg ht (by positivity)
have hc : Matrix.trace (OrdinaryTensor.outer (F.purified A)) *
((Fintype.card F.Free+1 : β) : β)^(2*Fintype.card (MatchedPair p)) β€
Matrix.trace (A.val*A.val.conjTranspose) * ((s+1 : β) : β)^(8*p^2) := by
exact mul_le_mul (F.purified_trace_le A) (by exact_mod_cast F.free_power_le s hls)
(by positivity) ht
have hβ := domination_pad _ M _ _ hM hc (F.component_postselection hp hl A)
have hβ := domination_trans _ M (F.rawPinned hn) _ 1 ha hβ (by
simpa only [one_smul] using F.rawPinned_domination hp hn)
rw [mul_one] at hβ
have hβ := domination_trans _ (F.rawPinned hn) (F.rawDensity s hp hn) _
(((s+1 : β)^(13*p^2)) : β) ha hβ (F.rawPinned_absorption s hp hps hls hn)
convert hβ using 1
push_cast
rw [mul_assoc,β pow_add]
congr 2; ring
end ExceptionPattern
abbrev DensityProfile (p l : β) := Ξ£ F : ExceptionPattern p l, F.Data
lemma densityProfile_card_le (p l : β) : Fintype.card (DensityProfile p l) β€ (l+1)^(12*p^2) := by
rw [Fintype.card_sigma]
calc
_ β€ β _F : ExceptionPattern p l, (l+1)^(8*p^2) :=
Finset.sum_le_sum (fun F _ => F.data_card_le)
_ = Fintype.card (ExceptionPattern p l) * (l+1)^(8*p^2) := by simp
_ β€ (l+1)^((2*p)*(2*p)) * (l+1)^(8*p^2) :=
Nat.mul_le_mul_right _ (ExceptionPattern.card_le (p := p) (l := l))
_ = _ := by rw [β pow_add]; congr 1; ring
lemma densityProfile_nonempty (hp : 0 < p) : Nonempty (DensityProfile p l) := by
let : Nonempty (MatchedPair p) := ExceptionPattern.matchedPair_nonempty hp
let F := ExceptionPattern.empty p l
exact β¨β¨F,Classical.choice inferInstanceβ©β©
def profilePoint (s p l : β) (hp : 0 < p) (hl : (2*p)*(2*p) < l)
(d : DensityProfile p l) : EvenDensity p := d.1.dataPoint s hp (d.1.free_card_pos hl) d.2
def rawProfileDensity (s p l : β) (hp : 0 < p) (hl : (2*p)*(2*p) < l) :
Matrix (Word p l) (Word p l) β :=
β d : DensityProfile p l, densityPower l (profilePoint s p l hp hl d).val
lemma rawProfileDensity_eq (s p l : β) (hp : 0 < p) (hl : (2*p)*(2*p) < l) :
rawProfileDensity s p l hp hl = β F : ExceptionPattern p l, F.rawDensity s hp (F.free_card_pos hl) := by
exact Fintype.sum_sigma _
lemma rawProfileDensity_posSemidef (s p l : β) (hp : 0 < p) (hl : (2*p)*(2*p) < l) :
(rawProfileDensity s p l hp hl).PosSemidef := by
exact Matrix.posSemidef_sum _ (fun d _ => densityPower_posSemidef _ _ (profilePoint s p l hp hl d).property.1)
/- Finite postselection for the literal signed action commutant. -/
theorem commutant_covariance_domination (s p l : β) (hp : 0 < p) (hps : p β€ s)
(hls : l β€ s) (hl : (2*p)*(2*p) < l) (A : commutant p l) :
((Matrix.trace (A.val*A.val.conjTranspose) * ((s+1 : β) : β)^(25*p^2)) β’
rawProfileDensity s p l hp hl - A.val*A.val.conjTranspose).PosSemidef := by
have hc := partialTrace_posSemidef _ (outer_sum_domination (fun F : ExceptionPattern p l => F.component A))
rw [ExceptionPattern.component_sum,partialTrace_sub,partialTrace_smul,partialTrace_sum,
partialTrace_outer_matrix] at hc
have hsum := Matrix.posSemidef_sum Finset.univ (fun (F : ExceptionPattern p l) _ =>
F.component_uniform_domination s hp hps hls hl A)
rw [Finset.sum_sub_distrib,β Finset.smul_sum,β rawProfileDensity_eq s p l hp hl] at hsum
have h := domination_trans _ _ _ (Fintype.card (ExceptionPattern p l) : β) _ (by positivity) hc hsum
have hcard : Fintype.card (ExceptionPattern p l) β€ (s+1)^(4*p^2) := by
calc
_ β€ (l+1)^((2*p)*(2*p)) := ExceptionPattern.card_le (p := p) (l := l)
_ β€ (s+1)^((2*p)*(2*p)) := Nat.pow_le_pow_left (Nat.add_le_add_right hls 1) _
_ = _ := by congr 1; ring
apply domination_pad _ _ _ _ (rawProfileDensity_posSemidef s p l hp hl) _ h
calc
_ β€ ((s+1 : β) : β)^(4*p^2) *
(Matrix.trace (A.val*A.val.conjTranspose) * ((s+1 : β) : β)^(21*p^2)) :=
mul_le_mul_of_nonneg_right (by exact_mod_cast hcard)
(mul_nonneg (Matrix.posSemidef_self_mul_conjTranspose _).trace_nonneg (by positivity))
_ = _ := by rw [mul_left_comm,β pow_add]; congr 2; ring
end CoordinateSweeps.SignedTensor
noncomputable section
open scoped BigOperators ENNReal
open MeasureTheory
namespace CoordinateSweeps.FiniteAtomic
variable {I X V : Type*} [Fintype I] [Nonempty I] [MeasurableSpace X]
[MeasurableSingletonClass X] [NormedAddCommGroup V] [NormedSpace β V] [CompleteSpace V]
def uniform (x : I β X) : Measure X :=
(Fintype.card I : ββ₯0β)β»ΒΉ β’ β i, Measure.dirac (x i)
instance uniform_probability (x : I β X) : IsProbabilityMeasure (uniform x) := by
constructor
simp [uniform, Measure.finsetSum_apply, ENNReal.inv_mul_cancel,
Fintype.card_ne_zero]
omit [Nonempty I] in
lemma uniform_integral (x : I β X) (f : X β V) :
(β« z, f z βuniform x) = (Fintype.card I : β)β»ΒΉ β’ β i, f (x i) := by
unfold uniform
rw [integral_smul_measure,integral_finsetSum_measure]
Β· simp [integral_dirac]
Β· intro i _
exact integrable_dirac enorm_lt_top
end CoordinateSweeps.FiniteAtomic
namespace CoordinateSweeps.SignedTensor
open PositiveTensor MeasureTheory
instance (p : β) : MeasurableSingletonClass (EvenDensity p) := by
let : MeasurableSpace (Matrix (Letter p) (Letter p) β) := borel _
let : BorelSpace (Matrix (Letter p) (Letter p) β) := β¨rflβ©
change MeasurableSingletonClass {r : Matrix (Letter p) (Letter p) β // _}
infer_instance
lemma isotypic_mem_commutant {p l : β} (Ο : UnitaryIrrep (Equiv.Perm (Fin l))) :
isotypic (p := p) Ο β commutant p l := by
intro Ο
rw [isotypic_eq_projector]
exact (Ο.projector_commute (action p l) Ο).symm
lemma isotypic_self_mul {p l : β} (Ο : UnitaryIrrep (Equiv.Perm (Fin l))) :
isotypic (p := p) Ο * (isotypic (p := p) Ο).conjTranspose = isotypic (p := p) Ο := by
rw [(isotypic_posSemidef Ο).isHermitian.eq,isotypic_eq_projector,Ο.projector_idempotent]
lemma isotypic_trace_le (s p l : β) (hls : l β€ s) (Ο : UnitaryIrrep (Equiv.Perm (Fin l))) :
Matrix.trace (isotypic (p := p) Ο) β€ (Ο.dimension : β)*((s+1 : β) : β)^(4*p^2) := by
rw [isotypic_trace]
apply mul_le_mul_of_nonneg_left _ (by positivity)
have hh := (multiplicity_le p l Ο).trans (Nat.pow_le_pow_left (Nat.add_le_add_right hls 1) _)
have he : (2*p)*(2*p) = 4*p^2 := by ring
rw [he] at hh
exact_mod_cast hh
/- The large-slot case, as an actual probability mixture of even densities. -/
theorem density_domination_large (s p l : β) (hp : 0 < p) (hps : p β€ s) (hls : l β€ s)
(hl : (2*p)*(2*p) < l) (Ο : UnitaryIrrep (Equiv.Perm (Fin l))) :
β ΞΌ : Measure (EvenDensity p), IsProbabilityMeasure ΞΌ β§
(((Ο.dimension : β) * ((s+1 : β) : β)^(41*p^2)) β’
(β« r : EvenDensity p, densityPower l r.val βΞΌ) - isotypic (p := p) Ο).PosSemidef := by
let : Nonempty (DensityProfile p l) := densityProfile_nonempty hp
let x := profilePoint s p l hp hl
let ΞΌ := FiniteAtomic.uniform x
refine β¨ΞΌ,inferInstance,?_β©
have hint : (β« r : EvenDensity p, densityPower l r.val βΞΌ) =
(Fintype.card (DensityProfile p l) : β)β»ΒΉ β’ rawProfileDensity s p l hp hl := by
rw [FiniteAtomic.uniform_integral]
change (Fintype.card (DensityProfile p l) : β)β»ΒΉ β’ rawProfileDensity s p l hp hl = _
ext u v
simp [Complex.real_smul]
rw [hint]
let A : commutant p l := β¨isotypic Ο,isotypic_mem_commutant Οβ©
have h := commutant_covariance_domination s p l hp hps hls hl A
change ((_ * _) β’ _ - isotypic Ο * (isotypic Ο).conjTranspose).PosSemidef at h
simp only [A,isotypic_self_mul] at h
have hcard : Fintype.card (DensityProfile p l) β€ (s+1)^(12*p^2) :=
(densityProfile_card_le p l).trans (Nat.pow_le_pow_left (Nat.add_le_add_right hls 1) _)
have hc0 : (Fintype.card (DensityProfile p l) : β) β 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero
have hbig : ((s+1 : β) : β)^(12*p^2) * (Fintype.card (DensityProfile p l) : β)β»ΒΉ β₯ 1 := by
have hi : (0 : β) β€ (Fintype.card (DensityProfile p l) : β)β»ΒΉ := by positivity
have hh := mul_le_mul_of_nonneg_right (show (Fintype.card (DensityProfile p l) : β) β€
((s+1 : β) : β)^(12*p^2) by exact_mod_cast hcard) hi
simpa only [mul_inv_cancelβ hc0] using hh
rw [smul_smul]
apply domination_pad _ _ _ _ (rawProfileDensity_posSemidef s p l hp hl) _ h
calc
_ β€ ((Ο.dimension : β)*((s+1 : β) : β)^(4*p^2)) * ((s+1 : β) : β)^(25*p^2) :=
mul_le_mul_of_nonneg_right (isotypic_trace_le s p l hls Ο) (by positivity)
_ = (Ο.dimension : β)*((s+1 : β) : β)^(29*p^2) := by
rw [mul_assoc,β pow_add]; congr 2; ring
_ β€ ((Ο.dimension : β)*((s+1 : β) : β)^(29*p^2)) *
(((s+1 : β) : β)^(12*p^2) * (Fintype.card (DensityProfile p l) : β)β»ΒΉ) := by
have hh := mul_le_mul_of_nonneg_left hbig
(show (0 : β) β€ (Ο.dimension : β)*((s+1 : β) : β)^(29*p^2) by positivity)
simpa only [mul_one] using hh
_ = _ := by
rw [β mul_assoc,mul_assoc (Ο.dimension : β),β pow_add]
congr 3; ring
def uniformDensity (p : β) (hp : 0 < p) : EvenDensity p :=
β¨((2*p : β) : β)β»ΒΉ β’ 1, Matrix.PosSemidef.one.smul (by positivity), by
rw [Matrix.trace_smul,Matrix.trace_one]
have hc : ((2*p : β) : β) β 0 := Nat.cast_ne_zero.mpr (by omega)
simpa only [Letter,Fintype.card_fin,smul_eq_mul] using inv_mul_cancelβ hc,
by
intro i j hij
have hne : i β j := by intro he; subst j; tauto
simp [hne]β©
lemma densityPower_one (p l : β) : densityPower l (1 : Matrix (Letter p) (Letter p) β) = 1 := by
ext u v
by_cases huv : u=v
Β· subst v
simp [densityPower]
Β· have hi : β i, u i β v i := Function.ne_iff.mp huv
obtain β¨i,hiβ© := hi
simp only [densityPower,Matrix.one_apply,ite_eq_right huv]
exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi)
lemma densityPower_smul {p : β} (l : β) (c : β) (r : Matrix (Letter p) (Letter p) β) :
densityPower l (c β’ r) = c^l β’ densityPower l r := by
ext u v
simp [densityPower,Finset.prod_mul_distrib]
lemma uniformDensity_power (p l : β) (hp : 0 < p) :
densityPower l (uniformDensity p hp).val = (((2*p : β) : β)^l)β»ΒΉ β’ 1 := by
change densityPower l ((((2*p : β) : β)β»ΒΉ) β’ 1) = _
rw [densityPower_smul,densityPower_one,inv_pow]
lemma small_power_le (s p l : β) (hps : p β€ s) (hl : l β€ (2*p)*(2*p)) :
(2*p)^l β€ (s+1)^(8*p^2) := by
have hb : 2*p β€ (s+1)^2 := by nlinarith
calc
_ β€ ((s+1)^2)^l := Nat.pow_le_pow_left hb l
_ = (s+1)^(2*l) := by rw [pow_mul]
_ β€ _ := Nat.pow_le_pow_right (by omega) (by nlinarith)
/- Small slot counts, including zero, require no exceptional-sector chart. -/
theorem density_domination_small (s p l : β) (hp : 0 < p) (hps : p β€ s) (hls : l β€ s)
(hl : l β€ (2*p)*(2*p)) (Ο : UnitaryIrrep (Equiv.Perm (Fin l))) :
β ΞΌ : Measure (EvenDensity p), IsProbabilityMeasure ΞΌ β§
(((Ο.dimension : β) * ((s+1 : β) : β)^(12*p^2)) β’
(β« r : EvenDensity p, densityPower l r.val βΞΌ) - isotypic (p := p) Ο).PosSemidef := by
refine β¨Measure.dirac (uniformDensity p hp),inferInstance,?_β©
rw [integral_dirac,uniformDensity_power,smul_smul]
have hP := trace_domination (isotypic (p := p) Ο) (isotypic_posSemidef Ο)
apply domination_pad _ 1 _ _ Matrix.PosSemidef.one _ hP
have hc0 : (((2*p : β) : β)^l) β 0 := pow_ne_zero _ (Nat.cast_ne_zero.mpr (by omega))
have hi : (0 : β) β€ (((2*p : β) : β)^l)β»ΒΉ := by positivity
have hh := mul_le_mul_of_nonneg_right (show (((2*p : β) : β)^l) β€
((s+1 : β) : β)^(8*p^2) by exact_mod_cast small_power_le s p l hps hl) hi
rw [mul_inv_cancelβ hc0] at hh
calc
_ β€ (Ο.dimension : β)*((s+1 : β) : β)^(4*p^2) := isotypic_trace_le s p l hls Ο
_ β€ ((Ο.dimension : β)*((s+1 : β) : β)^(4*p^2)) *
(((s+1 : β) : β)^(8*p^2)*(((2*p : β) : β)^l)β»ΒΉ) := by
simpa only [mul_one] using mul_le_mul_of_nonneg_left hh
(show (0 : β) β€ (Ο.dimension : β)*((s+1 : β) : β)^(4*p^2) by positivity)
_ = _ := by rw [β mul_assoc,mul_assoc (Ο.dimension : β),β pow_add]; congr 3; ring
end CoordinateSweeps.SignedTensor
namespace CoordinateSweeps.SignedTensor
open PositiveTensor MeasureTheory
lemma domination_coefficient (D s p : β) (hD : 0 < D) :
(Complex.ofReal (Real.exp (Real.log D+41*p^2*Real.log (s+1)))) =
(D : β)*((s+1 : β) : β)^(41*p^2) := by
have hD' : (0 : β) < D := by exact_mod_cast hD
have hs : (0 : β) < s+1 := by positivity
rw [Real.exp_add,Real.exp_log hD']
have he : (41 : β)*p^2*Real.log (s+1) = ((41*p^2 : β) : β)*Real.log (s+1) := by push_cast; ring
rw [he,Real.exp_nat_mul,Real.exp_log hs]
push_cast
rfl
/- Source05 equation13, with a concrete absolute constant. The measure is
constructed from finite empirical phase mixtures, not an added hypothesis. -/
theorem signed_density_domination : Domination := by
refine β¨41,by norm_num,?_β©
intro s p hp hps l hls Ο
have hp0 : 0 < p := by omega
rw [domination_coefficient Ο.dimension s p Ο.positive]
by_cases hl : (2*p)*(2*p) < l
Β· exact density_domination_large s p l hp0 hps hls hl Ο
Β· obtain β¨ΞΌ,hΞΌ,hβ© := density_domination_small s p l hp0 hps hls (by omega) Ο
refine β¨ΞΌ,hΞΌ,?_β©
have hM : (β« r : EvenDensity p, densityPower l r.val βΞΌ).PosSemidef := by
-- Positivity of the integral follows from the explicitly proved lower
-- bound by a PSD projection; no measurability of arbitrary kernels is needed.
have ha : 0 < (Ο.dimension : β)*((s+1 : β) : β)^(12*p^2) := by
exact_mod_cast mul_pos (show (0 : β) < Ο.dimension by exact_mod_cast Ο.positive)
(pow_pos (show (0 : β) < s+1 by positivity) _)
have hh := h.add (isotypic_posSemidef Ο)
rw [sub_add_cancel] at hh
have hc : (Ο.dimension : β)*((s+1 : β) : β)^(12*p^2) β 0 := ne_of_gt ha
have hh' := hh.smul (le_of_lt (inv_pos.mpr ha))
rwa [smul_smul,inv_mul_cancelβ hc,one_smul] at hh'
apply domination_pad _ _ _ _ hM _ h
apply mul_le_mul_of_nonneg_left _ (by positivity)
have he : 12*p^2 β€ 41*p^2 := by omega
exact_mod_cast Nat.pow_le_pow_right (show 0 < s+1 by omega) he
end CoordinateSweeps.SignedTensor
namespace CoordinateSweeps.SignedTensor
open PositiveTensor
lemma finite_profile_domination (s p l : β) (hp : 0 < p) (hps : p β€ s) (hls : l β€ s)
(hl : (2*p)*(2*p) < l) (Ο : UnitaryIrrep (Equiv.Perm (Fin l))) :
(((Ο.dimension : β)*((s+1 : β) : β)^(41*p^2)) β’
((Fintype.card (DensityProfile p l) : β)β»ΒΉ β’ rawProfileDensity s p l hp hl) -
isotypic (p := p) Ο).PosSemidef := by
let : Nonempty (DensityProfile p l) := densityProfile_nonempty hp
let A : commutant p l := β¨isotypic Ο,isotypic_mem_commutant Οβ©
have h := commutant_covariance_domination s p l hp hps hls hl A
change ((_ * _) β’ _ - isotypic Ο * (isotypic Ο).conjTranspose).PosSemidef at h
simp only [A,isotypic_self_mul] at h
have hcard : Fintype.card (DensityProfile p l) β€ (s+1)^(12*p^2) :=
(densityProfile_card_le p l).trans (Nat.pow_le_pow_left (Nat.add_le_add_right hls 1) _)
have hc0 : (Fintype.card (DensityProfile p l) : β) β 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero
have hbig : ((s+1 : β) : β)^(12*p^2) * (Fintype.card (DensityProfile p l) : β)β»ΒΉ β₯ 1 := by
have hi : (0 : β) β€ (Fintype.card (DensityProfile p l) : β)β»ΒΉ := by positivity
have hh := mul_le_mul_of_nonneg_right (show (Fintype.card (DensityProfile p l) : β) β€
((s+1 : β) : β)^(12*p^2) by exact_mod_cast hcard) hi
simpa only [mul_inv_cancelβ hc0] using hh
rw [smul_smul]
apply domination_pad _ _ _ _ (rawProfileDensity_posSemidef s p l hp hl) _ h
calc
_ β€ ((Ο.dimension : β)*((s+1 : β) : β)^(4*p^2)) * ((s+1 : β) : β)^(25*p^2) :=
mul_le_mul_of_nonneg_right (isotypic_trace_le s p l hls Ο) (by positivity)
_ = (Ο.dimension : β)*((s+1 : β) : β)^(29*p^2) := by
rw [mul_assoc,β pow_add]; congr 2; ring
_ β€ ((Ο.dimension : β)*((s+1 : β) : β)^(29*p^2)) *
(((s+1 : β) : β)^(12*p^2) * (Fintype.card (DensityProfile p l) : β)β»ΒΉ) := by
have hh := mul_le_mul_of_nonneg_left hbig
(show (0 : β) β€ (Ο.dimension : β)*((s+1 : β) : β)^(29*p^2) by positivity)
simpa only [mul_one] using hh
_ = _ := by
rw [β mul_assoc,mul_assoc (Ο.dimension : β),β pow_add]
congr 3; ring
lemma finite_uniform_domination (s p l : β) (hp : 0 < p) (hps : p β€ s) (hls : l β€ s)
(hl : l β€ (2*p)*(2*p)) (Ο : UnitaryIrrep (Equiv.Perm (Fin l))) :
(((Ο.dimension : β)*((s+1 : β) : β)^(12*p^2)) β’
densityPower l (uniformDensity p hp).val-isotypic (p := p) Ο).PosSemidef := by
rw [uniformDensity_power,smul_smul]
have hP := trace_domination (isotypic (p := p) Ο) (isotypic_posSemidef Ο)
apply domination_pad _ 1 _ _ Matrix.PosSemidef.one _ hP
have hc0 : (((2*p : β) : β)^l) β 0 := pow_ne_zero _ (Nat.cast_ne_zero.mpr (by omega))
have hi : (0 : β) β€ (((2*p : β) : β)^l)β»ΒΉ := by positivity
have hh := mul_le_mul_of_nonneg_right (show (((2*p : β) : β)^l) β€
((s+1 : β) : β)^(8*p^2) by exact_mod_cast small_power_le s p l hps hl) hi
rw [mul_inv_cancelβ hc0] at hh
calc
_ β€ (Ο.dimension : β)*((s+1 : β) : β)^(4*p^2) := isotypic_trace_le s p l hls Ο
_ β€ ((Ο.dimension : β)*((s+1 : β) : β)^(4*p^2)) *
(((s+1 : β) : β)^(8*p^2)*(((2*p : β) : β)^l)β»ΒΉ) := by
simpa only [mul_one] using mul_le_mul_of_nonneg_left hh
(show (0 : β) β€ (Ο.dimension : β)*((s+1 : β) : β)^(4*p^2) by positivity)
_ = _ := by rw [β mul_assoc,mul_assoc (Ο.dimension : β),β pow_add]; congr 3; ring
/- Finite (not a hypothetical measure) version of source05:eq13. -/
theorem finite_density_domination (s p l : β) (hp : 0 < p) (hps : p β€ s) (hls : l β€ s)
(Ο : UnitaryIrrep (Equiv.Perm (Fin l))) :
β (I : Type) (_ : Fintype I) (_ : Nonempty I) (r : I β EvenDensity p),
(((Ο.dimension : β)*((s+1 : β) : β)^(41*p^2)) β’
((Fintype.card I : β)β»ΒΉ β’ β i, densityPower l (r i).val)-isotypic (p := p) Ο).PosSemidef := by
by_cases hl : (2*p)*(2*p)<l
Β· exact β¨DensityProfile p l,inferInstance,densityProfile_nonempty hp,
profilePoint s p l hp hl,finite_profile_domination s p l hp hps hls hl Οβ©
Β· refine β¨PUnit,inferInstance,inferInstance,fun _ => uniformDensity p hp,?_β©
simp only [Fintype.card_punit,Nat.cast_one,inv_one,Finset.univ_unique,Finset.sum_singleton,one_smul]
apply domination_pad _ _ _ _ (densityPower_posSemidef _ _ (uniformDensity p hp).property.1) _
(finite_uniform_domination s p l hp hps hls (by omega) Ο)
apply mul_le_mul_of_nonneg_left _ (by positivity)
exact_mod_cast Nat.pow_le_pow_right (show 0 < s+1 by omega) (show 12*p^2β€41*p^2 by omega)
end CoordinateSweeps.SignedTensor
end
end
end
end
open scoped Matrix.Norms.L2Operator
end OAI
import Mathlib
import OAI.RepresentationTheory.SignedTensor.Basic
import OAI.RepresentationTheory.Tensor.Postselection
import OAI.Analysis.Matrix.TensorMoment
namespace OAI
noncomputable section
open scoped BigOperators Matrix.Norms.L2Operator ComplexOrder
attribute [local instance] Classical.propDecidable
noncomputable section
open scoped BigOperators ComplexConjugate Matrix.Norms.L2Operator
attribute [local instance] Classical.propDecidable
noncomputable section
open scoped BigOperators ComplexOrder MatrixOrder
attribute [local instance] Classical.propDecidable
namespace CoordinateSweeps.SignedTensor
open PositiveTensor
/- Partial-trace invariance of the actual regrouping signs on each fixed
exception sector. No assumption of complex conditional probabilities occurs. -/
theorem partialTrace_regroup {p l : β} (E : Finset (Fin l))
(v : Word p l Γ Word p l β β)
(hv : β u w, v (u,w) β 0 β β i,
(odd (u i) β Β¬ odd (w i)) β i β E) :
partialTrace (PositiveTensor.outer (fun uw => regroupPhase uw.1 uw.2 * v uw)) =
partialTrace (PositiveTensor.outer v) := by
ext u u'
apply Finset.sum_congr rfl
intro w _
change (regroupPhase u w * v (u,w)) * star (regroupPhase u' w * v (u',w)) =
v (u,w)*star (v (u',w))
by_cases hu : v (u,w) = 0
Β· simp [hu]
by_cases hu' : v (u',w) = 0
Β· simp [hu']
have he : regroupPhase u w = regroupPhase u' w := by
apply regroupPhase_of_same_parity
intro i
have hi := hv u w hu i
have hi' := hv u' w hu' i
tauto
rw [star_mul,regroupPhase_star,he]
calc
_ = (regroupPhase u' w * regroupPhase u' w) * (v (u,w)*star (v (u',w))) := by ring
_ = _ := by rw [regroupPhase_square,one_mul]
abbrev Pair (p : β) := Letter p Γ Letter p
abbrev MatchedPair (p : β) := {a : Pair p // odd a.1 β odd a.2}
/- Valid pinned exceptional data. Injectivity is essential: it is supplied
by the proved repeated-mismatch cancellation, not imposed on the kernel. -/
structure ExceptionPattern (p l : β) where
sites : Finset (Fin l)
pair : sites β Pair p
mismatch : β i, odd (pair i).1 β Β¬ odd (pair i).2
injective : Function.Injective pair
deriving Fintype
/- Every nonzero commuting matrix entry has literal valid exceptional data. -/
def entryPattern {p l : β} (A : commutant p l) (u w : Word p l) (h : A.val u w β 0) :
ExceptionPattern p l where
sites := mismatchSlots u w
pair i := (u i.val,w i.val)
mismatch i := (Finset.mem_filter.mp i.property).2
injective := by
intro i j he
apply Subtype.ext
by_contra hij
exact h (commutant_entry_zero_repeated_mismatch A u w i.val j.val hij
(congrArg Prod.fst he) (congrArg Prod.snd he) (Finset.mem_filter.mp i.property).2)
namespace ExceptionPattern
variable {p l : β}
def encode (F : ExceptionPattern p l) (a : Pair p) : Option (Fin l) :=
if h : β i : F.sites, F.pair i = a then some (Classical.choose h).val else none
lemma encode_eq_some (F : ExceptionPattern p l) (a : Pair p) (i : Fin l) :
F.encode a = some i β β hi : i β F.sites, F.pair β¨i,hiβ© = a := by
unfold encode
split_ifs with h
Β· constructor
Β· intro he
have hi := Option.some.inj he
subst i
exact β¨(Classical.choose h).property, Classical.choose_spec hβ©
Β· rintro β¨hi,heβ©
have hh : Classical.choose h = β¨i,hiβ© := F.injective ((Classical.choose_spec h).trans he.symm)
rw [hh]
Β· constructor
Β· intro he; cases he
Β· rintro β¨hi,heβ©
exact (h β¨β¨i,hiβ©,heβ©).elim
lemma mem_sites_iff (F : ExceptionPattern p l) (i : Fin l) :
i β F.sites β β a, F.encode a = some i := by
constructor
Β· intro hi