import Mathlib import OAI.Combinatorics.Chromatic.Shuffle.TensorColumnSeriesFiltration import OAI.Combinatorics.Chromatic.GradedAlgebra.ClearedSeparation namespace OAI section namespace ElementaryPositivity.RawShuffle open scoped TensorProduct open ElementaryPositivity.LaurentAtInfinity ElementaryPositivity.SlopeArithmetic open SeparationInfinity variable {I : Type*} [Fintype I] [DecidableEq I] noncomputable local instance clearBTensorS (d e : I → ℕ) : CommRing (S d⊗[ℚ]S e) := inferInstance noncomputable local instance clearBTensorSA (d e : I → ℕ) : Algebra ℚ (S d⊗[ℚ]S e) := inferInstance noncomputable local instance clearBTensorB (a : I → I → ℕ) (μ : (I → ℕ) → ℝ) (d e : I → ℕ) : CommRing (B a μ d⊗[ℚ]B a μ e) := inferInstance noncomputable local instance clearBTensorBA (a : I → I → ℕ) (μ : (I → ℕ) → ℝ) (d e : I → ℕ) : Algebra ℚ (B a μ d⊗[ℚ]B a μ e) := inferInstance noncomputable def clearedSeparationB (a : I → I → ℕ) (μ : (I → ℕ) → ℝ) (d e : I → ℕ) : B a μ d⊗[ℚ]B a μ e →ₗ[ℚ] LaurentSeries (B a μ d⊗[ℚ]B a μ e) := (mulPolynomial (mixedInverseKernelUnit a a μ d e * (mixedInverseKernelUnit a (fun _ _ : I=>0) μ d e)⁻¹).val).comp (relativeTaylorB a μ d e).toLinearMap lemma mapRing_ratio_val {R T : Type*} [CommRing R] [CommRing T] (f : R →+* T) (u v : (LaurentSeries R)ˣ) : mapRing f (u*v⁻¹).val= (Units.map (mapRing f).toMonoidHom u*(Units.map (mapRing f).toMonoidHom v)⁻¹).val := by rw [Units.val_mul,map_mul] rfl lemma clearedSeparationB_mk (a : I → I → ℕ) (μ : (I → ℕ) → ℝ) (d e : I → ℕ) (x : S d⊗[ℚ]S e) : clearedSeparationB a μ d e (quotientTensor a μ d e x)= mapRing (quotientTensor a μ d e).toRingHom ((inverseKernelUnit a d e*(inverseKernelUnit (fun _ _ : I=>0) d e)⁻¹).val * polynomial (relativeTaylor d e x)) := by rw [mapRing_mul_polynomial,mapRing_ratio_val,relativeTaylor_quotient] rfl variable {A : I → Type*} [∀ i,Fintype (A i)] [∀ i,DecidableEq (A i)] lemma unitalSeparationSeries_shuffle_grid (a : I → I → ℕ) (c η : I → ℝ) (hc : ∀ i,0