Analysis I, Section 9.8: Monotonic 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.8.1

theorem MonotoneOn.iff {X: Set } (f: ) : MonotoneOn f X x X, y X, y > x f y f x := X:Set f: MonotoneOn f X x X, y X, y > x f y f x X:Set f: MonotoneOn f X x X, y X, y > x f y f xX:Set f: (∀ x X, y X, y > x f y f x) MonotoneOn f X X:Set f: MonotoneOn f X x X, y X, y > x f y f x X:Set f: a✝³:MonotoneOn f Xx✝:a✝²:x✝ Xy✝:a✝¹:y✝ Xa✝:y✝ > x✝f y✝ f x✝; All goals completed! 🐙 X:Set f: a✝¹: x X, y X, y > x f y f xa✝:x✝¹:a✝ Xb✝:x✝:b✝ Xhxy:a✝ b✝f a✝ f b✝; X:Set f: a✝¹: x X, y X, y > x f y f xa✝:x✝¹:a✝ Xb✝:x✝:b✝ Xhxy✝:a✝ b✝hxy:a✝ < b✝f a✝ f b✝X:Set f: a✝¹: x X, y X, y > x f y f xa✝:x✝¹:a✝ Xx✝:a✝ Xhxy:a✝ a✝f a✝ f a✝ X:Set f: a✝¹: x X, y X, y > x f y f xa✝:x✝¹:a✝ Xb✝:x✝:b✝ Xhxy✝:a✝ b✝hxy:a✝ < b✝f a✝ f b✝ All goals completed! 🐙 All goals completed! 🐙
theorem StrictMono.iff {X: Set } (f: ) : StrictMonoOn f X x X, y X, y > x f y > f x := X:Set f: StrictMonoOn f X x X, y X, y > x f y > f x X:Set f: StrictMonoOn f X x X, y X, y > x f y > f xX:Set f: (∀ x X, y X, y > x f y > f x) StrictMonoOn f X X:Set f: StrictMonoOn f X x X, y X, y > x f y > f xX:Set f: (∀ x X, y X, y > x f y > f x) StrictMonoOn f X X:Set f: a✝: x X, y X, y > x f y > f xStrictMonoOn f X X:Set f: a✝³:StrictMonoOn f Xx✝:a✝²:x✝ Xy✝:a✝¹:y✝ Xa✝:y✝ > x✝f y✝ > f x✝X:Set f: a✝: x X, y X, y > x f y > f xStrictMonoOn f X All goals completed! 🐙theorem AntitoneOn.iff {X: Set } (f: ) : AntitoneOn f X x X, y X, y > x f y f x := X:Set f: AntitoneOn f X x X, y X, y > x f y f x X:Set f: AntitoneOn f X x X, y X, y > x f y f xX:Set f: (∀ x X, y X, y > x f y f x) AntitoneOn f X X:Set f: AntitoneOn f X x X, y X, y > x f y f x X:Set f: a✝³:AntitoneOn f Xx✝:a✝²:x✝ Xy✝:a✝¹:y✝ Xa✝:y✝ > x✝f y✝ f x✝; All goals completed! 🐙 X:Set f: a✝¹: x X, y X, y > x f y f xa✝:x✝¹:a✝ Xb✝:x✝:b✝ Xhxy:a✝ b✝f b✝ f a✝; X:Set f: a✝¹: x X, y X, y > x f y f xa✝:x✝¹:a✝ Xb✝:x✝:b✝ Xhxy✝:a✝ b✝hxy:a✝ < b✝f b✝ f a✝X:Set f: a✝¹: x X, y X, y > x f y f xa✝:x✝¹:a✝ Xx✝:a✝ Xhxy:a✝ a✝f a✝ f a✝ X:Set f: a✝¹: x X, y X, y > x f y f xa✝:x✝¹:a✝ Xb✝:x✝:b✝ Xhxy✝:a✝ b✝hxy:a✝ < b✝f b✝ f a✝ All goals completed! 🐙 All goals completed! 🐙theorem StrictAntitone.iff {X: Set } (f: ) : StrictAntiOn f X x X, y X, y > x f y < f x := X:Set f: StrictAntiOn f X x X, y X, y > x f y < f x X:Set f: StrictAntiOn f X x X, y X, y > x f y < f xX:Set f: (∀ x X, y X, y > x f y < f x) StrictAntiOn f X X:Set f: StrictAntiOn f X x X, y X, y > x f y < f xX:Set f: (∀ x X, y X, y > x f y < f x) StrictAntiOn f X X:Set f: a✝: x X, y X, y > x f y < f xStrictAntiOn f X X:Set f: a✝³:StrictAntiOn f Xx✝:a✝²:x✝ Xy✝:a✝¹:y✝ Xa✝:y✝ > x✝f y✝ < f x✝X:Set f: a✝: x X, y X, y > x f y < f xStrictAntiOn f X All goals completed! 🐙

