Analysis I, Section 9.4: Continuous functions

I have attempted to make the translation as faithful a paraphrasing as possible of the original text. When there is a choice between a more idiomatic Lean solution and a more faithful translation, I have generally chosen the latter. In particular, there will be places where the Lean code could be "golfed" to be more elegant and idiomatic, but I have consciously avoided doing so.

Main constructions and results of this section:

namespace Chapter9

Definition 9.4.1. Here we use the Mathlib definition of continuity. The hypothesis Unknown identifier `x`sorry sorry : Propx Unknown identifier `X`X is not needed!

theorem ContinuousWithinAt.iff (X:Set ) (f: ) (x₀:) : ContinuousWithinAt f X x₀ Convergesto X f (f x₀) x₀ := X:Set f: x₀:ContinuousWithinAt f X x₀ Convergesto X f (f x₀) x₀ All goals completed! 🐙
ContinuousOn.eq_1.{u_1, u_2} {X : Type u_1} {Y : Type u_2} [TopologicalSpace X] [TopologicalSpace Y] (f : X  Y)
  (s : Set X) : ContinuousOn f s =  x  s, ContinuousWithinAt f s x
continuous_iff_continuousOn_univ.{u_1, u_2} {α : Type u_1} {β : Type u_2} [TopologicalSpace α] [TopologicalSpace β]
  {f : α  β} : ContinuousOn f Set.univ  Continuous f
continuousWithinAt_univ.{u_1, u_2} {α : Type u_1} {β : Type u_2} [TopologicalSpace α] [TopologicalSpace β] (f : α  β)
  (x : α) : ContinuousWithinAt f Set.univ x  ContinuousAt f x

Example 9.4.2 -

declaration uses 'sorry'example (c x₀:) : ContinuousWithinAt (fun x c) .univ x₀ := c:x₀:ContinuousWithinAt (fun x => c) Set.univ x₀ All goals completed! 🐙
declaration uses 'sorry'example (c x₀:) : ContinuousAt (fun x c) x₀ := c:x₀:ContinuousAt (fun x => c) x₀ All goals completed! 🐙declaration uses 'sorry'example (c:) : ContinuousOn (fun x: c) .univ := c:ContinuousOn (fun x => c) Set.univ All goals completed! 🐙declaration uses 'sorry'example (c:) : Continuous (fun x: c) := c:Continuous fun x => c All goals completed! 🐙

Example 9.4.3 -

declaration uses 'sorry'example : Continuous (fun x: x) := Continuous fun x => x All goals completed! 🐙

Example 9.4.4 -

declaration uses 'sorry'example {x₀:} (h: x₀ 0) : ContinuousAt Real.sign x₀ := x₀:h:x₀ 0ContinuousAt Real.sign x₀ All goals completed! 🐙
declaration uses 'sorry'example :¬ ContinuousAt Real.sign 0 := ¬ContinuousAt Real.sign 0 All goals completed! 🐙

Example 9.4.5 -

declaration uses 'sorry'example (x₀:) : ¬ ContinuousAt f_9_3_21 x₀ := x₀:¬ContinuousAt f_9_3_21 x₀ All goals completed! 🐙

Example 9.4.6 -

noncomputable abbrev f_9_4_6 (x:) : := if x 0 then 1 else 0
declaration uses 'sorry'example {x₀:} (h: x₀ 0) : ContinuousAt f_9_4_6 x₀ := x₀:h:x₀ 0ContinuousAt f_9_4_6 x₀ All goals completed! 🐙declaration uses 'sorry'example : ¬ ContinuousAt f_9_4_6 0 := ¬ContinuousAt f_9_4_6 0 All goals completed! 🐙declaration uses 'sorry'example : ContinuousWithinAt f_9_4_6 (.Ici 0) 0 := ContinuousWithinAt f_9_4_6 (Set.Ici 0) 0 All goals completed! 🐙

Proposition 9.4.7 / Exercise 9.4.1. It is possible that the hypothesis Unknown identifier `x₀`sorry sorry : Propx₀ Unknown identifier `X`X is unnecessary.

