@@ -32,41 +32,16 @@ noncomputable section
3232
3333/-- The type of extended real numbers `[-∞, ∞]`, constructed as `WithBot (WithTop ℝ)`. -/
3434def EReal := WithBot (WithTop ℝ)
35- deriving Bot, Zero, One, Nontrivial, AddMonoid, PartialOrder, AddCommMonoid
36-
37- instance : ZeroLEOneClass EReal := inferInstanceAs (ZeroLEOneClass (WithBot (WithTop ℝ)))
38- instance : SupSet EReal := inferInstanceAs (SupSet (WithBot (WithTop ℝ)))
39- instance : InfSet EReal := inferInstanceAs (InfSet (WithBot (WithTop ℝ)))
40-
41- instance : CompleteLinearOrder EReal :=
42- inferInstanceAs (CompleteLinearOrder (WithBot (WithTop ℝ)))
43-
44- instance : LinearOrder EReal :=
45- inferInstanceAs (LinearOrder (WithBot (WithTop ℝ)))
46-
47- instance : IsOrderedAddMonoid EReal :=
48- inferInstanceAs (IsOrderedAddMonoid (WithBot (WithTop ℝ)))
49-
50- instance : AddCommMonoidWithOne EReal :=
51- inferInstanceAs (AddCommMonoidWithOne (WithBot (WithTop ℝ)))
52-
53- instance : DenselyOrdered EReal :=
54- inferInstanceAs (DenselyOrdered (WithBot (WithTop ℝ)))
55-
56- instance : CharZero EReal := inferInstanceAs (CharZero (WithBot (WithTop ℝ)))
35+ deriving Nontrivial,
36+ Zero, One, AddMonoid, AddCommMonoid, AddCommMonoidWithOne, CharZero,
37+ Top, Bot, SupSet, InfSet, PartialOrder, LinearOrder, CompleteLinearOrder, DenselyOrdered,
38+ ZeroLEOneClass, IsOrderedAddMonoid
5739
5840/-- The canonical inclusion from reals to ereals. Registered as a coercion. -/
5941@[coe] def Real.toEReal : ℝ → EReal := WithBot.some ∘ WithTop.some
6042
6143namespace EReal
6244
63- -- things unify with `WithBot.decidableLT` later if we don't provide this explicitly.
64- instance decidableLT : DecidableLT EReal :=
65- WithBot.decidableLT
66-
67- -- TODO: Provide explicitly, otherwise it is inferred noncomputably from `CompleteLinearOrder`
68- instance : Top EReal := ⟨WithBot.some ⊤⟩
69-
7045instance : Coe ℝ EReal := ⟨Real.toEReal⟩
7146
7247theorem coe_strictMono : StrictMono Real.toEReal :=
@@ -383,7 +358,6 @@ lemma toReal_pos {x : EReal} (hx : 0 < x) (h'x : x ≠ ⊤) : 0 < x.toReal := by
383358 lift x to ℝ using by aesop
384359 simpa using hx
385360
386- set_option backward.isDefEq.respectTransparency false in
387361lemma toReal_neg {x : EReal} (hx : x < 0 ) (h'x : x ≠ ⊥) : x.toReal < 0 := by
388362 lift x to ℝ using by aesop
389363 simpa using hx
@@ -398,7 +372,6 @@ lemma toReal_neg {x : EReal} (hx : x < 0) (h'x : x ≠ ⊥) : x.toReal < 0 := by
398372 use (x : EReal)
399373 simpa using hx
400374
401- set_option backward.isDefEq.respectTransparency false in
402375@[simp] lemma toReal_image_Ioo_bot_zero : toReal '' (Ioo ⊥ 0 ) = Iio 0 := by
403376 ext x
404377 constructor
@@ -424,7 +397,6 @@ theorem le_coe_toReal {x : EReal} (h : x ≠ ⊤) : x ≤ x.toReal := by
424397 · simp only [h', bot_le]
425398 · simp only [le_refl, coe_toReal h h']
426399
427- set_option backward.isDefEq.respectTransparency false in
428400theorem coe_toReal_le {x : EReal} (h : x ≠ ⊥) : ↑x.toReal ≤ x := by
429401 by_cases h' : x = ⊤
430402 · simp only [h', le_top]
@@ -515,10 +487,9 @@ lemma preimage_coe_Ioi (x : ℝ) : Real.toEReal ⁻¹' Ioi x = Ioi x := by
515487 refine preimage_comp.trans ?_
516488 simp only [WithBot.preimage_coe_Ioi, WithTop.preimage_coe_Ioi]
517489
518- set_option backward.isDefEq.respectTransparency false in
519490@[simp]
520491lemma preimage_coe_Ioi_bot : Real.toEReal ⁻¹' Ioi ⊥ = univ := by
521- change (WithBot.some ∘ WithTop.some) ⁻¹' (Ioi ⊥ ) = _
492+ change (( WithBot.some ∘ WithTop.some) ⁻¹' (Ioi (⊥ : WithBot (WithTop ℝ))) : Set ℝ ) = _
522493 refine preimage_comp.trans ?_
523494 simp only [WithBot.preimage_coe_Ioi_bot, preimage_univ]
524495
@@ -534,10 +505,9 @@ lemma preimage_coe_Iio (y : ℝ) : Real.toEReal ⁻¹' Iio y = Iio y := by
534505 refine preimage_comp.trans ?_
535506 simp only [WithBot.preimage_coe_Iio, WithTop.preimage_coe_Iio]
536507
537- set_option backward.isDefEq.respectTransparency false in
538508@[simp]
539509lemma preimage_coe_Iio_top : Real.toEReal ⁻¹' Iio ⊤ = univ := by
540- change (WithBot.some ∘ WithTop.some) ⁻¹' (Iio (WithBot.some ⊤ )) = _
510+ change (WithBot.some ∘ WithTop.some) ⁻¹' (Iio (WithBot.some (⊤ : WithTop ℝ) )) = _
541511 refine preimage_comp.trans ?_
542512 simp only [WithBot.preimage_coe_Iio, WithTop.preimage_coe_Iio_top]
543513
@@ -741,7 +711,6 @@ lemma toENNReal_of_nonpos {x : EReal} (hx : x ≤ 0) : x.toENNReal = 0 := by
741711lemma toENNReal_bot : (⊥ : EReal).toENNReal = 0 := toENNReal_of_nonpos bot_le
742712lemma toENNReal_zero : (0 : EReal).toENNReal = 0 := toENNReal_of_nonpos le_rfl
743713
744- set_option backward.isDefEq.respectTransparency false in
745714lemma toENNReal_eq_zero_iff {x : EReal} : x.toENNReal = 0 ↔ x ≤ 0 := by
746715 induction x <;> simp [toENNReal]
747716
@@ -786,7 +755,6 @@ lemma toENNReal_eq_toENNReal {x y : EReal} (hx : 0 ≤ x) (hy : 0 ≤ y) :
786755 x.toENNReal = y.toENNReal ↔ x = y := by
787756 induction x <;> induction y <;> simp_all
788757
789- set_option backward.isDefEq.respectTransparency false in
790758lemma toENNReal_le_toENNReal {x y : EReal} (h : x ≤ y) : x.toENNReal ≤ y.toENNReal := by
791759 induction x
792760 · simp
0 commit comments