import OAI.MathematicalPhysics.Transonic.Exterior.Continuation namespace OAI section noncomputable section namespace SepticProfile.AxisBarriers def D (sigma z u : ℝ) : ℝ := z*(1-sigma*z^2)*(1-u^2) def N (kappa z u : ℝ) : ℝ := (1-(3/5:ℝ)*u^2)*(kappa*z*(1-u^2)+3*(z-u)) def lower (z : ℝ) : ℝ := (749/1000)*z def polyDen (x : ℝ) : ℝ := 1-(41/200)*x-(347/5000)*x^2 def upper (z : ℝ) : ℝ := (3/4)*z/polyDen (z^2) def upperDeriv (z : ℝ) : ℝ := (3/4)*(1+(41/200)*z^2+(1041/5000)*z^4)/(polyDen (z^2))^2 def residualPoly (x : ℝ) : ℝ := 9/1000+(220413/1600000)*x-(23123019/64000000)*x^2+ (245617149/1280000000)*x^3+(1242882171/32000000000)*x^4- (95591862237/20000000000000)*x^5-(784539168171/500000000000000)*x^6- (43494981843/625000000000000)*x^7 lemma radius_bounds {z : ℝ} (hz : z ∈ Set.Icc 0 (9/10)) : 0≤z^2 ∧ z^2≤81/100 ∧ (z^2)^2≤6561/10000 := by have h1 : 0≤z*(9/10-z) := mul_nonneg hz.1 (sub_nonneg.mpr hz.2) have h2 : z^2≤81/100 := by nlinarith [hz.2] exact ⟨sq_nonneg z,h2,by nlinarith [mul_nonneg (sq_nonneg z) (sub_nonneg.mpr h2)]⟩ lemma polyDen_pos {z : ℝ} (hz : z ∈ Set.Icc 0 (9/10)) : 78/100 < polyDen (z^2) := by have h := radius_bounds hz dsimp [polyDen] nlinarith [h.2.1,h.2.2] lemma barriers_in_unit {z : ℝ} (hz : z ∈ Set.Icc 0 (9/10)) : 0≤lower z ∧ lower z polyDen (z^2)) (-(41/100)*z-(347/1250)*z^3) z := by convert (((hasDerivAt_const z (1:ℝ)).sub (((hasDerivAt_id z).pow 2).const_mul (41/200))).sub ((((hasDerivAt_id z).pow 2).pow 2).const_mul (347/5000))) using 1 <;> first | rfl | (dsimp [polyDen]; ring) convert (((hasDerivAt_id z).const_mul (3/4)).div hg hd) using 1 <;> first | rfl | (dsimp [upper,upperDeriv,polyDen]; ring) lemma residualPoly_pos {x : ℝ} (hx : x ∈ Set.Icc 0 (81/100)) : 0 N kappa p.1 p.2/D sigma p.1 p.2) (Icc a b ×ˢ Icc 0 (9/10)) := by have hN : ContDiff ℝ 1 (fun p : ℝ×ℝ => N kappa p.1 p.2) := by unfold N; fun_prop have hD : ContDiff ℝ 1 (fun p : ℝ×ℝ => D sigma p.1 p.2) := by unfold D; fun_prop exact hN.contDiffOn.div hD.contDiffOn (fun p hp => ne_of_gt (D_pos hs ⟨lt_of_lt_of_le ha hp.1.1,le_trans hp.1.2 hb⟩ hp.2)) /-- The actual regular normalized source equation can be integrated all the way to any b≤.9 while retaining the two explicit axis barriers. The clamping device is not a replacement equation: the conclusion includes its complete removal. -/ theorem exists_between_barriers {sigma kappa a b u0 : ℝ} (hslo : (991/1000:ℝ) ≤ sigma) (hshi : sigma≤993/1000) (hklo : -(1/500:ℝ)≤kappa) (hkhi : kappa≤0) (ha : 0 N kappa p.1 p.2/D sigma p.1 p.2 obtain ⟨u,hu,huc,hud⟩ := exists_clamped_solution hab (by norm_num : (0:ℝ)≤9/10) (field_contDiffOn hshi ha hb (kappa := kappa)) u0 have ht0 {t : ℝ} (ht : t ∈ Icc a b) : t ∈ Icc 0 (9/10) := ⟨le_trans (le_of_lt ha) ht.1,le_trans ht.2 hb⟩ have htpos {t : ℝ} (ht : t ∈ Icc a b) : t ∈ Ioc 0 (9/10) := ⟨lt_of_lt_of_le ha ht.1,le_trans ht.2 hb⟩ have hlowD (t : ℝ) : HasDerivAt lower (749/1000) t := by convert (hasDerivAt_id t).const_mul (749/1000:ℝ) using 1 <;> first | rfl | simp have hright (t : ℝ) (ht : t ∈ Ico a b) : HasDerivWithinAt u (f (t,clamp 0 (9/10) (u t))) (Ici t) t := by apply (hud t ⟨ht.1,le_of_lt ht.2⟩).mono_of_mem_nhdsWithin exact Filter.mem_of_superset (Icc_mem_nhdsGE ht.2) (Icc_subset_Icc_left ht.1) have hupper : ∀ t ∈ Icc a b, u t≤upper t := by apply image_le_of_deriv_right_lt_deriv_boundary' huc hright (B' := upperDeriv) (by simpa [hu] using hu0.2) (fun t ht => (upper_hasDeriv (ht0 ht)).continuousAt.continuousWithinAt) (fun t ht => (upper_hasDeriv (ht0 ⟨ht.1,le_of_lt ht.2⟩)).hasDerivWithinAt) intro t ht he have htz := ht0 ⟨ht.1,le_of_lt ht.2⟩ have htu : upper t ∈ Icc 0 (9/10) := ⟨(barriers_in_unit htz).2.2.1,le_of_lt (upper_lt_nine_tenths htz)⟩ rw [he,clamp_eq htu] dsimp [f] exact (div_lt_iff₀ (D_pos hshi (htpos ⟨ht.1,le_of_lt ht.2⟩) htu)).mpr (by simpa [mul_comm] using upper_strict_barrier hshi hkhi (htpos ⟨ht.1,le_of_lt ht.2⟩)) have hlower : ∀ t ∈ Icc a b, lower t≤u t := by have hh := image_le_of_deriv_right_lt_deriv_boundary' huc.neg (fun t ht => (hright t ht).neg) (B := fun t => -lower t) (B' := fun _ => -(749/1000:ℝ)) (by change -u a ≤ -lower a; rw [hu]; linarith [hu0.1]) (fun t _ => (hlowD t).neg.continuousAt.continuousWithinAt) (fun t _ => (hlowD t).neg.hasDerivWithinAt) have hh' : ∀ t ∈ Icc a b, -u t≤ -lower t := by apply hh intro t ht he have htz := ht0 ⟨ht.1,le_of_lt ht.2⟩ have htu : lower t ∈ Icc 0 (9/10) := by refine ⟨(barriers_in_unit htz).1,?_⟩ dsimp [lower] linarith [htz.2] have he' : u t=lower t := neg_inj.mp he rw [he',clamp_eq htu] dsimp [f] have hstrict := (lt_div_iff₀ (D_pos hshi (htpos ⟨ht.1,le_of_lt ht.2⟩) htu)).mpr (by simpa [mul_comm] using lower_strict_barrier hslo hklo (htpos ⟨ht.1,le_of_lt ht.2⟩)) linarith intro t ht linarith [hh' t ht] refine ⟨u,hu,huc,fun t ht => ⟨hlower t ht,hupper t ht⟩,?_⟩ intro t ht have htu : u t ∈ Icc 0 (9/10) := ⟨le_trans (barriers_in_unit (ht0 ht)).1 (hlower t ht), le_trans (hupper t ht) (le_of_lt (upper_lt_nine_tenths (ht0 ht)))⟩ simpa only [clamp_eq htu] using hud t ht end SepticProfile.AxisBarriers end end end OAI