-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathHyperreal.lean
More file actions
1211 lines (976 loc) · 51.2 KB
/
Hyperreal.lean
File metadata and controls
1211 lines (976 loc) · 51.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/-
Copyright (c) 2019 Abhimanyu Pallavi Sudhir. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Abhimanyu Pallavi Sudhir, Violeta Hernández Palacios
-/
module
public import Mathlib.Algebra.Order.Ring.StandardPart
public import Mathlib.Analysis.SpecificLimits.Basic
public import Mathlib.Order.Filter.FilterProduct
/-!
# Construction of the hyperreal numbers as an ultraproduct of real sequences
We define the `Hyperreal` numbers as quotients of sequences `ℕ → ℝ` by an ultrafilter. These form
a field, and we prove some of their basic properties.
Note that most of the machinery that is usually defined for the specific purpose of non-standard
analysis (infinitesimal and infinite elements, standard parts) has been generalized to other
non-archimedean fields. In particular:
- `ArchimedeanClass` can be used to measure whether an element is infinitesimal (`0 < mk x`) or
infinite (`mk x < 0`).
- `ArchimedeanClass.stdPart` generalizes the standard part function to a general ordered field.
## Todo
Use Łoś's Theorem `FirstOrder.Language.Ultraproduct.sentence_realize` to formalize the transfer
principle on `Hyperreal`.
-/
@[expose] public section
open ArchimedeanClass Filter Germ Topology
noncomputable section
/-- Hyperreal numbers on the ultrafilter extending the cofinite filter. -/
def Hyperreal : Type :=
Germ (hyperfilter ℕ : Filter ℕ) ℝ
deriving Inhabited
namespace Hyperreal
@[inherit_doc] notation "ℝ*" => Hyperreal
instance : Field ℝ* :=
inferInstanceAs (Field (Germ _ _))
instance : LinearOrder ℝ* :=
inferInstanceAs (LinearOrder (Germ _ _))
instance : IsStrictOrderedRing ℝ* :=
inferInstanceAs (IsStrictOrderedRing (Germ _ _))
/-- Natural embedding `ℝ → ℝ*`. -/
@[coe] def ofReal : ℝ → ℝ* := const
instance : CoeTC ℝ ℝ* := ⟨ofReal⟩
@[simp, norm_cast]
theorem coe_eq_coe {x y : ℝ} : (x : ℝ*) = y ↔ x = y :=
Germ.const_inj
theorem coe_ne_coe {x y : ℝ} : (x : ℝ*) ≠ y ↔ x ≠ y :=
coe_eq_coe.not
@[simp, norm_cast]
theorem coe_eq_zero {x : ℝ} : (x : ℝ*) = 0 ↔ x = 0 :=
coe_eq_coe
@[simp, norm_cast]
theorem coe_eq_one {x : ℝ} : (x : ℝ*) = 1 ↔ x = 1 :=
coe_eq_coe
@[norm_cast]
theorem coe_ne_zero {x : ℝ} : (x : ℝ*) ≠ 0 ↔ x ≠ 0 :=
coe_ne_coe
@[norm_cast]
theorem coe_ne_one {x : ℝ} : (x : ℝ*) ≠ 1 ↔ x ≠ 1 :=
coe_ne_coe
@[simp, norm_cast]
theorem coe_one : ↑(1 : ℝ) = (1 : ℝ*) :=
rfl
@[simp, norm_cast]
theorem coe_zero : ↑(0 : ℝ) = (0 : ℝ*) :=
rfl
@[simp, norm_cast]
theorem coe_inv (x : ℝ) : ↑x⁻¹ = (x⁻¹ : ℝ*) :=
rfl
@[simp, norm_cast]
theorem coe_neg (x : ℝ) : ↑(-x) = (-x : ℝ*) :=
rfl
@[simp, norm_cast]
theorem coe_add (x y : ℝ) : ↑(x + y) = (x + y : ℝ*) :=
rfl
@[simp, norm_cast]
theorem coe_ofNat (n : ℕ) [n.AtLeastTwo] :
((ofNat(n) : ℝ) : ℝ*) = OfNat.ofNat n :=
rfl
@[simp, norm_cast]
theorem coe_mul (x y : ℝ) : ↑(x * y) = (x * y : ℝ*) :=
rfl
@[simp, norm_cast]
theorem coe_div (x y : ℝ) : ↑(x / y) = (x / y : ℝ*) :=
rfl
@[simp, norm_cast]
theorem coe_sub (x y : ℝ) : ↑(x - y) = (x - y : ℝ*) :=
rfl
@[simp, norm_cast]
theorem coe_le_coe {x y : ℝ} : (x : ℝ*) ≤ y ↔ x ≤ y :=
Germ.const_le_iff
@[simp, norm_cast]
theorem coe_lt_coe {x y : ℝ} : (x : ℝ*) < y ↔ x < y :=
Germ.const_lt_iff
@[simp, norm_cast]
theorem coe_nonneg {x : ℝ} : 0 ≤ (x : ℝ*) ↔ 0 ≤ x :=
coe_le_coe
@[simp, norm_cast]
theorem coe_pos {x : ℝ} : 0 < (x : ℝ*) ↔ 0 < x :=
coe_lt_coe
@[simp, norm_cast]
theorem coe_abs (x : ℝ) : ((|x| : ℝ) : ℝ*) = |↑x| :=
const_abs x
@[simp, norm_cast]
theorem coe_max (x y : ℝ) : ((max x y : ℝ) : ℝ*) = max ↑x ↑y :=
Germ.const_max _ _
@[simp, norm_cast]
theorem coe_min (x y : ℝ) : ((min x y : ℝ) : ℝ*) = min ↑x ↑y :=
Germ.const_min _ _
/-- The canonical map `ℝ → ℝ*` as an `OrderRingHom`. -/
@[simps]
def coeRingHom : ℝ →+*o ℝ* where
toFun x := x
map_zero' := rfl
map_one' := rfl
map_add' _ _ := rfl
map_mul' _ _ := rfl
monotone' _ _ := coe_le_coe.2
@[simp]
theorem archimedeanClassMk_coe_nonneg (x : ℝ) : 0 ≤ mk (x : ℝ*) :=
mk_map_nonneg_of_archimedean coeRingHom x
@[simp]
theorem archimdeanClassMk_coe {x : ℝ} (hx : x ≠ 0) : mk (x : ℝ*) = 0 :=
mk_map_of_archimedean' coeRingHom hx
@[simp]
theorem stdPart_coe (x : ℝ) : stdPart (x : ℝ*) = x :=
stdPart_map_real coeRingHom x
/-! ### Basic constants -/
/-- Construct a hyperreal number from a sequence of real numbers. -/
def ofSeq (f : ℕ → ℝ) : ℝ* := (↑f : Germ (hyperfilter ℕ : Filter ℕ) ℝ)
theorem ofSeq_surjective : Function.Surjective ofSeq := Quot.exists_rep
theorem ofSeq_lt_ofSeq {f g : ℕ → ℝ} : ofSeq f < ofSeq g ↔ ∀ᶠ n in hyperfilter ℕ, f n < g n :=
Germ.coe_lt
theorem ofSeq_le_ofSeq {f g : ℕ → ℝ} : ofSeq f ≤ ofSeq g ↔ ∀ᶠ n in hyperfilter ℕ, f n ≤ g n :=
Germ.coe_le
/-! #### ω -/
/-- A sample infinite hyperreal ω = ⟦(0, 1, 2, 3, ⋯)⟧. -/
def omega : ℝ* := ofSeq Nat.cast
@[inherit_doc] scoped notation "ω" => Hyperreal.omega
recommended_spelling "omega" for "ω" in [omega, «termω»]
theorem coe_lt_omega (r : ℝ) : r < ω := by
apply ofSeq_lt_ofSeq.2 <| Filter.Eventually.filter_mono Nat.hyperfilter_le_atTop _
obtain ⟨n, hn⟩ := exists_nat_gt r
rw [eventually_atTop]
exact ⟨n, fun m hm ↦ hn.trans_le (mod_cast hm)⟩
theorem omega_pos : 0 < ω :=
coe_lt_omega 0
@[simp]
theorem omega_ne_zero : ω ≠ 0 :=
omega_pos.ne'
@[simp]
theorem abs_omega : |ω| = ω :=
abs_of_pos omega_pos
@[simp]
theorem archimedeanClassMk_omega_neg : mk ω < 0 :=
fun n ↦ by simpa using coe_lt_omega n
@[simp]
theorem stdPart_omega : stdPart ω = 0 := by
rw [stdPart_eq_zero]
exact archimedeanClassMk_omega_neg.ne
/-! #### ε -/
/-- A sample infinitesimal hyperreal ε = ⟦(0, 1, 1/2, 1/3, ⋯)⟧. -/
def epsilon : ℝ* :=
ofSeq fun n => n⁻¹
@[inherit_doc] scoped notation "ε" => Hyperreal.epsilon
recommended_spelling "epsilon" for "ε" in [epsilon, «termε»]
@[simp]
theorem inv_omega : ω⁻¹ = ε :=
rfl
@[simp]
theorem inv_epsilon : ε⁻¹ = ω :=
@inv_inv _ _ ω
@[simp]
theorem epsilon_pos : 0 < ε :=
inv_pos_of_pos omega_pos
@[simp]
theorem epsilon_ne_zero : ε ≠ 0 :=
epsilon_pos.ne'
@[simp]
theorem epsilon_mul_omega : ε * ω = 1 :=
@inv_mul_cancel₀ _ _ ω omega_ne_zero
@[simp]
theorem archimedeanClassMk_epsilon_pos : 0 < mk ε := by
simp [← inv_omega]
/-!
### Some facts about `Tendsto`
-/
@[simp]
theorem tendsto_ofSeq {f : ℕ → ℝ} {lb : Filter ℝ} :
(ofSeq f).Tendsto lb ↔ Tendsto f (hyperfilter ℕ) lb :=
.rfl
theorem stdPart_map {x : ℝ*} {r : ℝ} {f : ℝ → ℝ} (hf : ContinuousAt f r)
(hxr : x.Tendsto (𝓝 r)) : (x.map f).Tendsto (𝓝 (f r)) := by
rcases ofSeq_surjective x with ⟨g, rfl⟩
exact hf.tendsto.comp hxr
theorem stdPart_map₂ {x y : ℝ*} {r s : ℝ} {f : ℝ → ℝ → ℝ}
(hxr : x.Tendsto (𝓝 r)) (hys : y.Tendsto (𝓝 s))
(hf : ContinuousAt (Function.uncurry f) (r, s)) : (x.map₂ f y).Tendsto (𝓝 (f r s)) := by
rcases ofSeq_surjective x with ⟨x, rfl⟩
rcases ofSeq_surjective y with ⟨y, rfl⟩
exact hf.tendsto.comp (hxr.prodMk_nhds hys)
theorem tendsto_iff_forall {x : ℝ*} {r : ℝ} :
x.Tendsto (𝓝 r) ↔ (∀ s < r, s ≤ x) ∧ (∀ s > r, x ≤ s) := by
rcases ofSeq_surjective x with ⟨f, rfl⟩
rw [tendsto_ofSeq, (nhds_basis_Ioo _).tendsto_right_iff]
simp_rw [Set.mem_Ioo, eventually_and, ← ofSeq_lt_ofSeq]
refine ⟨fun H ↦ ⟨fun s hs ↦ ?_, fun s hs ↦ ?_⟩, fun H ⟨s, t⟩ ⟨hs, ht⟩ ↦ ⟨?_, ?_⟩⟩
· obtain ⟨t, ht⟩ := exists_gt r
exact (H ⟨s, t⟩ ⟨hs, ht⟩).1.le
· obtain ⟨t, ht⟩ := exists_lt r
exact (H ⟨t, s⟩ ⟨ht, hs⟩).2.le
· obtain ⟨u, hu, hu'⟩ := exists_between hs
exact (coe_lt_coe.2 hu).trans_le (H.1 _ hu')
· obtain ⟨u, hu, hu'⟩ := exists_between ht
exact (H.2 _ hu).trans_lt (coe_lt_coe.2 hu')
theorem archimedeanClassMk_nonneg_of_tendsto {x : ℝ*} {r : ℝ} (hx : x.Tendsto (𝓝 r)) :
0 ≤ mk x := by
rw [tendsto_iff_forall] at hx
obtain ⟨s, hs⟩ := exists_lt r
obtain ⟨t, ht⟩ := exists_gt r
exact mk_nonneg_of_le_of_le_of_archimedean coeRingHom (hx.1 s hs) (hx.2 t ht)
theorem stdPart_of_tendsto {x : ℝ*} {r : ℝ} (hx : x.Tendsto (𝓝 r)) : stdPart x = r := by
rw [tendsto_iff_forall] at hx
exact stdPart_eq coeRingHom hx.1 hx.2
theorem archimedeanClassMk_pos_of_tendsto {x : ℝ*} (hx : x.Tendsto (𝓝 0)) : 0 < mk x := by
apply (archimedeanClassMk_nonneg_of_tendsto hx).lt_of_ne'
rw [← stdPart_eq_zero, stdPart_of_tendsto hx]
@[simp]
theorem stdPart_epsilon : stdPart ε = 0 :=
stdPart_eq_zero.2 <| archimedeanClassMk_epsilon_pos.ne'
theorem epsilon_lt_of_pos {r : ℝ} : 0 < r → ε < r :=
lt_of_pos_of_archimedean coeRingHom archimedeanClassMk_epsilon_pos
theorem epsilon_lt_of_neg {r : ℝ} : r < 0 → r < ε :=
lt_of_neg_of_archimedean coeRingHom archimedeanClassMk_epsilon_pos
@[deprecated (since := "2026-01-05")]
alias epsilon_lt_pos := epsilon_lt_of_pos
@[deprecated archimedeanClassMk_pos_of_tendsto (since := "2026-01-05")]
theorem lt_of_tendsto_zero_of_pos {f : ℕ → ℝ} (hf : Tendsto f atTop (𝓝 0)) :
∀ {r : ℝ}, 0 < r → ofSeq f < (r : ℝ*) := fun hr ↦
ofSeq_lt_ofSeq.2 <| (hf.eventually <| gt_mem_nhds hr).filter_mono Nat.hyperfilter_le_atTop
set_option linter.deprecated false in
@[deprecated archimedeanClassMk_pos_of_tendsto (since := "2026-01-05")]
theorem neg_lt_of_tendsto_zero_of_pos {f : ℕ → ℝ} (hf : Tendsto f atTop (𝓝 0)) :
∀ {r : ℝ}, 0 < r → (-r : ℝ*) < ofSeq f := fun hr =>
have hg := hf.neg
neg_lt_of_neg_lt (by rw [neg_zero] at hg; exact lt_of_tendsto_zero_of_pos hg hr)
set_option linter.deprecated false in
@[deprecated archimedeanClassMk_pos_of_tendsto (since := "2026-01-05")]
theorem gt_of_tendsto_zero_of_neg {f : ℕ → ℝ} (hf : Tendsto f atTop (𝓝 0)) :
∀ {r : ℝ}, r < 0 → (r : ℝ*) < ofSeq f := fun {r} hr => by
rw [← neg_neg r, coe_neg]; exact neg_lt_of_tendsto_zero_of_pos hf (neg_pos.mpr hr)
theorem lt_of_tendsto_atTop {x : ℝ*} (r : ℝ) (hx : x.Tendsto atTop) : r < x := by
rcases ofSeq_surjective x with ⟨f, rfl⟩
rw [tendsto_ofSeq] at hx
exact ofSeq_lt_ofSeq.2 <| hx.eventually_mem (Ioi_mem_atTop r)
theorem lt_of_tendsto_atBot {x : ℝ*} (r : ℝ) (hx : x.Tendsto atBot) : x < r := by
rcases ofSeq_surjective x with ⟨f, rfl⟩
rw [tendsto_ofSeq] at hx
exact ofSeq_lt_ofSeq.2 <| hx.eventually_mem (Iio_mem_atBot r)
theorem archimedeanClassMk_neg_of_tendsto_atTop {x : ℝ*} (hx : x.Tendsto atTop) : mk x < 0 := by
have : 0 < x := lt_of_tendsto_atTop 0 hx
intro n
simpa [abs_of_pos this] using lt_of_tendsto_atTop n hx
theorem archimedeanClassMk_neg_of_tendsto_atBot {x : ℝ*} (hx : x.Tendsto atBot) : mk x < 0 := by
have : x < 0 := lt_of_tendsto_atBot 0 hx
intro n
simpa [abs_of_neg this, lt_neg] using lt_of_tendsto_atBot (-n) hx
theorem tendsto_atTop_iff {x : ℝ*} : x.Tendsto atTop ↔ 0 < x ∧ mk x < 0 where
mp h := ⟨lt_of_tendsto_atTop 0 h, archimedeanClassMk_neg_of_tendsto_atTop h⟩
mpr h := by
rcases ofSeq_surjective x with ⟨f, rfl⟩
rw [tendsto_ofSeq, tendsto_atTop]
exact fun r ↦ ofSeq_le_ofSeq.1 <|
(lt_of_mk_lt_mk_of_nonneg (h.2.trans_le <| archimedeanClassMk_coe_nonneg r) h.1.le).le
theorem tendsto_atBot_iff {x : ℝ*} : x.Tendsto atBot ↔ x < 0 ∧ mk x < 0 where
mp h := ⟨lt_of_tendsto_atBot 0 h, archimedeanClassMk_neg_of_tendsto_atBot h⟩
mpr h := by
rcases ofSeq_surjective x with ⟨f, rfl⟩
rw [tendsto_ofSeq, tendsto_atBot]
exact fun r ↦ ofSeq_le_ofSeq.1 <|
(lt_of_mk_lt_mk_of_nonpos (h.2.trans_le <| archimedeanClassMk_coe_nonneg r) h.1.le).le
/-- Standard part predicate.
**Do not use.** This is equivalent to the conjunction of `0 ≤ ArchimedeanClass.mk x` and
`ArchimedeanClass.stdPart x = r`. -/
@[deprecated stdPart (since := "2026-01-05")]
def IsSt (x : ℝ*) (r : ℝ) :=
∀ δ : ℝ, 0 < δ → (r - δ : ℝ*) < x ∧ x < r + δ
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem isSt_iff {x r} : IsSt x r ↔ 0 ≤ mk x ∧ stdPart x = r where
mp h := by
refine ⟨?_, stdPart_eq coeRingHom (fun s hs ↦ ?_) (fun s hs ↦ ?_)⟩
· have h := h 1 zero_lt_one
exact mk_nonneg_of_le_of_le_of_archimedean coeRingHom h.1.le h.2.le
· simpa using (h _ (sub_pos_of_lt hs)).1.le
· simpa using (h _ (sub_pos_of_lt hs)).2.le
mpr h := by
obtain ⟨h, rfl⟩ := h
refine fun y hy ↦ ⟨?_, ?_⟩
· apply lt_of_lt_stdPart coeRingHom h; simpa
· apply lt_of_stdPart_lt coeRingHom h; simpa
set_option linter.deprecated false in
open scoped Classical in
/-- Standard part function: like a "round" to ℝ instead of ℤ -/
@[deprecated stdPart (since := "2026-01-05")]
noncomputable def st : ℝ* → ℝ := fun x => if h : ∃ r, IsSt x r then Classical.choose h else 0
set_option linter.deprecated false in
@[deprecated "`st` is deprecated" (since := "2026-01-05")]
theorem st_eq (x : ℝ*) : st x = stdPart x := by
rw [st]
split_ifs with h
· exact (isSt_iff.1 (Classical.choose_spec h)).2.symm
· simp_rw [isSt_iff] at h
push Not at h
rw [eq_comm, stdPart_eq_zero]
apply ne_of_lt
by_contra! hx
exact h _ hx rfl
set_option linter.deprecated false in
/-- A hyperreal number is infinitesimal if its standard part is 0.
**Do not use.** Write `0 < ArchimedeanClass.mk x` instead. -/
@[deprecated ArchimedeanClass.mk (since := "2026-01-05")]
def Infinitesimal (x : ℝ*) :=
IsSt x 0
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem infinitesimal_iff {x : ℝ*} : Infinitesimal x ↔ 0 < mk x := by
rw [Infinitesimal, isSt_iff, stdPart_eq_zero, lt_iff_le_and_ne']
/-- A hyperreal number is positive infinite if it is larger than all real numbers.
**Do not use.** Write `0 < x ∧ ArchimedeanClass.mk x < 0` instead. -/
@[deprecated ArchimedeanClass.mk (since := "2026-01-05")]
def InfinitePos (x : ℝ*) :=
∀ r : ℝ, ↑r < x
set_option linter.deprecated false in
@[deprecated "`InfinitePos` is deprecated" (since := "2026-01-05")]
theorem infinitePos_iff {x : ℝ*} : InfinitePos x ↔ 0 < x ∧ mk x < 0 := by
refine ⟨fun h ↦ ?_, fun ⟨hx, hx'⟩ r ↦ ?_⟩
· have hx : 0 < x := h 0
refine ⟨h 0, fun n ↦ ?_⟩
simpa [abs_of_pos hx] using h n
· exact lt_of_mk_lt_mk_of_nonneg (hx'.trans_le <| mk_map_nonneg_of_archimedean coeRingHom _) hx.le
/-- A hyperreal number is negative infinite if it is smaller than all real numbers.
**Do not use.** Write `x < 0 ∧ ArchimedeanClass.mk x < 0` instead. -/
@[deprecated ArchimedeanClass.mk (since := "2026-01-05")]
def InfiniteNeg (x : ℝ*) :=
∀ r : ℝ, x < r
set_option linter.deprecated false in
@[deprecated "`InfiniteNeg` is deprecated" (since := "2026-01-05")]
theorem infiniteNeg_iff {x : ℝ*} : InfiniteNeg x ↔ x < 0 ∧ mk x < 0 := by
refine ⟨fun h ↦ ?_, fun ⟨hx, hx'⟩ r ↦ ?_⟩
· have hx : x < 0 := h 0
refine ⟨h 0, fun n ↦ ?_⟩
simpa [abs_of_neg hx, lt_neg] using h (-n)
· exact lt_of_mk_lt_mk_of_nonpos (hx'.trans_le <| mk_map_nonneg_of_archimedean coeRingHom _) hx.le
set_option linter.deprecated false in
/-- A hyperreal number is infinite if it is infinite positive or infinite negative.
**Do not use.** Write `ArchimedeanClass.mk x < 0` instead. -/
@[deprecated ArchimedeanClass.mk (since := "2026-01-05")]
def Infinite (x : ℝ*) :=
InfinitePos x ∨ InfiniteNeg x
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infinite_iff {x : ℝ*} : Infinite x ↔ mk x < 0 := by
rw [Infinite, infinitePos_iff, infiniteNeg_iff]
aesop
set_option linter.deprecated false in
@[deprecated tendsto_iff_forall (since := "2026-01-05")]
theorem isSt_ofSeq_iff_tendsto {f : ℕ → ℝ} {r : ℝ} :
IsSt (ofSeq f) r ↔ Tendsto f (hyperfilter ℕ) (𝓝 r) :=
Iff.trans (forall₂_congr fun _ _ ↦ (ofSeq_lt_ofSeq.and ofSeq_lt_ofSeq).trans eventually_and.symm)
(nhds_basis_Ioo_pos _).tendsto_right_iff.symm
set_option linter.deprecated false in
@[deprecated tendsto_iff_forall (since := "2026-01-05")]
theorem isSt_iff_tendsto {x : ℝ*} {r : ℝ} : IsSt x r ↔ x.Tendsto (𝓝 r) := by
rcases ofSeq_surjective x with ⟨f, rfl⟩
exact isSt_ofSeq_iff_tendsto
set_option linter.deprecated false in
@[deprecated stdPart_of_tendsto (since := "2026-01-05")]
theorem isSt_of_tendsto {f : ℕ → ℝ} {r : ℝ} (hf : Tendsto f atTop (𝓝 r)) : IsSt (ofSeq f) r :=
isSt_ofSeq_iff_tendsto.2 <| hf.mono_left Nat.hyperfilter_le_atTop
set_option linter.deprecated false in
@[deprecated "Use `stdPart_monotoneOn` and `MonotoneOn.reflect_lt`" (since := "2026-01-05")]
protected theorem IsSt.lt {x y : ℝ*} {r s : ℝ} (hxr : IsSt x r) (hys : IsSt y s) (hrs : r < s) :
x < y := by
rcases ofSeq_surjective x with ⟨f, rfl⟩
rcases ofSeq_surjective y with ⟨g, rfl⟩
rw [isSt_ofSeq_iff_tendsto] at hxr hys
exact ofSeq_lt_ofSeq.2 <| hxr.eventually_lt hys hrs
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem IsSt.unique {x : ℝ*} {r s : ℝ} (hr : IsSt x r) (hs : IsSt x s) : r = s := by
rcases ofSeq_surjective x with ⟨f, rfl⟩
rw [isSt_ofSeq_iff_tendsto] at hr hs
exact tendsto_nhds_unique hr hs
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem IsSt.st_eq {x : ℝ*} {r : ℝ} (hxr : IsSt x r) : st x = r := by
have h : ∃ r, IsSt x r := ⟨r, hxr⟩
rw [st, dif_pos h]
exact (Classical.choose_spec h).unique hxr
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem IsSt.not_infinite {x : ℝ*} {r : ℝ} (h : IsSt x r) : ¬Infinite x := fun hi ↦
hi.elim (fun hp ↦ lt_asymm (h 1 one_pos).2 (hp (r + 1))) fun hn ↦
lt_asymm (h 1 one_pos).1 (hn (r - 1))
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem not_infinite_of_exists_st {x : ℝ*} : (∃ r : ℝ, IsSt x r) → ¬Infinite x := fun ⟨_r, hr⟩ =>
hr.not_infinite
set_option linter.deprecated false in
@[deprecated stdPart_eq_zero (since := "2026-01-05")]
theorem Infinite.st_eq {x : ℝ*} (hi : Infinite x) : st x = 0 :=
dif_neg fun ⟨_r, hr⟩ ↦ hr.not_infinite hi
set_option linter.deprecated false in
@[deprecated stdPart_eq_sSup (since := "2026-01-05")]
theorem isSt_sSup {x : ℝ*} (hni : ¬Infinite x) : IsSt x (sSup { y : ℝ | (y : ℝ*) < x }) := by
rw [infinite_iff, not_lt] at hni
rw [isSt_iff]
exact ⟨hni, stdPart_eq_sSup coeRingHom x⟩
set_option linter.deprecated false in
@[deprecated stdPart_eq_sSup (since := "2026-01-05")]
theorem exists_st_of_not_infinite {x : ℝ*} (hni : ¬Infinite x) : ∃ r : ℝ, IsSt x r :=
⟨sSup { y : ℝ | (y : ℝ*) < x }, isSt_sSup hni⟩
set_option linter.deprecated false in
@[deprecated stdPart_eq_sSup (since := "2026-01-05")]
theorem st_eq_sSup {x : ℝ*} : st x = sSup { y : ℝ | (y : ℝ*) < x } := by
rw [st_eq]
exact stdPart_eq_sSup coeRingHom x
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem exists_st_iff_not_infinite {x : ℝ*} : (∃ r : ℝ, IsSt x r) ↔ ¬Infinite x :=
⟨not_infinite_of_exists_st, exists_st_of_not_infinite⟩
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem infinite_iff_not_exists_st {x : ℝ*} : Infinite x ↔ ¬∃ r : ℝ, IsSt x r :=
iff_not_comm.mp exists_st_iff_not_infinite
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem IsSt.isSt_st {x : ℝ*} {r : ℝ} (hxr : IsSt x r) : IsSt x (st x) := by
rwa [hxr.st_eq]
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem isSt_st_of_exists_st {x : ℝ*} (hx : ∃ r : ℝ, IsSt x r) : IsSt x (st x) :=
let ⟨_r, hr⟩ := hx; hr.isSt_st
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem isSt_st' {x : ℝ*} (hx : ¬Infinite x) : IsSt x (st x) :=
(isSt_sSup hx).isSt_st
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem isSt_st {x : ℝ*} (hx : st x ≠ 0) : IsSt x (st x) :=
isSt_st' <| mt Infinite.st_eq hx
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem isSt_refl_real (r : ℝ) : IsSt r r := isSt_ofSeq_iff_tendsto.2 tendsto_const_nhds
set_option linter.deprecated false in
@[deprecated stdPart_coe (since := "2026-01-05")]
theorem st_id_real (r : ℝ) : st r = r := (isSt_refl_real r).st_eq
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem eq_of_isSt_real {r s : ℝ} : IsSt r s → r = s :=
(isSt_refl_real r).unique
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem isSt_real_iff_eq {r s : ℝ} : IsSt r s ↔ r = s :=
⟨eq_of_isSt_real, fun hrs => hrs ▸ isSt_refl_real r⟩
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem isSt_symm_real {r s : ℝ} : IsSt r s ↔ IsSt s r := by
rw [isSt_real_iff_eq, isSt_real_iff_eq, eq_comm]
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem isSt_trans_real {r s t : ℝ} : IsSt r s → IsSt s t → IsSt r t := by
rw [isSt_real_iff_eq, isSt_real_iff_eq, isSt_real_iff_eq]; exact Eq.trans
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem isSt_inj_real {r₁ r₂ s : ℝ} (h1 : IsSt r₁ s) (h2 : IsSt r₂ s) : r₁ = r₂ :=
Eq.trans (eq_of_isSt_real h1) (eq_of_isSt_real h2).symm
set_option linter.deprecated false in
@[deprecated "`IsSt` is deprecated" (since := "2026-01-05")]
theorem isSt_iff_abs_sub_lt_delta {x : ℝ*} {r : ℝ} : IsSt x r ↔ ∀ δ : ℝ, 0 < δ → |x - ↑r| < δ := by
simp only [abs_sub_lt_iff, sub_lt_iff_lt_add, IsSt, and_comm, add_comm]
set_option linter.deprecated false in
@[deprecated stdPart_map (since := "2026-01-05")]
theorem IsSt.map {x : ℝ*} {r : ℝ} (hxr : IsSt x r) {f : ℝ → ℝ} (hf : ContinuousAt f r) :
IsSt (x.map f) (f r) := by
rcases ofSeq_surjective x with ⟨g, rfl⟩
exact isSt_ofSeq_iff_tendsto.2 <| hf.tendsto.comp (isSt_ofSeq_iff_tendsto.1 hxr)
set_option linter.deprecated false in
@[deprecated stdPart_map₂ (since := "2026-01-05")]
theorem IsSt.map₂ {x y : ℝ*} {r s : ℝ} (hxr : IsSt x r) (hys : IsSt y s) {f : ℝ → ℝ → ℝ}
(hf : ContinuousAt (Function.uncurry f) (r, s)) : IsSt (x.map₂ f y) (f r s) := by
rcases ofSeq_surjective x with ⟨x, rfl⟩
rcases ofSeq_surjective y with ⟨y, rfl⟩
rw [isSt_ofSeq_iff_tendsto] at hxr hys
exact isSt_ofSeq_iff_tendsto.2 <| hf.tendsto.comp (hxr.prodMk_nhds hys)
set_option linter.deprecated false in
@[deprecated stdPart_add (since := "2026-01-05")]
theorem IsSt.add {x y : ℝ*} {r s : ℝ} (hxr : IsSt x r) (hys : IsSt y s) :
IsSt (x + y) (r + s) := hxr.map₂ hys continuous_add.continuousAt
set_option linter.deprecated false in
@[deprecated stdPart_neg (since := "2026-01-05")]
theorem IsSt.neg {x : ℝ*} {r : ℝ} (hxr : IsSt x r) : IsSt (-x) (-r) :=
hxr.map continuous_neg.continuousAt
set_option linter.deprecated false in
@[deprecated stdPart_sub (since := "2026-01-05")]
theorem IsSt.sub {x y : ℝ*} {r s : ℝ} (hxr : IsSt x r) (hys : IsSt y s) : IsSt (x - y) (r - s) :=
hxr.map₂ hys continuous_sub.continuousAt
set_option linter.deprecated false in
@[deprecated stdPart_monotoneOn (since := "2026-01-05")]
theorem IsSt.le {x y : ℝ*} {r s : ℝ} (hrx : IsSt x r) (hsy : IsSt y s) (hxy : x ≤ y) : r ≤ s :=
not_lt.1 fun h ↦ hxy.not_gt <| hsy.lt hrx h
set_option linter.deprecated false in
@[deprecated stdPart_monotoneOn (since := "2026-01-05")]
theorem st_le_of_le {x y : ℝ*} (hix : ¬Infinite x) (hiy : ¬Infinite y) : x ≤ y → st x ≤ st y :=
(isSt_st' hix).le (isSt_st' hiy)
set_option linter.deprecated false in
@[deprecated stdPart_monotoneOn (since := "2026-01-05")]
theorem lt_of_st_lt {x y : ℝ*} (hix : ¬Infinite x) (hiy : ¬Infinite y) : st x < st y → x < y :=
(isSt_st' hix).lt (isSt_st' hiy)
set_option linter.deprecated false in
@[deprecated "`InfinitePos` is deprecated" (since := "2026-01-05")]
theorem infinitePos_def {x : ℝ*} : InfinitePos x ↔ ∀ r : ℝ, ↑r < x := Iff.rfl
set_option linter.deprecated false in
@[deprecated "`InfiniteNeg` is deprecated" (since := "2026-01-05")]
theorem infiniteNeg_def {x : ℝ*} : InfiniteNeg x ↔ ∀ r : ℝ, x < r := Iff.rfl
set_option linter.deprecated false in
@[deprecated "`InfinitePos` is deprecated" (since := "2026-01-05")]
theorem InfinitePos.pos {x : ℝ*} (hip : InfinitePos x) : 0 < x := hip 0
set_option linter.deprecated false in
@[deprecated "`InfiniteNeg` is deprecated" (since := "2026-01-05")]
theorem InfiniteNeg.lt_zero {x : ℝ*} : InfiniteNeg x → x < 0 := fun hin => hin 0
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem Infinite.ne_zero {x : ℝ*} (hI : Infinite x) : x ≠ 0 :=
hI.elim (fun hip => hip.pos.ne') fun hin => hin.lt_zero.ne
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem not_infinite_zero : ¬Infinite 0 := fun hI => hI.ne_zero rfl
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem InfiniteNeg.not_infinitePos {x : ℝ*} : InfiniteNeg x → ¬InfinitePos x := fun hn hp =>
(hn 0).not_gt (hp 0)
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem InfinitePos.not_infiniteNeg {x : ℝ*} (hp : InfinitePos x) : ¬InfiniteNeg x := fun hn ↦
hn.not_infinitePos hp
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem InfinitePos.neg {x : ℝ*} : InfinitePos x → InfiniteNeg (-x) := fun hp r =>
neg_lt.mp (hp (-r))
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem InfiniteNeg.neg {x : ℝ*} : InfiniteNeg x → InfinitePos (-x) := fun hp r =>
lt_neg.mp (hp (-r))
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem infiniteNeg_neg {x : ℝ*} : InfiniteNeg (-x) ↔ InfinitePos x :=
⟨fun hin => neg_neg x ▸ hin.neg, InfinitePos.neg⟩
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem infinitePos_neg {x : ℝ*} : InfinitePos (-x) ↔ InfiniteNeg x :=
⟨fun hin => neg_neg x ▸ hin.neg, InfiniteNeg.neg⟩
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infinite_neg {x : ℝ*} : Infinite (-x) ↔ Infinite x :=
or_comm.trans <| infiniteNeg_neg.or infinitePos_neg
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
nonrec theorem Infinitesimal.not_infinite {x : ℝ*} (h : Infinitesimal x) : ¬Infinite x :=
h.not_infinite
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem Infinite.not_infinitesimal {x : ℝ*} (h : Infinite x) : ¬Infinitesimal x := fun h' ↦
h'.not_infinite h
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem InfinitePos.not_infinitesimal {x : ℝ*} (h : InfinitePos x) : ¬Infinitesimal x :=
Infinite.not_infinitesimal (Or.inl h)
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem InfiniteNeg.not_infinitesimal {x : ℝ*} (h : InfiniteNeg x) : ¬Infinitesimal x :=
Infinite.not_infinitesimal (Or.inr h)
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infinitePos_iff_infinite_and_pos {x : ℝ*} : InfinitePos x ↔ Infinite x ∧ 0 < x :=
⟨fun hip => ⟨Or.inl hip, hip 0⟩, fun ⟨hi, hp⟩ =>
hi.casesOn id fun hin => False.elim (not_lt_of_gt hp (hin 0))⟩
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infiniteNeg_iff_infinite_and_neg {x : ℝ*} : InfiniteNeg x ↔ Infinite x ∧ x < 0 :=
⟨fun hip => ⟨Or.inr hip, hip 0⟩, fun ⟨hi, hp⟩ =>
hi.casesOn (fun hin => False.elim (not_lt_of_gt hp (hin 0))) fun hip => hip⟩
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infinitePos_iff_infinite_of_nonneg {x : ℝ*} (hp : 0 ≤ x) : InfinitePos x ↔ Infinite x :=
.symm <| or_iff_left fun h ↦ h.lt_zero.not_ge hp
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infinitePos_iff_infinite_of_pos {x : ℝ*} (hp : 0 < x) : InfinitePos x ↔ Infinite x :=
infinitePos_iff_infinite_of_nonneg hp.le
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infiniteNeg_iff_infinite_of_neg {x : ℝ*} (hn : x < 0) : InfiniteNeg x ↔ Infinite x :=
.symm <| or_iff_right fun h ↦ h.pos.not_gt hn
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infinitePos_abs_iff_infinite_abs {x : ℝ*} : InfinitePos |x| ↔ Infinite |x| :=
infinitePos_iff_infinite_of_nonneg (abs_nonneg _)
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infinite_abs_iff {x : ℝ*} : Infinite |x| ↔ Infinite x := by
cases le_total 0 x <;> simp [*, abs_of_nonneg, abs_of_nonpos, infinite_neg]
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infinitePos_abs_iff_infinite {x : ℝ*} : InfinitePos |x| ↔ Infinite x :=
infinitePos_abs_iff_infinite_abs.trans infinite_abs_iff
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infinite_iff_abs_lt_abs {x : ℝ*} : Infinite x ↔ ∀ r : ℝ, (|r| : ℝ*) < |x| :=
infinitePos_abs_iff_infinite.symm.trans ⟨fun hI r => coe_abs r ▸ hI |r|, fun hR r =>
(le_abs_self _).trans_lt (hR r)⟩
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem infinitePos_add_not_infiniteNeg {x y : ℝ*} :
InfinitePos x → ¬InfiniteNeg y → InfinitePos (x + y) := by
intro hip hnin r
obtain ⟨r₂, hr₂⟩ := not_forall.mp hnin
convert add_lt_add_of_lt_of_le (hip (r + -r₂)) (not_lt.mp hr₂) using 1
simp
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem not_infiniteNeg_add_infinitePos {x y : ℝ*} :
¬InfiniteNeg x → InfinitePos y → InfinitePos (x + y) := fun hx hy =>
add_comm y x ▸ infinitePos_add_not_infiniteNeg hy hx
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem infiniteNeg_add_not_infinitePos {x y : ℝ*} :
InfiniteNeg x → ¬InfinitePos y → InfiniteNeg (x + y) := by
rw [← infinitePos_neg, ← infinitePos_neg, ← @infiniteNeg_neg y, neg_add]
exact infinitePos_add_not_infiniteNeg
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem not_infinitePos_add_infiniteNeg {x y : ℝ*} :
¬InfinitePos x → InfiniteNeg y → InfiniteNeg (x + y) := fun hx hy =>
add_comm y x ▸ infiniteNeg_add_not_infinitePos hy hx
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem infinitePos_add_infinitePos {x y : ℝ*} :
InfinitePos x → InfinitePos y → InfinitePos (x + y) := fun hx hy =>
infinitePos_add_not_infiniteNeg hx hy.not_infiniteNeg
set_option linter.deprecated false in
@[deprecated "`InfinitePos` and `InfiniteNeg` are deprecated" (since := "2026-01-05")]
theorem infiniteNeg_add_infiniteNeg {x y : ℝ*} :
InfiniteNeg x → InfiniteNeg y → InfiniteNeg (x + y) := fun hx hy =>
infiniteNeg_add_not_infinitePos hx hy.not_infinitePos
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infinitePos_add_not_infinite {x y : ℝ*} :
InfinitePos x → ¬Infinite y → InfinitePos (x + y) := fun hx hy =>
infinitePos_add_not_infiniteNeg hx (not_or.mp hy).2
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem infiniteNeg_add_not_infinite {x y : ℝ*} :
InfiniteNeg x → ¬Infinite y → InfiniteNeg (x + y) := fun hx hy =>
infiniteNeg_add_not_infinitePos hx (not_or.mp hy).1
set_option linter.deprecated false in
@[deprecated "`InfinitePos` is deprecated" (since := "2026-01-05")]
theorem infinitePos_of_tendsto_top {f : ℕ → ℝ} (hf : Tendsto f atTop atTop) :
InfinitePos (ofSeq f) := by
replace hf := hf.mono_left Nat.hyperfilter_le_atTop
rw [infinitePos_iff]
exact ⟨lt_of_tendsto_atTop 0 hf, archimedeanClassMk_neg_of_tendsto_atTop hf⟩
set_option linter.deprecated false in
@[deprecated "`InfiniteNeg` is deprecated" (since := "2026-01-05")]
theorem infiniteNeg_of_tendsto_bot {f : ℕ → ℝ} (hf : Tendsto f atTop atBot) :
InfiniteNeg (ofSeq f) := by
replace hf := hf.mono_left Nat.hyperfilter_le_atTop
rw [infiniteNeg_iff]
exact ⟨lt_of_tendsto_atBot 0 hf, archimedeanClassMk_neg_of_tendsto_atBot hf⟩
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem not_infinite_neg {x : ℝ*} : ¬Infinite x → ¬Infinite (-x) := mt infinite_neg.mp
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem not_infinite_add {x y : ℝ*} (hx : ¬Infinite x) (hy : ¬Infinite y) : ¬Infinite (x + y) :=
have ⟨r, hr⟩ := exists_st_of_not_infinite hx
have ⟨s, hs⟩ := exists_st_of_not_infinite hy
not_infinite_of_exists_st <| ⟨r + s, hr.add hs⟩
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem not_infinite_iff_exist_lt_gt {x : ℝ*} : ¬Infinite x ↔ ∃ r s : ℝ, (r : ℝ*) < x ∧ x < s :=
⟨fun hni ↦ let ⟨r, hr⟩ := exists_st_of_not_infinite hni; ⟨r - 1, r + 1, hr 1 one_pos⟩,
fun ⟨r, s, hr, hs⟩ hi ↦ hi.elim (fun hp ↦ (hp s).not_gt hs) (fun hn ↦ (hn r).not_gt hr)⟩
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem not_infinite_real (r : ℝ) : ¬Infinite r := by
rw [not_infinite_iff_exist_lt_gt]
exact ⟨r - 1, r + 1, coe_lt_coe.2 <| sub_one_lt r, coe_lt_coe.2 <| lt_add_one r⟩
set_option linter.deprecated false in
@[deprecated "`Infinite` is deprecated" (since := "2026-01-05")]
theorem Infinite.ne_real {x : ℝ*} : Infinite x → ∀ r : ℝ, x ≠ r := fun hi r hr =>
not_infinite_real r <| @Eq.subst _ Infinite _ _ hr hi
/-!
### Facts about `st` that require some infinite machinery
-/
set_option linter.deprecated false in
@[deprecated stdPart_mul (since := "2026-01-05")]
theorem IsSt.mul {x y : ℝ*} {r s : ℝ} (hxr : IsSt x r) (hys : IsSt y s) : IsSt (x * y) (r * s) :=
hxr.map₂ hys continuous_mul.continuousAt
set_option linter.deprecated false in
@[deprecated mk_mul (since := "2026-01-05")]
theorem not_infinite_mul {x y : ℝ*} (hx : ¬Infinite x) (hy : ¬Infinite y) : ¬Infinite (x * y) :=
have ⟨_r, hr⟩ := exists_st_of_not_infinite hx
have ⟨_s, hs⟩ := exists_st_of_not_infinite hy
(hr.mul hs).not_infinite
set_option linter.deprecated false in
@[deprecated stdPart_add (since := "2026-01-05")]
theorem st_add {x y : ℝ*} (hx : ¬Infinite x) (hy : ¬Infinite y) : st (x + y) = st x + st y :=
(isSt_st' (not_infinite_add hx hy)).unique ((isSt_st' hx).add (isSt_st' hy))
set_option linter.deprecated false in
@[deprecated stdPart_neg (since := "2026-01-05")]
theorem st_neg (x : ℝ*) : st (-x) = -st x := by
classical
by_cases h : Infinite x
· rw [h.st_eq, (infinite_neg.2 h).st_eq, neg_zero]
· exact (isSt_st' (not_infinite_neg h)).unique (isSt_st' h).neg
set_option linter.deprecated false in
@[deprecated stdPart_mul (since := "2026-01-05")]
theorem st_mul {x y : ℝ*} (hx : ¬Infinite x) (hy : ¬Infinite y) : st (x * y) = st x * st y :=
have hx' := isSt_st' hx
have hy' := isSt_st' hy
have hxy := isSt_st' (not_infinite_mul hx hy)
hxy.unique (hx'.mul hy')
/-!
### Basic lemmas about infinitesimal
-/
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem infinitesimal_def {x : ℝ*} : Infinitesimal x ↔ ∀ r : ℝ, 0 < r → -(r : ℝ*) < x ∧ x < r := by
simp [Infinitesimal, IsSt]
set_option linter.deprecated false in
@[deprecated lt_of_pos_of_archimedean (since := "2026-01-05")]
theorem lt_of_pos_of_infinitesimal {x : ℝ*} : Infinitesimal x → ∀ r : ℝ, 0 < r → x < r :=
fun hi r hr => ((infinitesimal_def.mp hi) r hr).2
set_option linter.deprecated false in
@[deprecated lt_of_neg_of_archimedean (since := "2026-01-05")]
theorem lt_neg_of_pos_of_infinitesimal {x : ℝ*} : Infinitesimal x → ∀ r : ℝ, 0 < r → -↑r < x :=
fun hi r hr => ((infinitesimal_def.mp hi) r hr).1
set_option linter.deprecated false in
@[deprecated lt_of_neg_of_archimedean (since := "2026-01-05")]
theorem gt_of_neg_of_infinitesimal {x : ℝ*} (hi : Infinitesimal x) (r : ℝ) (hr : r < 0) : ↑r < x :=
neg_neg r ▸ (infinitesimal_def.1 hi (-r) (neg_pos.2 hr)).1
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem abs_lt_real_iff_infinitesimal {x : ℝ*} : Infinitesimal x ↔ ∀ r : ℝ, r ≠ 0 → |x| < |↑r| :=
⟨fun hi r hr ↦ abs_lt.mpr (coe_abs r ▸ infinitesimal_def.mp hi |r| (abs_pos.2 hr)), fun hR ↦
infinitesimal_def.mpr fun r hr => abs_lt.mp <| (abs_of_pos <| coe_pos.2 hr) ▸ hR r <| hr.ne'⟩
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem infinitesimal_zero : Infinitesimal 0 := isSt_refl_real 0
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem Infinitesimal.eq_zero {r : ℝ} : Infinitesimal r → r = 0 := eq_of_isSt_real
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem infinitesimal_real_iff {r : ℝ} : Infinitesimal r ↔ r = 0 :=
isSt_real_iff_eq
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
nonrec theorem Infinitesimal.add {x y : ℝ*} (hx : Infinitesimal x) (hy : Infinitesimal y) :
Infinitesimal (x + y) := by simpa only [add_zero] using hx.add hy
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
nonrec theorem Infinitesimal.neg {x : ℝ*} (hx : Infinitesimal x) : Infinitesimal (-x) := by
simpa only [neg_zero] using hx.neg
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem infinitesimal_neg {x : ℝ*} : Infinitesimal (-x) ↔ Infinitesimal x :=
⟨fun h => neg_neg x ▸ h.neg, Infinitesimal.neg⟩
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
nonrec theorem Infinitesimal.mul {x y : ℝ*} (hx : Infinitesimal x) (hy : Infinitesimal y) :
Infinitesimal (x * y) := by simpa only [mul_zero] using hx.mul hy
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem infinitesimal_of_tendsto_zero {f : ℕ → ℝ} (h : Tendsto f atTop (𝓝 0)) :
Infinitesimal (ofSeq f) :=
isSt_of_tendsto h
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem infinitesimal_epsilon : Infinitesimal ε :=
infinitesimal_of_tendsto_zero tendsto_inv_atTop_nhds_zero_nat
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem not_real_of_infinitesimal_ne_zero (x : ℝ*) : Infinitesimal x → x ≠ 0 → ∀ r : ℝ, x ≠ r :=
fun hi hx r hr =>
hx <| hr.trans <| coe_eq_zero.2 <| IsSt.unique (hr.symm ▸ isSt_refl_real r : IsSt x r) hi
set_option linter.deprecated false in
@[deprecated "`Infinitesimal` is deprecated" (since := "2026-01-05")]
theorem IsSt.infinitesimal_sub {x : ℝ*} {r : ℝ} (hxr : IsSt x r) : Infinitesimal (x - ↑r) := by
simpa only [sub_self] using hxr.sub (isSt_refl_real r)
set_option linter.deprecated false in