roseking's picture
Add lean source and binary files (part 66)
8e4d533 verified
Raw History Blame Contribute Delete
3.41 kB
27
lemma deriv_transition_eq_zero {x : ℝ} (hx : x ∉ Icc (0:ℝ) 1) :
    deriv Real.smoothTransition x = 0 := by
proof · 12 lines
  have hcases : x < 0 ∨ 1 < x := by simpa only [mem_Icc,not_and_or,not_le] using hx
  rcases hcases with hx | hx
  · have heq : Real.smoothTransition =ᶠ[𝓝 x] fun _ => (0:ℝ) := by
      filter_upwards [eventually_lt_nhds hx] with y hy
      exact Real.smoothTransition.zero_of_nonpos hy.le
    rw [heq.deriv_eq]
    simp
  · have heq : Real.smoothTransition =ᶠ[𝓝 x] fun _ => (1:ℝ) := by
      filter_upwards [eventually_gt_nhds hx] with y hy
      exact Real.smoothTransition.one_of_one_le hy.le
    rw [heq.deriv_eq]
    simp
42
lemma tsupport_deriv_transition :
    tsupport (deriv Real.smoothTransition) ⊆ Icc (0:ℝ) 1 := by
proof · 4 lines
  apply closure_minimal _ isClosed_Icc
  intro x hx
  by_contra h
  exact hx (deriv_transition_eq_zero h)
49
lemma exists_derivative_bound : ∃ C : ℝ≥0, (∀ x, ‖deriv Real.smoothTransition x‖ ≤ C) ∧
    (∀ x, ‖deriv (deriv Real.smoothTransition) x‖ ≤ C) := by
proof · 19 lines
  have hd : ContDiff ℝ (1:ℕ) (deriv Real.smoothTransition) :=
    (@Real.smoothTransition.contDiff 2).deriv'
  have hc := hd.continuous
  have hc2 := hd.continuous_deriv (by norm_num)
  obtain ⟨C,hC⟩ := isCompact_Icc.exists_bound_of_continuousOn hc.continuousOn
  obtain ⟨D,hD⟩ := isCompact_Icc.exists_bound_of_continuousOn hc2.continuousOn
  refine ⟨⟨max 0 (max C D),le_max_left _ _⟩,?_,?_⟩
  · intro x
    by_cases hx : x ∈ Icc (0:ℝ) 1
    · exact (hC x hx).trans ((le_max_left C D).trans (le_max_right _ _))
    · rw [deriv_transition_eq_zero hx,norm_zero]
      exact le_max_left _ _
  · intro x
    by_cases hx : x ∈ Icc (0:ℝ) 1
    · exact (hD x hx).trans ((le_max_right C D).trans (le_max_right _ _))
    · have hz : deriv (deriv Real.smoothTransition) x = 0 := by
        exact deriv_of_notMem_tsupport (fun h => hx (tsupport_deriv_transition h))
      rw [hz,norm_zero]
      exact le_max_left _ _
71
lemma exists_lipschitz_transition : ∃ C : ℝ≥0, LipschitzWith C Real.smoothTransition ∧
    LipschitzWith C (deriv Real.smoothTransition) ∧
    ∀ x, |deriv Real.smoothTransition x| ≤ C := by
proof · 7 lines
  obtain ⟨C,hC,hD⟩ := exists_derivative_bound
  refine ⟨C,?_,?_,?_⟩
  · apply lipschitzWith_of_nnnorm_deriv_le ((@Real.smoothTransition.contDiff 1).differentiable (by norm_num))
    exact fun x => hC x
  · apply lipschitzWith_of_nnnorm_deriv_le ((show ContDiff ℝ (1:ℕ) (deriv Real.smoothTransition) from (@Real.smoothTransition.contDiff 2).deriv').differentiable (by norm_num))
    exact fun x => hD x
  · simpa only [Real.norm_eq_abs] using hC