theorem declaration uses 'sorry'ContinuousWithinAt.tfae (X:Set ) (f: ) {x₀:} (h : x₀ X) : [ ContinuousWithinAt f X x₀, a: , ( n, a n X) Filter.atTop.Tendsto a (nhds x₀) Filter.atTop.Tendsto (fun n f (a n)) (nhds (f x₀)), ε > 0, δ > 0, x X, |x-x₀| < δ |f x - f x₀| < ε ].TFAE := X:Set f: x₀:h:x₀ X[ContinuousWithinAt f X x₀, (a : ), (∀ (n : ), a n X) Filter.Tendsto a Filter.atTop (nhds x₀) Filter.Tendsto (fun n => f (a n)) Filter.atTop (nhds (f x₀)), ε > 0, δ > 0, x X, |x - x₀| < δ |f x - f x₀| < ε].TFAE All goals completed! 🐙

Remark 9.4.8 -

theorem _root_.Filter.Tendsto.comp_of_continuous {X:Set } {f: } {x₀:} (h : x₀ X) (h_cont: ContinuousWithinAt f X x₀) {a: } (ha: n, a n X) (hconv: Filter.atTop.Tendsto a (nhds x₀)): Filter.atTop.Tendsto (fun n f (a n)) (nhds (f x₀)) := X:Set f: x₀:h:x₀ Xh_cont:ContinuousWithinAt f X x₀a: ha: (n : ), a n Xhconv:Filter.Tendsto a Filter.atTop (nhds x₀)Filter.Tendsto (fun n => f (a n)) Filter.atTop (nhds (f x₀)) X:Set f: x₀:h:x₀ Xh_cont:ContinuousWithinAt f X x₀a: ha: (n : ), a n Xhconv:Filter.Tendsto a Filter.atTop (nhds x₀)this:?_mvar.4281 := List.TFAE.out (ContinuousWithinAt.tfae _fvar.4270 _fvar.4271 _fvar.4273) 0 1 ?_mvar.4326 ?_mvar.4327Filter.Tendsto (fun n => f (a n)) Filter.atTop (nhds (f x₀)) All goals completed! 🐙
/- Proposition 9.4.9 -/ theorem ContinuousWithinAt.add {X:Set } (f g: ) {x₀:} (h : x₀ X) (hf: ContinuousWithinAt f X x₀) (hg: ContinuousWithinAt g X x₀) : ContinuousWithinAt (f + g) X x₀ := X:Set f: g: x₀:h:x₀ Xhf:ContinuousWithinAt f X x₀hg:ContinuousWithinAt g X x₀ContinuousWithinAt (f + g) X x₀ X:Set f: g: x₀:h:x₀ Xhf:Convergesto X f (f x₀) x₀hg:Convergesto X g (g x₀) x₀Convergesto X (f + g) ((f + g) x₀) x₀; All goals completed! 🐙theorem ContinuousWithinAt.sub {X:Set } (f g: ) {x₀:} (h : x₀ X) (hf: ContinuousWithinAt f X x₀) (hg: ContinuousWithinAt g X x₀) : ContinuousWithinAt (f - g) X x₀ := X:Set f: g: x₀:h:x₀ Xhf:ContinuousWithinAt f X x₀hg:ContinuousWithinAt g X x₀ContinuousWithinAt (f - g) X x₀ X:Set f: g: x₀:h:x₀ Xhf:Convergesto X f (f x₀) x₀hg:Convergesto X g (g x₀) x₀Convergesto X (f - g) ((f - g) x₀) x₀; All goals completed! 🐙theorem ContinuousWithinAt.max {X:Set } (f g: ) {x₀:} (h : x₀ X) (hf: ContinuousWithinAt f X x₀) (hg: ContinuousWithinAt g X x₀) : ContinuousWithinAt (max f g) X x₀ := X:Set f: g: x₀:h:x₀ Xhf:ContinuousWithinAt f X x₀hg:ContinuousWithinAt g X x₀ContinuousWithinAt (f g) X x₀ X:Set f: g: x₀:h:x₀ Xhf:Convergesto X f (f x₀) x₀hg:Convergesto X g (g x₀) x₀Convergesto X (f g) (Max.max f g x₀) x₀; All goals completed! 🐙theorem ContinuousWithinAt.min {X:Set } (f g: ) {x₀:} (h : x₀ X) (hf: ContinuousWithinAt f X x₀) (hg: ContinuousWithinAt g X x₀) : ContinuousWithinAt (min f g) X x₀ := X:Set f: g: x₀:h:x₀ Xhf:ContinuousWithinAt f X x₀hg:ContinuousWithinAt g X x₀ContinuousWithinAt (f g) X x₀ X:Set f: g: x₀:h:x₀ Xhf:Convergesto X f (f x₀) x₀hg:Convergesto X g (g x₀) x₀Convergesto X (f g) (Min.min f g x₀) x₀; All goals completed! 🐙theorem ContinuousWithinAt.mul' {X:Set } (f g: ) {x₀:} (h : x₀ X) (hf: ContinuousWithinAt f X x₀) (hg: ContinuousWithinAt g X x₀) : ContinuousWithinAt (f * g) X x₀ := X:Set f: g: x₀:h:x₀ Xhf:ContinuousWithinAt f X x₀hg:ContinuousWithinAt g X x₀ContinuousWithinAt (f * g) X x₀ X:Set f: g: x₀:h:x₀ Xhf:Convergesto X f (f x₀) x₀hg:Convergesto X g (g x₀) x₀Convergesto X (f * g) ((f * g) x₀) x₀; All goals completed! 🐙theorem ContinuousWithinAt.div' {X:Set } (f g: ) {x₀:} (h : x₀ X) (hM: g x₀ 0) (hf: ContinuousWithinAt f X x₀) (hg: ContinuousWithinAt g X x₀) : ContinuousWithinAt (f / g) X x₀ := X:Set f: g: x₀:h:x₀ XhM:g x₀ 0hf:ContinuousWithinAt f X x₀hg:ContinuousWithinAt g X x₀ContinuousWithinAt (f / g) X x₀ X:Set f: g: x₀:h:x₀ XhM:g x₀ 0hf:Convergesto X f (f x₀) x₀hg:Convergesto X g (g x₀) x₀Convergesto X (f / g) ((f / g) x₀) x₀; All goals completed! 🐙