Examples 9.8.2

declaration uses 'sorry'example : StrictMonoOn (fun x: x^2) (.Ici 0) := StrictMonoOn (fun x => x ^ 2) (Set.Ici 0) All goals completed! 🐙
declaration uses 'sorry'example : StrictAntiOn (fun x: x^2) (.Iic 0) := StrictAntiOn (fun x => x ^ 2) (Set.Iic 0) All goals completed! 🐙declaration uses 'sorry'example : ¬ MonotoneOn (fun x: x^2) .univ := ¬MonotoneOn (fun x => x ^ 2) Set.univ All goals completed! 🐙declaration uses 'sorry'example : ¬ AntitoneOn (fun x: x^2) .univ := ¬AntitoneOn (fun x => x ^ 2) Set.univ All goals completed! 🐙declaration uses 'sorry'example {X:Set } {f: } (hf: StrictMonoOn f X) : MonotoneOn f X := X:Set f: hf:StrictMonoOn f XMonotoneOn f X All goals completed! 🐙declaration uses 'sorry'example (X:Set ) : MonotoneOn (fun x: (6:)) X := X:Set MonotoneOn (fun x => 6) X All goals completed! 🐙declaration uses 'sorry'example (X:Set ) : AntitoneOn (fun x: (6:)) X := X:Set AntitoneOn (fun x => 6) X All goals completed! 🐙
nontrivial_iff.{u_1} {α : Type u_1} : Nontrivial α   x y, x  y
declaration uses 'sorry'example {X:Set } (hX: Nontrivial X) : ¬ StrictMonoOn (fun x: (6:)) X := X:Set hX:Nontrivial X¬StrictMonoOn (fun x => 6) X All goals completed! 🐙declaration uses 'sorry'example (X:Set ) (hX: Nontrivial X) : ¬ StrictAntiOn (fun x: (6:)) X := X:Set hX:Nontrivial X¬StrictAntiOn (fun x => 6) X All goals completed! 🐙declaration uses 'sorry'example : (X:Set ) (f: ), ContinuousOn f X ¬ MonotoneOn f X ¬ AntitoneOn f X := X f, ContinuousOn f X ¬MonotoneOn f X ¬AntitoneOn f X All goals completed! 🐙declaration uses 'sorry'example : (X:Set ) (f: ), MonotoneOn f X ¬ ContinuousOn f X := X f, MonotoneOn f X ¬ContinuousOn f X All goals completed! 🐙

Proposition 9.8.3 / Exercise 9.8.4

theorem declaration uses 'sorry'MonotoneOn.exist_inverse {a b:} (h: a < b) (f: ) (hcont: ContinuousOn f (.Icc a b)) (hmono: StrictMonoOn f (.Icc a b)) : f '' (.Icc a b) = .Icc (f a) (f b) finv: , ContinuousOn finv (.Icc (f a) (f b)) StrictMonoOn finv (.Icc (f a) (f b)) finv '' (.Icc (f a) (f b)) = .Icc a b ( x Set.Icc a b, finv (f x) = x) y Set.Icc (f a) (f b), f (finv y) = y := a:b:h:a < bf: hcont:ContinuousOn f (Set.Icc a b)hmono:StrictMonoOn f (Set.Icc a b)f '' Set.Icc a b = Set.Icc (f a) (f b) finv, ContinuousOn finv (Set.Icc (f a) (f b)) StrictMonoOn finv (Set.Icc (f a) (f b)) finv '' Set.Icc (f a) (f b) = Set.Icc a b (∀ x Set.Icc a b, finv (f x) = x) y Set.Icc (f a) (f b), f (finv y) = y All goals completed! 🐙

Example 9.8.4

