Skip to content

Commit 3f6cc95

Browse files
committed
use Num.int instead of Rint
1 parent 3a27d02 commit 3f6cc95

4 files changed

Lines changed: 66 additions & 36 deletions

File tree

CHANGELOG_UNRELEASED.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
- in `measurable_function.v`:
2222
+ lemma `preimage_measurability`
2323

24+
- in `unstable.v`:
25+
+ lemma `ex_eqP`
26+
2427
### Changed
2528

2629
- moved from `measurable_structure.v` to `classical_sets.v`:
@@ -54,6 +57,10 @@
5457
- moved from `topology_structure.v` to `filter.v`:
5558
+ lemma `continuous_comp` (and generalized)
5659

60+
- in `reals.v` (use `Num.int` instead of `Rint` which is deprecated)
61+
+ definition `Rtoint`
62+
+ lemmas `RtointK`, `inj_Rtoint`, `RtointN`
63+
5764
### Renamed
5865

5966
- in `tvs.v`:
@@ -76,6 +83,14 @@
7683

7784
### Deprecated
7885

86+
- in `reals.v`:
87+
+ definitions `Rint_pred`, `Rint`
88+
+ lemmas `Rint_def`, `RintP`, `RintC`, `Rint0`, `Rint1`, `Rint_subring_closed`,
89+
`Rint_ler_addr1`, `Rint_ltr_addr1`
90+
+ definition `Rtoint`
91+
+ lemmas `RtointK`, `Rtointz`, `Rtointn`, `inj_Rtoint`
92+
93+
7994
### Removed
8095

8196
- in `measurable_structure.v`:

classical/unstable.v

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,10 @@ Proof.
552552
by move=> eqP; split=> -[x p q]; exists x; move: p q; rewrite ?eqP.
553553
Qed.
554554

555+
Lemma ex_eqP {T : choiceType} {vT : eqType} (lhs rhs : T -> vT) :
556+
(exists x, lhs x = rhs x) -> exists x, lhs x == rhs x.
557+
Proof. by move=> [t ?]; exists t; exact/eqP. Qed.
558+
555559
Declare Scope signature_scope.
556560
Delimit Scope signature_scope with signature.
557561