Proposition 9.4.10 / Exercise 9.4.3

theorem declaration uses 'sorry'Continuous.exp {a:} (ha: a>0) : Continuous (fun x: a ^ x) := a:ha:a > 0Continuous fun x => a ^ x All goals completed! 🐙

Proposition 9.4.11 / Exercise 9.4.4

theorem declaration uses 'sorry'Continuous.exp' (p:) : ContinuousOn (fun x: x ^ p) (.Ioi 0) := p:ContinuousOn (fun x => x ^ p) (Set.Ioi 0) All goals completed! 🐙

Proposition 9.4.12

theorem declaration uses 'sorry'Continuous.abs : Continuous (fun x: |x|) := Continuous fun x => |x| All goals completed! 🐙 -- TODO

Proposition 9.4.13 / Exercise 9.4.5

theorem declaration uses 'sorry'ContinuousWithinAt.comp {X Y: Set } {f g: } (hf: x X, f x Y) {x₀:} (hx₀: x X) (hf_cont: ContinuousWithinAt f X x₀) (hg_cont: ContinuousWithinAt g Y (f x₀)): ContinuousWithinAt (g f) X x₀ := x:X:Set Y:Set f: g: hf: x X, f x Yx₀:hx₀:x Xhf_cont:ContinuousWithinAt f X x₀hg_cont:ContinuousWithinAt g Y (f x₀)ContinuousWithinAt (g f) X x₀ All goals completed! 🐙

Example 9.4.14

declaration uses 'sorry'example : Continuous (fun x: 3*x + 1) := Continuous fun x => 3 * x + 1 All goals completed! 🐙
declaration uses 'sorry'example : Continuous (fun x: (5:)^x) := Continuous fun x => 5 ^ x All goals completed! 🐙declaration uses 'sorry'example : Continuous (fun x: (5:)^(3*x+1)) := Continuous fun x => 5 ^ (3 * x + 1) All goals completed! 🐙declaration uses 'sorry'example : Continuous (fun x: |x^2-8*x+8|^(Real.sqrt 2) / (x^2 + 1)) := Continuous fun x => |x ^ 2 - 8 * x + 8| ^ 2 / (x ^ 2 + 1) All goals completed! 🐙

Exercise 9.4.6

theorem declaration uses 'sorry'ContinuousOn.restrict {X Y:Set } {f: } (hY: Y X) (hf: ContinuousOn f X) : ContinuousOn f Y := X:Set Y:Set f: hY:Y Xhf:ContinuousOn f XContinuousOn f Y All goals completed! 🐙

Exercise 9.4.7

theorem declaration uses 'sorry'Continuous.polynomial {n:} (c: Fin n ) : Continuous (fun x: i, c i * x ^ (i:)) := n:c:Fin n Continuous fun x => i, c i * x ^ i All goals completed! 🐙