import OAI.Geometry.HarmonicGrowth.AngularTrace import OAI.Geometry.HarmonicGrowth.PulseSystem import OAI.Geometry.HarmonicGrowth.AngularStream import OAI.Geometry.HarmonicGrowth.GlobalControl namespace OAI noncomputable section namespace HarmonicCounterexample.AngularStream open Set Filter Schedule Pulses FiniteControl.SmoothWord open scoped Topology ContDiff BigOperators variable {n : ℕ} lemma scalarPacket_smooth (a : Fin n → ℝ) : ContDiff ℝ ∞ (unitPacketScalar a) := by unfold unitPacketScalar packetScalar exact contDiff_const.mul (ContDiff.sum (fun i _ => contDiff_const.mul ((bump_smooth i).comp (contDiff_const.mul contDiff_id)))) lemma scalarPacket_before (a : Fin n → ℝ) {t : ℝ} (ht : duration n*t < 1) : unitPacketScalar a t=0 := by unfold unitPacketScalar packetScalar have h : ∑ i : Fin n,a i*bump i (duration n*t)=0 := by apply Finset.sum_eq_zero intro i _ rw [bump_zero_before (by have hi : 0 ≤ (i:ℝ) := Nat.cast_nonneg _;linarith),mul_zero] rw [h,mul_zero] lemma scalarPacket_after (a : Fin n → ℝ) {t : ℝ} (ht : 2*(n:ℝ) < duration n*t) : unitPacketScalar a t=0 := by unfold unitPacketScalar packetScalar have h : ∑ i : Fin n,a i*bump i (duration n*t)=0 := by apply Finset.sum_eq_zero intro i _ have hi : (i:ℝ)+1 ≤ n := by exact_mod_cast i.isLt rw [bump_zero_after (by linarith),mul_zero] rw [h,mul_zero] lemma scalarPacket_zero_before (a : Fin n → ℝ) {t : ℝ} (ht : t ≤ 0) : unitPacketScalar a t=0 := scalarPacket_before a (lt_of_le_of_lt (mul_nonpos_of_nonneg_of_nonpos (duration_pos n).le ht) (by norm_num)) lemma scalarPacket_zero_after (a : Fin n → ℝ) {t : ℝ} (ht : 1 ≤ t) : unitPacketScalar a t=0 := by apply scalarPacket_after a have h : duration n ≤ duration n*t := by simpa using mul_le_mul_of_nonneg_left ht (duration_pos n).le dsimp [duration] at h ⊢;linarith /-- The ONE genuine smooth scalar anisotropy attached to an infinite stream. -/ def scalar (s : ℕ → Fin n → ℝ) (qstar : ℝ) (j0 : ℕ) : ℝ → ℝ := Pulses.profile (fun j => unitPacketScalar (s j)) qstar j0 lemma scalar_smooth (s : ℕ → Fin n → ℝ) (qstar : ℝ) (j0 : ℕ) : ContDiff ℝ ∞ (scalar s qstar j0) := Pulses.profile_smooth (fun j => scalarPacket_smooth (s j)) (fun j _ h => scalarPacket_zero_before (s j) h) qstar j0 lemma scalar_initial (s : ℕ → Fin n → ℝ) {qstar t : ℝ} {j0 : ℕ} (ht : t ≤ time j0) : scalar s qstar j0 t=1 := Pulses.profile_initial (fun j _ h => scalarPacket_zero_before (s j) h) ht lemma scalar_pulse (s : ℕ → Fin n → ℝ) {qstar t : ℝ} {j0 j : ℕ} (hj : j0 ≤ j) (hlo : time j ≤ t) (hhi : t ≤ time j+pulse j) : scalar s qstar j0 t=1+(pulse j)⁻¹*unitPacketScalar (s j) ((t-time j)/pulse j) := Pulses.profile_pulse (fun j _ h => scalarPacket_zero_before (s j) h) (fun j _ h => scalarPacket_zero_after (s j) h) hj hlo hhi lemma scalar_leg (s : ℕ → Fin n → ℝ) {qstar t : ℝ} {j0 j : ℕ} (hj : j0 ≤ j) (hlo : time j+pulse j ≤ t) (hhi : t ≤ time (j+1)) : scalar s qstar j0 t=base qstar j0 t := by rw [scalar,Pulses.profile_period (fun j _ h => scalarPacket_zero_before (s j) h) (fun j _ h => scalarPacket_zero_after (s j) h) hj (by linarith [pulse_pos j]) hhi, base,Pulses.profile_period (by simp) (by simp) hj (by linarith [pulse_pos j]) hhi] simp only [Pulses.increment,scalarPacket_zero_after (s j) (t:=((t-time j)/pulse j)) ((le_div_iff₀ (pulse_pos j)).2 (by linarith)),mul_zero] lemma scalar_rest (s : ℕ → Fin n → ℝ) {qstar t : ℝ} {j0 j : ℕ} (hj : j0 ≤ j) (hlo : time j+3*pulse j+dwell j ≤ t) (hhi : t ≤ time (j+1)) : scalar s qstar j0 t=1 := Pulses.profile_rest (fun j _ h => scalarPacket_zero_before (s j) h) (fun j _ h => scalarPacket_zero_after (s j) h) hj hlo hhi /-- Open round collar at the START of every pulse, including the FIRST one. -/ lemma scalar_start_collar (s : ℕ → Fin n → ℝ) (qstar : ℝ) {j0 j : ℕ} (hj : j0 ≤ j) : ∀ᶠ t in 𝓝 (time j),scalar s qstar j0 t=1 := by have hb : ∀ᶠ t in 𝓝 (time j),duration n*((t-time j)/pulse j)<1 := ((continuous_const.mul ((continuous_id.sub continuous_const).div_const _)).continuousAt.eventually_lt continuousAt_const (by simp)) have he : ∀ᶠ t in 𝓝 (time j),t