import YM.OPE.Grouping.Birth import YM.OPE.Grouping.Compose /-! # Group many pairs etc along replication cells -/ set_option autoImplicit false noncomputable section namespace YM.MergeProof.Ribbons.ManyCopies open Function Filter Lattice RG Pressure Wilson Finset MeasureTheory open Push Marker Accent Ribbon Local Menu Extra.Histories Motion Merge PhysicalNext.Repeat Lotus open Extra.Multi GridApprox.Nil open Extra.Trajectories MergeProof.Float open scoped Topology BigOperators Classical variable {V I J Y : Type}[Fintype V][DecidableEq V][Fintype I][DecidableEq I] [Fintype J][DecidableEq J][Fintype Y][DecidableEq Y]{G:Gauge}{n:Side}{R:Rep G n} {u : (V × I)→ℂ}{a:V→Equiv.Perm V}{x:V→Site n}{m:V→Motion}{U V' : Type} def partialGroup (V : Type) (L:Fibers I J) : Fibers (V×I) (V×J) := ⟨fun i => (i.1,L.bunch i.2), fun i => (i.1,L.twig i.2), fun i=>Prod.ext rfl (L.sectioned i.2)⟩ def finishGroup (V : Type) (i:I) : Fibers (V×I) V := ⟨Prod.fst,fun v=>(v,i),fun _=>rfl⟩ def district (v:V)(I:Type) : Set (V×I) := {i| i.1=v} lemma contentP (L:Fibers I J) (v:V)(j:J): ((partialGroup V L).contents (v,j))=(L.contents j).image (fun i=>(v,i)) := by ext i; rw [Fibers.focuses,mem_image]; constructor · intro h; refine ⟨i.2,(L.focuses ..).2 (congr_arg Prod.snd h),Prod.ext (congr_arg Prod.fst h).symm rfl⟩ rintro ⟨i,hi,rfl⟩; exact Prod.ext rfl ((L.focuses ..).1 hi) lemma contentF (v:V)(i:I):(finishGroup V i).contents v=univ.image (fun t:I=>(v,t)) := by ext t; rw [Fibers.focuses,mem_image]; constructor · intro h; exact ⟨t.2,mem_univ _,Prod.ext h.symm rfl⟩ rintro ⟨i,-,rfl⟩; rfl lemma district_iff (u:V)(p:(Names V I).Mode): (p.val:Set (V×I))⊆ district u I ↔ Focused u p:=by unfold Focused; change _↔ p.val.image _⊆{u}; rw [image_subset_iff]; simp [district, Set.subset_def] lemma Focus_collapse {L:Fibers (V×I) Y}{s:Set Y}{v:V}(h:∀ i:V×I,L.bunch i∈s↔i∈district v I) (p:(Names V I).Mode) : L.Focus s p ↔ Focused v p:=by rw [← district_iff]; unfold Fibers.Focus Fibers.span; rw [coe_image,Set.image_subset_iff,show L.bunch ⁻¹' s = district v I from Set.ext h] variable {Δ : Fibers (V×I) Y} (S : Fibers.Salt Y (V×I) Δ G n) lemma familyOf {C G':Set Y}{b:Equiv.Perm Y} {v w:V}{a:Equiv.Perm V}{x:Site n}{m:Motion}{t:ℝ} (h: (Δ).Permutes (nome a) b)(hx:a v=w) (he:∀ i, Δ.bunch i∈C ↔ i.1=v) (he':∀ i,Δ.bunch i∈ G'↔ i.1=w) (hj:∀ i:I,S.grain (w,i)=affine m.1 x (S.grain (v,i)) ∧ S.pepper (w,i)=scalar m (S.pepper (v,i))) (hz:∀ U,(∀ i,Harm v a m (S.air i (pull m.1 x U)) (S.air (sky m x i) U))∧(∀ i,Harm v a m (S.river i (pull m.1 x U)) (S.river (puff m x i) U))) : Fibers.CopyFamily S t m x C G' (nome a) b := by refine ⟨h,fun i=>?_,?_,?_,fun p hp i U=>?_,fun p hp i U=>?_⟩ · obtain ⟨j,rfl⟩:=Δ.sectioned.surjective i; rw [← h.run,he,he',← hx]; exact a.injective.eq_iff · rintro ⟨u,i⟩ hp; obtain rfl : u=v:= (he _).1 hp; rw [show nome a (u,i)=(w,i) from Prod.ext hx rfl]; exact (hj i).1 · rintro ⟨u,i⟩ hp; obtain rfl : u=v:= (he _).1 hp; rw [show nome a (u,i)=(w,i) from Prod.ext hx rfl]; exact (hj i).2 · exact (hz U).1 i p ((Focus_collapse (v:=v) he p).1 hp) exact (hz U).2 i p ((Focus_collapse (v:=v) he p).1 hp) variable {g:(V×I) → Config G n→ℂ} {k:(V×I)→ℕ → Config G n→ℂ} {μ:(V×I)→Site n} {v:V} {P:Config G n→ Poly (Names V I)} {η T Z w c q b d α z : ℝ} (H : ℕ) (L:Fibers (V×I) Y) {F:(V×I)→ℝ} {C:Y→ℝ} (s l:ℕ) set_option quotPrecheck false local notation "τ" => R.p.threshold local notation "y!"=> Ribbons.Salt.scent R.p.B s (R.p.supportExponent+c) T η α b local notation "W₁"=>Fibers.Salt.tow F (R.p.supportExponent+c) (η/H) l variable (A:Arsenal R)(hA:Arc R g k P v m x a μ F (R.p.supportExponent+c) (R.p.supportExponent+q) α b w u) -- use hW as in mutation, mustn't lose mirror consistency. (hr:R.activities.Valid R.p z d)(hP:∀ i,i≠v→∀ j:I,μ (i,j)=affine (m i).1 (x i) (μ (v,j))∧ u (i,j)=scalar (m i) (u (v,j))) (hw:∀ i,0