example {R :} (hR: R > 0) {n:} (hn: n > 0) : g : , x Set.Icc 0 (R^n), (g x)^n = x := R:hR:R > 0n:hn:n > 0 g, x Set.Icc 0 (R ^ n), g x ^ n = x R:hR:R > 0n:hn:n > 0f: := fun x => x ^ _fvar.7026 g, x Set.Icc 0 (R ^ n), g x ^ n = x have hcont : ContinuousOn f (.Icc 0 R) := R:hR:R > 0n:hn:n > 0 g, x Set.Icc 0 (R ^ n), g x ^ n = x All goals completed! 🐙 have hmono : StrictMonoOn f (.Icc 0 R) := R:hR:R > 0n:hn:n > 0 g, x Set.Icc 0 (R ^ n), g x ^ n = x R:hR:R > 0n:hn:n > 0f: := fun x => x ^ _fvar.7026hcont:ContinuousOn _fvar.7081 (Set.Icc 0 _fvar.7024) := ?_mvar.7408a✝:hx:a✝ Set.Icc 0 Rb✝:x✝:b✝ Set.Icc 0 Rhxy:a✝ < b✝f a✝ < f b✝; R:n:f: := fun x => x ^ _fvar.7026a✝:b✝:hR:0 < Rhn:0 < nhcont:ContinuousOn (fun x => x ^ n) (Set.Icc 0 R)hx:0 a✝ a✝ Rx✝:0 b✝ b✝ Rhxy:a✝ < b✝a✝ ^ n < b✝ ^ n R:n:f: := fun x => x ^ _fvar.7026a✝:b✝:hR:0 < Rhn:0 < nhcont:ContinuousOn (fun x => x ^ n) (Set.Icc 0 R)hx:0 a✝ a✝ Rx✝:0 b✝ b✝ Rhxy:a✝ < b✝0 a✝R:n:f: := fun x => x ^ _fvar.7026a✝:b✝:hR:0 < Rhn:0 < nhcont:ContinuousOn (fun x => x ^ n) (Set.Icc 0 R)hx:0 a✝ a✝ Rx✝:0 b✝ b✝ Rhxy:a✝ < b✝n 0 R:n:f: := fun x => x ^ _fvar.7026a✝:b✝:hR:0 < Rhn:0 < nhcont:ContinuousOn (fun x => x ^ n) (Set.Icc 0 R)hx:0 a✝ a✝ Rx✝:0 b✝ b✝ Rhxy:a✝ < b✝0 a✝R:n:f: := fun x => x ^ _fvar.7026a✝:b✝:hR:0 < Rhn:0 < nhcont:ContinuousOn (fun x => x ^ n) (Set.Icc 0 R)hx:0 a✝ a✝ Rx✝:0 b✝ b✝ Rhxy:a✝ < b✝n 0 All goals completed! 🐙 obtain g, _, _, _, _, hg := (MonotoneOn.exist_inverse (R:hR:R > 0n:hn:n > 0f: := fun x => x ^ _fvar.7026hcont:ContinuousOn _fvar.7081 (Set.Icc 0 _fvar.7024) := ContinuousOn.pow (continuousOn_id' (Set.Icc 0 _fvar.7024)) _fvar.7026hmono:StrictMonoOn _fvar.7081 (Set.Icc 0 _fvar.7024) := fun a hx b x hxy => id (pow_lt_pow_left₀ hxy (Chapter9._example._proof_1 _fvar.7024 _fvar.7026 a b (Eq.mp gt_iff_lt._simp_1 _fvar.7027) (id _fvar.7409) (Eq.mp Set.mem_Icc._simp_1 hx) (Eq.mp Set.mem_Icc._simp_1 x) hxy) (Chapter9._example._proof_2 _fvar.7024 _fvar.7026 a b (Eq.mp gt_iff_lt._simp_1 _fvar.7027) (id _fvar.7409) (Eq.mp Set.mem_Icc._simp_1 hx) (Eq.mp Set.mem_Icc._simp_1 x) hxy))0 < R All goals completed! 🐙) f hcont hmono).2 R:hR:R > 0n:hn:n > 0f: := fun x => x ^ _fvar.7026hcont:ContinuousOn _fvar.7081 (Set.Icc 0 _fvar.7024) := ?_mvar.7408hmono:StrictMonoOn _fvar.7081 (Set.Icc 0 _fvar.7024) := ?_mvar.7883g: left✝³:ContinuousOn g (Set.Icc (f 0) (f R))left✝²:StrictMonoOn g (Set.Icc (f 0) (f R))left✝¹:g '' Set.Icc (f 0) (f R) = Set.Icc 0 Rleft✝: x Set.Icc 0 R, g (f x) = xhg: y Set.Icc 0 (R ^ n), g y ^ n = y g, x Set.Icc 0 (R ^ n), g x ^ n = x; All goals completed! 🐙

Exercise 9.8.1

theorem declaration uses 'sorry'IsMaxOn.of_monotone_on_compact {a b:} (h:a < b) {f: } (hf: MonotoneOn f (.Icc a b)) : xmax Set.Icc a b, IsMaxOn f (.Icc a b) xmax := a:b:h:a < bf: hf:MonotoneOn f (Set.Icc a b) xmax Set.Icc a b, IsMaxOn f (Set.Icc a b) xmax All goals completed! 🐙
theorem declaration uses 'sorry'IsMaxOn.of_strictmono_on_compact {a b:} (h:a < b) {f: } (hf: StrictMonoOn f (.Icc a b)) : xmax Set.Icc a b, IsMaxOn f (.Icc a b) xmax := a:b:h:a < bf: hf:StrictMonoOn f (Set.Icc a b) xmax Set.Icc a b, IsMaxOn f (Set.Icc a b) xmax All goals completed! 🐙theorem declaration uses 'sorry'IsMaxOn.of_antitone_on_compact {a b:} (h:a < b) {f: } (hf: AntitoneOn f (.Icc a b)) : xmax Set.Icc a b, IsMaxOn f (.Icc a b) xmax := a:b:h:a < bf: hf:AntitoneOn f (Set.Icc a b) xmax Set.Icc a b, IsMaxOn f (Set.Icc a b) xmax All goals completed! 🐙theorem declaration uses 'sorry'IsMaxOn.of_strictantitone_on_compact {a b:} (h:a < b) {f: } (hf: StrictAntiOn f (.Icc a b)) : xmax Set.Icc a b, IsMaxOn f (.Icc a b) xmax := a:b:h:a < bf: hf:StrictAntiOn f (Set.Icc a b) xmax Set.Icc a b, IsMaxOn f (Set.Icc a b) xmax All goals completed! 🐙theorem declaration uses 'sorry'BddOn.of_monotone {a b:} {f: } (hf: MonotoneOn f (.Icc a b)) : BddOn f (.Icc a b) := a:b:f: hf:MonotoneOn f (Set.Icc a b)BddOn f (Set.Icc a b) All goals completed! 🐙theorem declaration uses 'sorry'BddOn.of_antitone {a b:} {f: } (hf: AntitoneOn f (.Icc a b)) : BddOn f (.Icc a b) := a:b:f: hf:AntitoneOn f (Set.Icc a b)BddOn f (Set.Icc a b) All goals completed! 🐙

Exercise 9.8.2

theorem declaration uses 'sorry'no_strictmono_intermediate_value : (a b:) (hab: a < b) (f: ) (hf: StrictMonoOn f (.Icc a b)), ¬ y, y Set.Icc (f a) (f b) y Set.Icc (f a) (f b) := a b, (_ : a < b), f, (_ : StrictMonoOn f (Set.Icc a b)), ¬ y, y Set.Icc (f a) (f b) y Set.Icc (f a) (f b) All goals completed! 🐙
theorem declaration uses 'sorry'no_monotone_intermediate_value : (a b:) (hab: a < b) (f: ) (hf: MonotoneOn f (.Icc a b)), ¬ y, y Set.Icc (f a) (f b) y Set.Icc (f a) (f b) := a b, (_ : a < b), f, (_ : MonotoneOn f (Set.Icc a b)), ¬ y, y Set.Icc (f a) (f b) y Set.Icc (f a) (f b) All goals completed! 🐙theorem declaration uses 'sorry'no_strictanti_intermediate_value : (a b:) (hab: a < b) (f: ) (hf: StrictAntiOn f (.Icc a b)), ¬ y, y Set.Icc (f a) (f b) y Set.Icc (f a) (f b) := a b, (_ : a < b), f, (_ : StrictAntiOn f (Set.Icc a b)), ¬ y, y Set.Icc (f a) (f b) y Set.Icc (f a) (f b) All goals completed! 🐙theorem declaration uses 'sorry'no_antitone_intermediate_value : (a b:) (hab: a < b) (f: ) (hf: AntitoneOn f (.Icc a b)), ¬ y, y Set.Icc (f a) (f b) y Set.Icc (f a) (f b) := a b, (_ : a < b), f, (_ : AntitoneOn f (Set.Icc a b)), ¬ y, y Set.Icc (f a) (f b) y Set.Icc (f a) (f b) All goals completed! 🐙

Exercise 9.8.3

theorem declaration uses 'sorry'mono_of_continuous_inj {a b:} (h: a < b) {f: } (hf: ContinuousOn f (.Icc a b)) (hinj: Function.Injective (fun x: Set.Icc a b f x )) : StrictMonoOn f (.Icc a b) StrictAntiOn f (.Icc a b) := a:b:h:a < bf: hf:ContinuousOn f (Set.Icc a b)hinj:Function.Injective fun x => f xStrictMonoOn f (Set.Icc a b) StrictAntiOn f (Set.Icc a b) All goals completed! 🐙

Exercise 9.8.4

def declaration uses 'sorry'MonotoneOn.exist_inverse_without_continuity {a b:} (h: a < b) {f: } (hmono: StrictMonoOn f (.Icc a b)) : Decidable (f '' (.Icc a b) = .Icc (f a) (f b) finv: , ContinuousOn finv (.Icc (f a) (f b)) StrictMonoOn finv (.Icc (f a) (f b)) finv '' (.Icc (f a) (f b)) = .Icc a b ( x Set.Icc a b, finv (f x) = x) y Set.Icc (f a) (f b), f (finv y) = y ) := a:b:h:a < bf: hmono:StrictMonoOn f (Set.Icc a b)Decidable (f '' Set.Icc a b = Set.Icc (f a) (f b) finv, ContinuousOn finv (Set.Icc (f a) (f b)) StrictMonoOn finv (Set.Icc (f a) (f b)) finv '' Set.Icc (f a) (f b) = Set.Icc a b (∀ x Set.Icc a b, finv (f x) = x) y Set.Icc (f a) (f b), f (finv y) = y) -- the first line of this construction should be either `apply isTrue` or `apply isFalse`. All goals completed! 🐙

Exercise 9.8.4

def declaration uses 'sorry'MonotoneOn.exist_inverse_without_strictmono {a b:} (h: a < b) (f: ) (hcont: ContinuousOn f (.Icc a b)) (hmono: MonotoneOn f (.Icc a b)) : Decidable (f '' (.Icc a b) = .Icc (f a) (f b) finv: , ContinuousOn finv (.Icc (f a) (f b)) StrictMonoOn finv (.Icc (f a) (f b)) finv '' (.Icc (f a) (f b)) = .Icc a b ( x Set.Icc a b, finv (f x) = x) y Set.Icc (f a) (f b), f (finv y) = y ) := a:b:h:a < bf: hcont:ContinuousOn f (Set.Icc a b)hmono:MonotoneOn f (Set.Icc a b)Decidable (f '' Set.Icc a b = Set.Icc (f a) (f b) finv, ContinuousOn finv (Set.Icc (f a) (f b)) StrictMonoOn finv (Set.Icc (f a) (f b)) finv '' Set.Icc (f a) (f b) = Set.Icc a b (∀ x Set.Icc a b, finv (f x) = x) y Set.Icc (f a) (f b), f (finv y) = y) -- the first line of this construction should be either `apply isTrue` or `apply isFalse`. All goals completed! 🐙
/- Exercise 9.8.4: state and prove an analogue of `MonotoneOne.exist_inverse` for `Antitone` functions. -/ -- theorem AntitoneOn.exist_inverse {a b:ℝ} (h: a < b) (f: ℝ → ℝ) (hcont: ContinuousOn f (.Icc a b)) (hmono: StrictAntiOn f (.Icc a b)) : sorry := by sorry

An equivalence between the natural numbers and the rationals.

noncomputable abbrev q_9_8_5 : := nonempty_equiv_of_countable.some
noncomputable abbrev g_9_8_5 : := fun q (2:)^(-q_9_8_5.symm q:)noncomputable abbrev f_9_8_5 : := fun x ∑' r : {r: // (r:) < x}, g_9_8_5 r

Exercise 9.8.5(a)

theorem declaration uses 'sorry'StrictMonoOn.of_f_9_8_5 : StrictMonoOn f_9_8_5 .univ := StrictMonoOn f_9_8_5 Set.univ All goals completed! 🐙

Exercise 9.8.5(b)

theorem declaration uses 'sorry'ContinuousAt.of_f_9_8_5' (r:) : ¬ ContinuousAt f_9_8_5 r := r:¬ContinuousAt f_9_8_5 r All goals completed! 🐙

Exercise 9.8.5(c)

theorem declaration uses 'sorry'ContinuousAt.of_f_9_8_5 {x:} (hx: ¬ r:, x = r) : ContinuousAt f_9_8_5 x := x:hx:¬ r, x = rContinuousAt f_9_8_5 x All goals completed! 🐙
end Chapter9