reals/reals.v

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@
2727
(* sup A - eps < x for any 0 < eps (lemma sup_adherent) *)
2828
(* *)
2929
(* ``` *)
30-
(* Rint == the set of real numbers that can be written as z%:~R, *)
31-
(* i.e., as an integer *)
3230
(* Rtoint r == r when r is an integer, 0 otherwise *)
33-
(* floor_set x := [set y | Rtoint y /\ y <= x] *)
31+
(* floor_set x := [set y | (y \is a Num.int) && (y <= x)] *)
3432
(* Rfloor x == the floor of x as a real number *)
3533
(* range1 x := [set y |x <= y < x + 1] *)
3634
(* Rceil x == the ceil of x as a real number, i.e., - Rfloor (- x) *)
@@ -149,70 +147,83 @@ Proof. exact: sup_adherent_subdef. Qed.
149147
Section IsInt.
150148
Context {R : realFieldType}.
151149

150+
#[deprecated(since="mathcomp-analysis 1.17.0", note="use `Num.int` instead")]
152151
Definition Rint_pred := fun x : R => `[< exists z, x == z%:~R >].
153-
Arguments Rint_pred _ /.
154-
Definition Rint := [qualify a x | Rint_pred x].
152+
#[warning="-deprecated"] Arguments Rint_pred _ /.
155153

154+
#[deprecated(since="mathcomp-analysis 1.17.0", note="use `Num.int` instead")]
155+
#[warning="-deprecated"] Definition Rint := [qualify a x | Rint_pred x].
156+
157+
#[deprecated(since="mathcomp-analysis 1.17.0", note="use `Num.int` instead")]
158+
#[warning="-deprecated"]
156159
Lemma Rint_def x : (x \is a Rint) = (`[< exists z, x == z%:~R >]).
157160
Proof. by []. Qed.
158161

162+
#[deprecated(since="mathcomp-analysis 1.17.0", note="use `intrP` instead")]
163+
#[warning="-deprecated"]
159164
Lemma RintP x : reflect (exists z, x = z%:~R) (x \in Rint).
160165
Proof.
161166
by apply/(iffP idP) => [/asboolP[z /eqP]|[z]] ->; [|apply/asboolP]; exists z.
162167
Qed.
163168

164-
Lemma RintC z : z%:~R \is a Rint.
165-
Proof. by apply/RintP; exists z. Qed.
169+
#[deprecated(since="mathcomp-analysis 1.17.0", note="use `intr_int` instead")]
170+
#[warning="-deprecated"] Lemma RintC z : z%:~R \is a Rint.
171+
Proof. #[warning="-deprecated"] by apply/RintP; exists z. Qed.
166172

167-
Lemma Rint0 : 0 \is a Rint.
168-
Proof. by rewrite -[0](mulr0z 1) RintC. Qed.
173+
#[deprecated(since="mathcomp-analysis 1.17.0", note="use `int_num0` instead")]
174+
#[warning="-deprecated"] Lemma Rint0 : 0 \is a Rint.
175+
Proof. #[warning="-deprecated"] by rewrite -[0](mulr0z 1) RintC. Qed.
169176

170-
Lemma Rint1 : 1 \is a Rint.
171-
Proof. by rewrite -[1]mulr1z RintC. Qed.
177+
#[deprecated(since="mathcomp-analysis 1.17.0", note="use `int_num1` instead")]
178+
#[warning="-deprecated"] Lemma Rint1 : 1 \is a Rint.
179+
Proof. #[warning="-deprecated"] by rewrite -[1]mulr1z RintC. Qed.
172180

173-
Hint Resolve Rint0 Rint1 RintC : core.
181+
#[warning="-deprecated"] Hint Resolve Rint0 Rint1 RintC : core.
174182

175-
Lemma Rint_subring_closed : subring_closed Rint.
183+
#[deprecated(since="mathcomp-analysis 1.17.0", note="use `int_num_subring` instead")]
184+
#[warning="-deprecated"] Lemma Rint_subring_closed : subring_closed Rint.
176185
Proof.
177-
split=> // _ _ /RintP[x ->] /RintP[y ->]; apply/RintP.
186+
#[warning="-deprecated"] split=> // _ _ /RintP[x ->] /RintP[y ->]; apply/RintP.
178187
by exists (x - y); rewrite rmorphB. by exists (x * y); rewrite rmorphM.
179188
Qed.
180189

181-
HB.instance Definition _ := GRing.isSubringClosed.Build R Rint_pred
190+
#[warning="-deprecated"] HB.instance Definition _ := GRing.isSubringClosed.Build R Rint_pred
182191
Rint_subring_closed.
183192

184-
Lemma Rint_ler_addr1 (x y : R) : x \is a Rint -> y \is a Rint ->
193+
#[deprecated(since="mathcomp-analysis 1.17.0", note="use `lezD1` instead")]
194+
#[warning="-deprecated"] Lemma Rint_ler_addr1 (x y : R) : x \is a Rint -> y \is a Rint ->
185195
(x + 1 <= y) = (x < y).
186196
Proof.
187-
move=> /RintP[xi ->] /RintP[yi ->]; rewrite -{2}[1]mulr1z.
197+
#[warning="-deprecated"] move=> /RintP[xi ->] /RintP[yi ->]; rewrite -{2}[1]mulr1z.
188198
by rewrite -intrD !(ltr_int, ler_int) lezD1.
189199
Qed.
190200

191-
Lemma Rint_ltr_addr1 (x y : R) : x \is a Rint -> y \is a Rint ->
201+
#[deprecated(since="mathcomp-analysis 1.17.0", note="use `ltzD1` instead")]
202+
#[warning="-deprecated"] Lemma Rint_ltr_addr1 (x y : R) : x \is a Rint -> y \is a Rint ->
192203
(x < y + 1) = (x <= y).
193204
Proof.
194-
move=> /RintP[xi ->] /RintP[yi ->]; rewrite -{3}[1]mulr1z.
205+
#[warning="-deprecated"] move=> /RintP[xi ->] /RintP[yi ->]; rewrite -{3}[1]mulr1z.
195206
by rewrite -intrD !(ltr_int, ler_int) ltzD1.
196207
Qed.
197208

198209
End IsInt.
199-
Arguments Rint_pred _ _ /.
210+
#[warning="-deprecated"] Arguments Rint_pred _ _ /.
200211

201212
(* -------------------------------------------------------------------- *)
213+
202214
Section ToInt.
203215
Context {R : realType}.
204-
205216
Implicit Types x y : R.
206217

207218
Definition Rtoint (x : R) : int :=
208-
if insub x : {? x | x \is a Rint} is Some Px then
209-
xchoose (asboolP _ (tagged Px))
219+
if insub x : {? x | x \is a Num.int} is Some Px then
220+
xchoose (ex_eqP (elimT intrP (tagged (Px : {x : R | x \is a Num.int}))))
210221
else 0.
211222

212-
Lemma RtointK (x : R): x \is a Rint -> (Rtoint x)%:~R = x.
223+
Lemma RtointK (x : R): x \is a Num.int -> (Rtoint x)%:~R = x.
213224
Proof.
214-
move=> Ix; rewrite /Rtoint insubT /= [RHS](eqP (xchooseP (asboolP _ Ix))).
215-
by congr _%:~R; apply/eq_xchoose.
225+
move=> Ix; rewrite /Rtoint insubT//=; case: ex_eqP => //= i xi.
226+
by rewrite -(eqP (xchooseP (ex_intro (fun i => x == i%:~R) i xi))).
216227
Qed.
217228

218229
Lemma Rtointz (z : int): Rtoint z%:~R = z.
@@ -221,10 +232,10 @@ Proof. by apply/eqP; rewrite -(@eqr_int R) RtointK ?rpred_int. Qed.
221232
Lemma Rtointn (n : nat): Rtoint n%:R = n%:~R.
222233
Proof. by rewrite -{1}mulrz_nat Rtointz. Qed.
223234

224-
Lemma inj_Rtoint : {in Rint &, injective Rtoint}.
235+
Lemma inj_Rtoint : {in Num.int &, injective Rtoint}.
225236
Proof. by move=> x y Ix Iy /= /(congr1 (@intmul R 1)); rewrite !RtointK. Qed.
226237

227-
Lemma RtointN x : x \is a Rint -> Rtoint (- x) = - Rtoint x.
238+
Lemma RtointN x : x \is a Num.int -> Rtoint (- x) = - Rtoint x.
228239
Proof.
229240
move=> Ir; apply/eqP.
230241
by rewrite -(@eqr_int R) RtointK // ?rpredN // mulrNz RtointK.
@@ -238,7 +249,7 @@ Section RealDerivedOps.
238249
Variable R : realType.
239250

240251
Implicit Types x y : R.
241-
Definition floor_set x := [set y : R | (y \is a Rint) && (y <= x)].
252+
Definition floor_set x := [set y : R | (y \is a Num.int) && (y <= x)].
242253

243254
Definition Rfloor x : R := (Num.floor x)%:~R.
244255

@@ -456,15 +467,15 @@ move/sup_adherent=> -/(_ e) []; first by rewrite subr_gt0.
456467
move=> z Fz; rewrite /= subKr => lt_yz.
457468
have /sup_upper_bound /ubP /(_ _ Fz) := has_sup_floor_set x.
458469
rewrite -(lerD2r (-y)) => /le_lt_trans /(_ lt1_FxBy).
459-
case/andP: Fy Fz lt_yz=> /RintP[yi -> _].
460-
case/andP=> /RintP[zi -> _]; rewrite -rmorphB /= ltrz1 ltr_int.
470+
case/andP: Fy Fz lt_yz => /intrP[yi -> _].
471+
case/andP => /intrP[zi -> _]; rewrite -rmorphB /= ltrz1 ltr_int.
461472
rewrite lt_neqAle => /andP[ne_yz le_yz].
462473
rewrite -[_-_]gez0_abs ?subr_ge0 // ltz_nat ltnS leqn0.
463474
by rewrite absz_eq0 subr_eq0 eq_sym (negbTE ne_yz).
464475
Qed.
465476

466-
Lemma isint_Rfloor x : Rfloor x \is a Rint.
467-
Proof. by rewrite inE; exists (Num.floor x). Qed.
477+
Lemma isint_Rfloor x : Rfloor x \is a Num.int.
478+
Proof. by apply/intrP; exists (Num.floor x). Qed.
468479

469480
Lemma RfloorE x : Rfloor x = (Num.floor x)%:~R.
470481
Proof. by []. Qed.
@@ -534,8 +545,8 @@ Variable R : realType.
534545

535546
Implicit Types x y : R.
536547

537-
Lemma isint_Rceil x : Rceil x \is a Rint.
538-
Proof. by rewrite /Rceil RintC. Qed.
548+
Lemma isint_Rceil x : Rceil x \is a Num.int.
549+
Proof. by rewrite /Rceil intr_int. Qed.
539550

540551
Lemma Rceil0 : Rceil 0 = 0 :> R.
541552
Proof. by rewrite /Rceil ceil0. Qed.

theories/measurable_realfun.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ have badn' k : exists n, mu (E k n) < ((eps / 2) / (2 ^ k.+1)%:R)%:E.
17201720
pose badn k := projT1 (cid (badn' k)); exists (\bigcup_k E k (badn k)); split.
17211721
- exact: bigcup_measurable.
17221722
- apply: (@le_lt_trans _ _ (eps / 2)%:E); first last.
1723-
by rewrite lte_fin ltr_pdivrMr // ltr_pMr // Rint_ltr_addr1 // Rint1.
1723+
by rewrite lte_fin ltr_pdivrMr // ltr_pMr // ltr1n.
17241724
apply: le_trans.
17251725
apply: (measure_sigma_subadditive _ (fun k => mE k (badn k)) _ _) => //.
17261726
exact: bigcup_measurable.

0 commit comments

Comments
 (0)