letF:=MonoidAlgebra.lift K (T.Algebra (K:=K)) (FreeMonoid α) ((wordHom T).comp f)
haveH : U.ideal (K:=K) ≤TwoSidedIdeal.ker F:=by
apply TwoSidedIdeal.span_le.mpr
rintro v (⟨a,b,hab,rfl⟩|⟨a,ha,rfl⟩)
· change F (monomial a-monomial b)=0
simp only [map_sub,F,monomial,MonoidAlgebra.lift_single,one_smul,
MonoidHom.comp_apply,wordHom,MonoidHom.coe_mk,OneHom.coe_mk]
exact sub_eq_zero.mpr (hr a b hab)
· change F (monomial a)=0
simpa only [F,monomial,MonoidAlgebra.lift_single,one_smul,
MonoidHom.comp_apply,wordHom,MonoidHom.coe_mk,OneHom.coe_mk] using hz a ha
apply RingCon.liftₐ _ F
intro a b hab
change F a=F b
apply sub_eq_zero.mp
rw [←map_sub]
exact H ((U.ideal (K:=K)).rel_iff a b |>.mp hab)
toFun :=fun w =>FreeMonoid.ofList (embedding h D w.toList)
map_one' :=by simp [embedding,encodeWord]
map_mul' :=by intro v w;simp [embedding,encodeWord,List.flatMap_append]
lemmaeval_letter (w : List (Raw h)) :
DirectCancellation.eval (letter (K:=K) hh S d) w =
(algebraTable hh S d).word (FreeMonoid.ofList w) :=by
proof · 6
lines
induction w with
| nil => exact (algebraTable hh S d).word_one.symm
| cons a w ih =>
change letter hh S d a * DirectCancellation.eval (letter hh S d) w = _
rw [ih]
exact ((algebraTable hh S d).word_mul (FreeMonoid.ofList [a]) (FreeMonoid.ofList w)).symm
obtain ⟨c,he,hp,hf⟩ := ha
cases hd : decode hh a with
| none => simp [fields,hd] at he
| some b =>havehe' : noncolor b=c :=by simpa [fields,hd] using he
exact ⟨b,rfl, (noncolor_isPalette b).mp (he' ▸ hp), (noncolor_headFree b).mp (he' ▸ hf)⟩
lemmalong_eligible_interval (h4 : 4≤ h) (w : List (Raw h))
(hn : 2*fragmentBound (2^h)+1≤ w.length)
(hw : DirectCancellation.eval (letter (K:=K) hh S d) w ≠0) :
∃a e,DirectCancellation.EligibleInterval eligibleFields (2^h) (w.map (fields hh)) a e :=by
proof · 5
lines
obtain ⟨v,hv,hnv,hq,t,ht,he⟩ := (surviving_of_eval_ne_zero w hw).long_uniform h4 (by omega)
apply DirectCancellation.maximal_of_uniform eligibleFields (2^h) (hv.map (fields hh)) (by simpa using (byomega : 0<v.length)) (by simpa using hq) t ht
intro x hx
obtain ⟨a,ha,rfl⟩ :=List.mem_map.mp hx
exact he a ha
rintro ⟨p,s,gs⟩ hx ⟨p',s',gs'⟩ hy he
obtain ⟨hp0,hs0,_,_⟩ := (mem_language token ps ss n p s gs).mp hx
obtain ⟨hp1,hs1,_,_⟩ := (mem_language token ps ss n p' s' gs').mp hy
haveht0 : ∀ t ∈ gs.map token, Cuts.Interval cut t :=by
intro t hm; obtain ⟨g,_,rfl⟩ :=List.mem_map.mp hm; exact ht g
haveht1 : ∀ t ∈ gs'.map token, Cuts.Interval cut t :=by
intro t hm; obtain ⟨g,_,rfl⟩ :=List.mem_map.mp hm; exact ht g
have hh :=Cuts.language_injective cut (hp p hp0) (hs s hs0) ht0
(hp p' hp1) (hs s' hs1) ht1 (by simpa only [←List.flatMap_def,join] using he)
obtain ⟨rfl,hg,rfl⟩ := hh
havehgs : gs=gs' := (List.map_injective_iff.mpr hinj) hg
simp only [hgs]
theoremeventually_letterSum_zero (cut : α →Prop) (token : Γ →List α)
(hinj : Function.Injective token) (ht : ∀ c, Cuts.Interval cut (token c))
(ps ss : Finset (List α)) (hp : ∀ p∈ps, Cuts.NoCut cut p)
(hs : ∀ s∈ss, Cuts.Interval cut s) (B : ℕ)
(hpB : ∀ p∈ps, p.length ≤B) (hsB : ∀ s∈ss, s.length ≤B)
(len : Γ →ℕ) (hl : ∀ c, 1≤ len c) (L : ℕ) (hL : 1≤L)
(hlen : ∀ c, (token c).length=L*len c) (f : α →R) (N₀N₁ : ℕ)
(hcover : ∀ w, N₀≤ w.length → eval f w ≠0→∃ p∈ps, ∃ s∈ss, ∃gs : List Γ, w=p++gs.flatMap token++s)
(hchunk : ∀ m, N₁≤ m → chunkSum len (fun c => eval f (token c)) m=0)
(n : ℕ) (hn : max N₀ (2*B+L*N₁) ≤ n) : letterSum f n=0:=by
proof · 30
lines
rw [letterSum_eq_language cut token hinj ht ps ss hp hs f n
(fun w hw h => hcover w (by omega) h)]
rw [language,Finset.sum_filter]
simp only [Finset.product_eq_sprod,Finset.sum_product]
apply Finset.sum_eq_zero
intro p hp0
apply Finset.sum_eq_zero
intro s hs0
change (∑ gs ∈ candidates Γ n,
if (p++gs.flatMap token++s).length=n then eval f (p++gs.flatMap token++s) else0)=0havehslice : (∑ gs ∈ (candidates Γ n).filter
(fun gs => (p++gs.flatMap token++s).length=n),
eval (fun c => eval f (token c)) gs) = 0:=by
rcases slice_eq_chunk f token len hl L hL hlen p s n with h | ⟨m,hm,he⟩
· exact h
· rw [he,hchunk m]
have hp' := hpB p hp0
have hs' := hsB s hs0
havehn' : 2*B+L*N₁≤ n :=by omega
nlinarith
havehe : (∑ gs ∈ candidates Γ n,
if (p++gs.flatMap token++s).length=n then eval f (p++gs.flatMap token++s) else0) =
eval f p * (∑ gs ∈ (candidates Γ n).filter
(fun gs => (p++gs.flatMap token++s).length=n),
eval (fun c => eval f (token c)) gs) * eval f s :=by
rw [Finset.sum_filter,Finset.mul_sum,Finset.sum_mul]
apply Finset.sum_congr rfl
intro gs _
split_ifs <;> simp [eval_append,eval_flatMap,mul_assoc]
rw [he,hslice,mul_zero,zero_mul]
lemmatensor_mul (XY : Matrix ι ι K) (a b : A) :
tensor X a * tensor Y b = tensor (X*Y) (a*b) :=by
proof · 5
lines
ext i j
simp only [Matrix.mul_apply,tensor,Finset.sum_smul]
apply Finset.sum_congr rfl
intro k _
simp [Algebra.smul_mul_assoc,Algebra.mul_smul_comm,smul_smul,mul_comm]
lemmaeval_tensor {α : Type*} (W : α →Matrix ι ι K) (f : α →A) (w : List α) :
(w.map (fun a=>tensor (W a) (f a))).prod =
tensor ((w.map W).prod) (DirectCancellation.eval f w) :=by
proof · 5
lines
induction w with
| nil => exact tensor_one.symm
| cons a w ih =>
simp only [List.map_cons,List.prod_cons,DirectCancellation.eval,List.map_cons,List.prod_cons] at *
rw [ih,tensor_mul]
lemmaeval_flatMap (f : α →A) (label : Γ →List α) (gs : List Γ) :
DirectCancellation.eval (fun c=>DirectCancellation.eval f (label c)) gs =
DirectCancellation.eval f (gs.flatMap label) :=by
proof · 5
lines
induction gs with
| nil => rfl
| cons a gs ih =>
simp only [List.flatMap_cons,DirectCancellation.eval_append]
exact congrArg (fun x=>DirectCancellation.eval f (label a)*x) ih
lemmachunkSum_entry {d : ℕ} (label : Γ →List α) (W : Γ →Matrix (Fin d) (Fin d) K)
(f : α →A) (n : ℕ) (i j : Fin d) :
chunkSum label W f n i j = DirectCancellation.chunkSum label W f n i j :=by
proof · 12
lines
unfold chunkSum CutReduction.chunkSum DirectCancellation.chunkSum
havehe : (CutReduction.candidates Γ n).filter (fun gs=>(gs.map (fun c=>(label c).length)).sum=n) =
(DirectCancellation.candidates Γ n).filter (fun gs=>(DirectCancellation.spell label gs).length=n) :=by
apply Finset.filter_congr
intro gs _
simp [DirectCancellation.spell,List.length_flatMap]
rw [he]
simp only [Matrix.sum_apply]
apply Finset.sum_congr rfl
intro gs hgs
have hh := congrArg (funM : Matrix (Fin d) (Fin d) A=>M i j) (eval_tensor W (fun c=>DirectCancellation.eval f (label c)) gs)
simpa only [CutReduction.eval,eval_flatMap,tensor,Cancellation.chunkWeight,DirectCancellation.spell] using hh
lemmadirect_vanish {T : Type*} [CharPK2] {d b q N : ℕ}
(label : Γ →List α) (hne : ∀c,label c≠[]) (hb : ∀c,(label c).length ≤ b)
(erase : α →T) (eligible : T→Prop) (f : α →A)
(hcomm : ∀t,eligible t →∀x y,erase x=t → erase y=t →Commute (f x) (f y))
(hsquare : ∀x,eligible (erase x) → f x*f x=0)
(hlong : ∀w : List α,N≤ w.length →DirectCancellation.eval f w≠0→∃a e,DirectCancellation.EligibleInterval eligible q (w.map erase) a e)
(hbound : 100*b*(d^2+3)<q) (W : Γ →Matrix (Fin d) (Fin d) K) :
∀n,N≤ n → chunkSum label W f n=0:=by
proof · 4
lines
intro n hn
ext i j
rw [chunkSum_entry]
exact DirectCancellation.direct_cancellation label hne hb erase eligible f hcomm hsquare hlong hbound W n hn i j
lemmasum_wordCoefficient_tensor (label : Γ →List α) (W : Γ →Matrix ι ι K)
(f : α →A) (n : ℕ) :
(∑w : Fin n → α,tensor (Automaton.wordCoefficient label W (List.ofFn w))
(DirectCancellation.eval f (List.ofFn w)))=chunkSum label W f n :=by
proof · 18
lines
have hc (w : Fin n→α) : Automaton.wordCoefficient label W (List.ofFn w)=
∑s : Automaton.BoundedSequences Γ n,ifAutomaton.spelled label s=List.ofFn w thenAutomaton.seqWeight W s else0:=byhave aux (v : List α) (m : ℕ) (hm : v.length=m) : Automaton.wordCoefficient label W v=
∑s : Automaton.BoundedSequences Γ m,ifAutomaton.spelled label s=v thenAutomaton.seqWeight W s else0:=by
subst m
rfl
exact aux _ _ List.length_ofFn
simp_rw [hc,tensor_sum]
rw [Finset.sum_comm,chunkSum_eq_sequences]
apply Finset.sum_congr rfl
intro s _
have he (w : Fin n→α) : tensor (ifAutomaton.spelled label s=List.ofFn w thenAutomaton.seqWeight W s else0)
(DirectCancellation.eval f (List.ofFn w)) =
ifList.ofFn w=Automaton.spelled label s then tensor (Automaton.seqWeight W s)
(DirectCancellation.eval f (Automaton.spelled label s)) else0:=by
split_ifs <;> simp_all [tensor_left_zero]
simp_rw [he]
exact Automaton.sum_words_eq (Automaton.spelled label s) n _
lemmareindex_chunkSum (e : ι ≃ κ) (label : Γ →List α) (W : Γ →Matrix ι ι K) (f : α →A) (n : ℕ) :
Matrix.reindexRingEquiv A e (chunkSum label W f n)=chunkSum label (fun c=>Matrix.reindexRingEquiv K e (W c)) f n :=by
proof · 1
line
simp only [chunkSum,CutReduction.chunkSum,CutReduction.eval,map_sum,map_list_prod,List.map_map,Function.comp_def,reindex_tensor]