/
measure_space.lean
4012 lines (3263 loc) · 177 KB
/
measure_space.lean
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) 2017 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Mario Carneiro
-/
import measure_theory.measure.null_measurable
import measure_theory.measurable_space
import topology.algebra.order.liminf_limsup
/-!
# Measure spaces
The definition of a measure and a measure space are in `measure_theory.measure_space_def`, with
only a few basic properties. This file provides many more properties of these objects.
This separation allows the measurability tactic to import only the file `measure_space_def`, and to
be available in `measure_space` (through `measurable_space`).
Given a measurable space `α`, a measure on `α` is a function that sends measurable sets to the
extended nonnegative reals that satisfies the following conditions:
1. `μ ∅ = 0`;
2. `μ` is countably additive. This means that the measure of a countable union of pairwise disjoint
sets is equal to the measure of the individual sets.
Every measure can be canonically extended to an outer measure, so that it assigns values to
all subsets, not just the measurable subsets. On the other hand, a measure that is countably
additive on measurable sets can be restricted to measurable sets to obtain a measure.
In this file a measure is defined to be an outer measure that is countably additive on
measurable sets, with the additional assumption that the outer measure is the canonical
extension of the restricted measure.
Measures on `α` form a complete lattice, and are closed under scalar multiplication with `ℝ≥0∞`.
We introduce the following typeclasses for measures:
* `is_probability_measure μ`: `μ univ = 1`;
* `is_finite_measure μ`: `μ univ < ∞`;
* `sigma_finite μ`: there exists a countable collection of sets that cover `univ`
where `μ` is finite;
* `is_locally_finite_measure μ` : `∀ x, ∃ s ∈ 𝓝 x, μ s < ∞`;
* `has_no_atoms μ` : `∀ x, μ {x} = 0`; possibly should be redefined as
`∀ s, 0 < μ s → ∃ t ⊆ s, 0 < μ t ∧ μ t < μ s`.
Given a measure, the null sets are the sets where `μ s = 0`, where `μ` denotes the corresponding
outer measure (so `s` might not be measurable). We can then define the completion of `μ` as the
measure on the least `σ`-algebra that also contains all null sets, by defining the measure to be `0`
on the null sets.
## Main statements
* `completion` is the completion of a measure to all null measurable sets.
* `measure.of_measurable` and `outer_measure.to_measure` are two important ways to define a measure.
## Implementation notes
Given `μ : measure α`, `μ s` is the value of the *outer measure* applied to `s`.
This conveniently allows us to apply the measure to sets without proving that they are measurable.
We get countable subadditivity for all sets, but only countable additivity for measurable sets.
You often don't want to define a measure via its constructor.
Two ways that are sometimes more convenient:
* `measure.of_measurable` is a way to define a measure by only giving its value on measurable sets
and proving the properties (1) and (2) mentioned above.
* `outer_measure.to_measure` is a way of obtaining a measure from an outer measure by showing that
all measurable sets in the measurable space are Carathéodory measurable.
To prove that two measures are equal, there are multiple options:
* `ext`: two measures are equal if they are equal on all measurable sets.
* `ext_of_generate_from_of_Union`: two measures are equal if they are equal on a π-system generating
the measurable sets, if the π-system contains a spanning increasing sequence of sets where the
measures take finite value (in particular the measures are σ-finite). This is a special case of
the more general `ext_of_generate_from_of_cover`
* `ext_of_generate_finite`: two finite measures are equal if they are equal on a π-system
generating the measurable sets. This is a special case of `ext_of_generate_from_of_Union` using
`C ∪ {univ}`, but is easier to work with.
A `measure_space` is a class that is a measurable space with a canonical measure.
The measure is denoted `volume`.
## References
* <https://en.wikipedia.org/wiki/Measure_(mathematics)>
* <https://en.wikipedia.org/wiki/Complete_measure>
* <https://en.wikipedia.org/wiki/Almost_everywhere>
## Tags
measure, almost everywhere, measure space, completion, null set, null measurable set
-/
noncomputable theory
open set filter (hiding map) function measurable_space topological_space (second_countable_topology)
open_locale classical topological_space big_operators filter ennreal nnreal interval measure_theory
variables {α β γ δ ι R R' : Type*}
namespace measure_theory
section
variables {m : measurable_space α} {μ μ₁ μ₂ : measure α} {s s₁ s₂ t : set α}
instance ae_is_measurably_generated : is_measurably_generated μ.ae :=
⟨λ s hs, let ⟨t, hst, htm, htμ⟩ := exists_measurable_superset_of_null hs in
⟨tᶜ, compl_mem_ae_iff.2 htμ, htm.compl, compl_subset_comm.1 hst⟩⟩
/-- See also `measure_theory.ae_restrict_interval_oc_iff`. -/
lemma ae_interval_oc_iff [linear_order α] {a b : α} {P : α → Prop} :
(∀ᵐ x ∂μ, x ∈ Ι a b → P x) ↔ (∀ᵐ x ∂μ, x ∈ Ioc a b → P x) ∧ (∀ᵐ x ∂μ, x ∈ Ioc b a → P x) :=
by simp only [interval_oc_eq_union, mem_union, or_imp_distrib, eventually_and]
lemma measure_union (hd : disjoint s₁ s₂) (h : measurable_set s₂) :
μ (s₁ ∪ s₂) = μ s₁ + μ s₂ :=
measure_union₀ h.null_measurable_set hd.ae_disjoint
lemma measure_union' (hd : disjoint s₁ s₂) (h : measurable_set s₁) :
μ (s₁ ∪ s₂) = μ s₁ + μ s₂ :=
measure_union₀' h.null_measurable_set hd.ae_disjoint
lemma measure_inter_add_diff (s : set α) (ht : measurable_set t) :
μ (s ∩ t) + μ (s \ t) = μ s :=
measure_inter_add_diff₀ _ ht.null_measurable_set
lemma measure_diff_add_inter (s : set α) (ht : measurable_set t) :
μ (s \ t) + μ (s ∩ t) = μ s :=
(add_comm _ _).trans (measure_inter_add_diff s ht)
lemma measure_union_add_inter (s : set α) (ht : measurable_set t) :
μ (s ∪ t) + μ (s ∩ t) = μ s + μ t :=
by { rw [← measure_inter_add_diff (s ∪ t) ht, set.union_inter_cancel_right,
union_diff_right, ← measure_inter_add_diff s ht], ac_refl }
lemma measure_union_add_inter' (hs : measurable_set s) (t : set α) :
μ (s ∪ t) + μ (s ∩ t) = μ s + μ t :=
by rw [union_comm, inter_comm, measure_union_add_inter t hs, add_comm]
lemma measure_add_measure_compl (h : measurable_set s) :
μ s + μ sᶜ = μ univ :=
measure_add_measure_compl₀ h.null_measurable_set
lemma measure_bUnion₀ {s : set β} {f : β → set α} (hs : s.countable)
(hd : s.pairwise (ae_disjoint μ on f)) (h : ∀ b ∈ s, null_measurable_set (f b) μ) :
μ (⋃ b ∈ s, f b) = ∑' p : s, μ (f p) :=
begin
haveI := hs.to_encodable,
rw bUnion_eq_Union,
exact measure_Union₀ (hd.on_injective subtype.coe_injective $ λ x, x.2) (λ x, h x x.2)
end
lemma measure_bUnion {s : set β} {f : β → set α} (hs : s.countable)
(hd : s.pairwise_disjoint f) (h : ∀ b ∈ s, measurable_set (f b)) :
μ (⋃ b ∈ s, f b) = ∑' p : s, μ (f p) :=
measure_bUnion₀ hs hd.ae_disjoint (λ b hb, (h b hb).null_measurable_set)
lemma measure_sUnion₀ {S : set (set α)} (hs : S.countable)
(hd : S.pairwise (ae_disjoint μ)) (h : ∀ s ∈ S, null_measurable_set s μ) :
μ (⋃₀ S) = ∑' s : S, μ s :=
by rw [sUnion_eq_bUnion, measure_bUnion₀ hs hd h]
lemma measure_sUnion {S : set (set α)} (hs : S.countable)
(hd : S.pairwise disjoint) (h : ∀ s ∈ S, measurable_set s) :
μ (⋃₀ S) = ∑' s : S, μ s :=
by rw [sUnion_eq_bUnion, measure_bUnion hs hd h]
lemma measure_bUnion_finset₀ {s : finset ι} {f : ι → set α}
(hd : set.pairwise ↑s (ae_disjoint μ on f)) (hm : ∀ b ∈ s, null_measurable_set (f b) μ) :
μ (⋃ b ∈ s, f b) = ∑ p in s, μ (f p) :=
begin
rw [← finset.sum_attach, finset.attach_eq_univ, ← tsum_fintype],
exact measure_bUnion₀ s.countable_to_set hd hm
end
lemma measure_bUnion_finset {s : finset ι} {f : ι → set α} (hd : pairwise_disjoint ↑s f)
(hm : ∀ b ∈ s, measurable_set (f b)) :
μ (⋃ b ∈ s, f b) = ∑ p in s, μ (f p) :=
measure_bUnion_finset₀ hd.ae_disjoint (λ b hb, (hm b hb).null_measurable_set)
/-- The measure of a disjoint union (even uncountable) of measurable sets is at least the sum of
the measures of the sets. -/
lemma tsum_meas_le_meas_Union_of_disjoint {ι : Type*} [measurable_space α] (μ : measure α)
{As : ι → set α} (As_mble : ∀ (i : ι), measurable_set (As i))
(As_disj : pairwise (disjoint on As)) :
∑' i, μ (As i) ≤ μ (⋃ i, As i) :=
begin
rcases (show summable (λ i, μ (As i)), from ennreal.summable) with ⟨S, hS⟩,
rw [hS.tsum_eq],
refine tendsto_le_of_eventually_le hS tendsto_const_nhds (eventually_of_forall _),
intros s,
rw ← measure_bUnion_finset (λ i hi j hj hij, As_disj hij) (λ i _, As_mble i),
exact measure_mono (Union₂_subset_Union (λ (i : ι), i ∈ s) (λ (i : ι), As i)),
end
/-- If `s` is a countable set, then the measure of its preimage can be found as the sum of measures
of the fibers `f ⁻¹' {y}`. -/
lemma tsum_measure_preimage_singleton {s : set β} (hs : s.countable) {f : α → β}
(hf : ∀ y ∈ s, measurable_set (f ⁻¹' {y})) :
∑' b : s, μ (f ⁻¹' {↑b}) = μ (f ⁻¹' s) :=
by rw [← set.bUnion_preimage_singleton, measure_bUnion hs (pairwise_disjoint_fiber _ _) hf]
/-- If `s` is a `finset`, then the measure of its preimage can be found as the sum of measures
of the fibers `f ⁻¹' {y}`. -/
lemma sum_measure_preimage_singleton (s : finset β) {f : α → β}
(hf : ∀ y ∈ s, measurable_set (f ⁻¹' {y})) :
∑ b in s, μ (f ⁻¹' {b}) = μ (f ⁻¹' ↑s) :=
by simp only [← measure_bUnion_finset (pairwise_disjoint_fiber _ _) hf,
finset.set_bUnion_preimage_singleton]
lemma measure_diff_null' (h : μ (s₁ ∩ s₂) = 0) : μ (s₁ \ s₂) = μ s₁ :=
measure_congr $ diff_ae_eq_self.2 h
lemma measure_diff_null (h : μ s₂ = 0) : μ (s₁ \ s₂) = μ s₁ :=
measure_diff_null' $ measure_mono_null (inter_subset_right _ _) h
lemma measure_add_diff (hs : measurable_set s) (t : set α) : μ s + μ (t \ s) = μ (s ∪ t) :=
by rw [← measure_union' disjoint_diff hs, union_diff_self]
lemma measure_diff' (s : set α) (hm : measurable_set t) (h_fin : μ t ≠ ∞) :
μ (s \ t) = μ (s ∪ t) - μ t :=
eq.symm $ ennreal.sub_eq_of_add_eq h_fin $ by rw [add_comm, measure_add_diff hm, union_comm]
lemma measure_diff (h : s₂ ⊆ s₁) (h₂ : measurable_set s₂) (h_fin : μ s₂ ≠ ∞) :
μ (s₁ \ s₂) = μ s₁ - μ s₂ :=
by rw [measure_diff' _ h₂ h_fin, union_eq_self_of_subset_right h]
lemma le_measure_diff : μ s₁ - μ s₂ ≤ μ (s₁ \ s₂) :=
tsub_le_iff_left.2 $
calc μ s₁ ≤ μ (s₂ ∪ s₁) : measure_mono (subset_union_right _ _)
... = μ (s₂ ∪ s₁ \ s₂) : congr_arg μ union_diff_self.symm
... ≤ μ s₂ + μ (s₁ \ s₂) : measure_union_le _ _
lemma measure_diff_lt_of_lt_add (hs : measurable_set s) (hst : s ⊆ t)
(hs' : μ s ≠ ∞) {ε : ℝ≥0∞} (h : μ t < μ s + ε) : μ (t \ s) < ε :=
begin
rw [measure_diff hst hs hs'], rw add_comm at h,
exact ennreal.sub_lt_of_lt_add (measure_mono hst) h
end
lemma measure_diff_le_iff_le_add (hs : measurable_set s) (hst : s ⊆ t)
(hs' : μ s ≠ ∞) {ε : ℝ≥0∞} : μ (t \ s) ≤ ε ↔ μ t ≤ μ s + ε :=
by rwa [measure_diff hst hs hs', tsub_le_iff_left]
lemma measure_eq_measure_of_null_diff {s t : set α} (hst : s ⊆ t) (h_nulldiff : μ (t \ s) = 0) :
μ s = μ t :=
measure_congr (hst.eventually_le.antisymm $ ae_le_set.mpr h_nulldiff)
lemma measure_eq_measure_of_between_null_diff {s₁ s₂ s₃ : set α}
(h12 : s₁ ⊆ s₂) (h23 : s₂ ⊆ s₃) (h_nulldiff : μ (s₃ \ s₁) = 0) :
(μ s₁ = μ s₂) ∧ (μ s₂ = μ s₃) :=
begin
have le12 : μ s₁ ≤ μ s₂ := measure_mono h12,
have le23 : μ s₂ ≤ μ s₃ := measure_mono h23,
have key : μ s₃ ≤ μ s₁ := calc
μ s₃ = μ ((s₃ \ s₁) ∪ s₁) : by rw (diff_union_of_subset (h12.trans h23))
... ≤ μ (s₃ \ s₁) + μ s₁ : measure_union_le _ _
... = μ s₁ : by simp only [h_nulldiff, zero_add],
exact ⟨le12.antisymm (le23.trans key), le23.antisymm (key.trans le12)⟩,
end
lemma measure_eq_measure_smaller_of_between_null_diff {s₁ s₂ s₃ : set α}
(h12 : s₁ ⊆ s₂) (h23 : s₂ ⊆ s₃) (h_nulldiff : μ (s₃ \ s₁) = 0) : μ s₁ = μ s₂ :=
(measure_eq_measure_of_between_null_diff h12 h23 h_nulldiff).1
lemma measure_eq_measure_larger_of_between_null_diff {s₁ s₂ s₃ : set α}
(h12 : s₁ ⊆ s₂) (h23 : s₂ ⊆ s₃) (h_nulldiff : μ (s₃ \ s₁) = 0) : μ s₂ = μ s₃ :=
(measure_eq_measure_of_between_null_diff h12 h23 h_nulldiff).2
lemma measure_compl (h₁ : measurable_set s) (h_fin : μ s ≠ ∞) : μ (sᶜ) = μ univ - μ s :=
by { rw compl_eq_univ_diff, exact measure_diff (subset_univ s) h₁ h_fin }
/-- If `s ⊆ t`, `μ t ≤ μ s`, `μ t ≠ ∞`, and `s` is measurable, then `s =ᵐ[μ] t`. -/
lemma ae_eq_of_subset_of_measure_ge (h₁ : s ⊆ t) (h₂ : μ t ≤ μ s) (hsm : measurable_set s)
(ht : μ t ≠ ∞) : s =ᵐ[μ] t :=
have A : μ t = μ s, from h₂.antisymm (measure_mono h₁),
have B : μ s ≠ ∞, from A ▸ ht,
h₁.eventually_le.antisymm $ ae_le_set.2 $ by rw [measure_diff h₁ hsm B, A, tsub_self]
lemma measure_Union_congr_of_subset [countable β] {s : β → set α} {t : β → set α}
(hsub : ∀ b, s b ⊆ t b) (h_le : ∀ b, μ (t b) ≤ μ (s b)) :
μ (⋃ b, s b) = μ (⋃ b, t b) :=
begin
rcases em (∃ b, μ (t b) = ∞) with ⟨b, hb⟩|htop,
{ calc μ (⋃ b, s b) = ∞ : top_unique (hb ▸ (h_le b).trans $ measure_mono $ subset_Union _ _)
... = μ (⋃ b, t b) : eq.symm $ top_unique $ hb ▸ measure_mono $ subset_Union _ _ },
push_neg at htop,
refine le_antisymm (measure_mono (Union_mono hsub)) _,
set M := to_measurable μ,
have H : ∀ b, (M (t b) ∩ M (⋃ b, s b) : set α) =ᵐ[μ] M (t b),
{ refine λ b, ae_eq_of_subset_of_measure_ge (inter_subset_left _ _) _ _ _,
{ calc μ (M (t b)) = μ (t b) : measure_to_measurable _
... ≤ μ (s b) : h_le b
... ≤ μ (M (t b) ∩ M (⋃ b, s b)) : measure_mono $
subset_inter ((hsub b).trans $ subset_to_measurable _ _)
((subset_Union _ _).trans $ subset_to_measurable _ _) },
{ exact (measurable_set_to_measurable _ _).inter (measurable_set_to_measurable _ _) },
{ rw measure_to_measurable, exact htop b } },
calc μ (⋃ b, t b) ≤ μ (⋃ b, M (t b)) :
measure_mono (Union_mono $ λ b, subset_to_measurable _ _)
... = μ (⋃ b, M (t b) ∩ M (⋃ b, s b)) :
measure_congr (eventually_eq.countable_Union H).symm
... ≤ μ (M (⋃ b, s b)) :
measure_mono (Union_subset $ λ b, inter_subset_right _ _)
... = μ (⋃ b, s b) : measure_to_measurable _
end
lemma measure_union_congr_of_subset {t₁ t₂ : set α} (hs : s₁ ⊆ s₂) (hsμ : μ s₂ ≤ μ s₁)
(ht : t₁ ⊆ t₂) (htμ : μ t₂ ≤ μ t₁) :
μ (s₁ ∪ t₁) = μ (s₂ ∪ t₂) :=
begin
rw [union_eq_Union, union_eq_Union],
exact measure_Union_congr_of_subset (bool.forall_bool.2 ⟨ht, hs⟩) (bool.forall_bool.2 ⟨htμ, hsμ⟩)
end
@[simp] lemma measure_Union_to_measurable [countable β] (s : β → set α) :
μ (⋃ b, to_measurable μ (s b)) = μ (⋃ b, s b) :=
eq.symm $ measure_Union_congr_of_subset (λ b, subset_to_measurable _ _)
(λ b, (measure_to_measurable _).le)
lemma measure_bUnion_to_measurable {I : set β} (hc : I.countable) (s : β → set α) :
μ (⋃ b ∈ I, to_measurable μ (s b)) = μ (⋃ b ∈ I, s b) :=
by { haveI := hc.to_encodable, simp only [bUnion_eq_Union, measure_Union_to_measurable] }
@[simp] lemma measure_to_measurable_union : μ (to_measurable μ s ∪ t) = μ (s ∪ t) :=
eq.symm $ measure_union_congr_of_subset (subset_to_measurable _ _) (measure_to_measurable _).le
subset.rfl le_rfl
@[simp] lemma measure_union_to_measurable : μ (s ∪ to_measurable μ t) = μ (s ∪ t) :=
eq.symm $ measure_union_congr_of_subset subset.rfl le_rfl (subset_to_measurable _ _)
(measure_to_measurable _).le
lemma sum_measure_le_measure_univ {s : finset ι} {t : ι → set α} (h : ∀ i ∈ s, measurable_set (t i))
(H : set.pairwise_disjoint ↑s t) :
∑ i in s, μ (t i) ≤ μ (univ : set α) :=
by { rw ← measure_bUnion_finset H h, exact measure_mono (subset_univ _) }
lemma tsum_measure_le_measure_univ {s : ι → set α} (hs : ∀ i, measurable_set (s i))
(H : pairwise (disjoint on s)) :
∑' i, μ (s i) ≤ μ (univ : set α) :=
begin
rw [ennreal.tsum_eq_supr_sum],
exact supr_le (λ s, sum_measure_le_measure_univ (λ i hi, hs i) (λ i hi j hj hij, H hij))
end
/-- Pigeonhole principle for measure spaces: if `∑' i, μ (s i) > μ univ`, then
one of the intersections `s i ∩ s j` is not empty. -/
lemma exists_nonempty_inter_of_measure_univ_lt_tsum_measure {m : measurable_space α} (μ : measure α)
{s : ι → set α} (hs : ∀ i, measurable_set (s i)) (H : μ (univ : set α) < ∑' i, μ (s i)) :
∃ i j (h : i ≠ j), (s i ∩ s j).nonempty :=
begin
contrapose! H,
apply tsum_measure_le_measure_univ hs,
intros i j hij,
rw [function.on_fun, disjoint_iff_inf_le],
exact λ x hx, H i j hij ⟨x, hx⟩
end
/-- Pigeonhole principle for measure spaces: if `s` is a `finset` and
`∑ i in s, μ (t i) > μ univ`, then one of the intersections `t i ∩ t j` is not empty. -/
lemma exists_nonempty_inter_of_measure_univ_lt_sum_measure {m : measurable_space α} (μ : measure α)
{s : finset ι} {t : ι → set α} (h : ∀ i ∈ s, measurable_set (t i))
(H : μ (univ : set α) < ∑ i in s, μ (t i)) :
∃ (i ∈ s) (j ∈ s) (h : i ≠ j), (t i ∩ t j).nonempty :=
begin
contrapose! H,
apply sum_measure_le_measure_univ h,
intros i hi j hj hij,
rw [function.on_fun, disjoint_iff_inf_le],
exact λ x hx, H i hi j hj hij ⟨x, hx⟩
end
/-- If two sets `s` and `t` are included in a set `u`, and `μ s + μ t > μ u`,
then `s` intersects `t`. Version assuming that `t` is measurable. -/
lemma nonempty_inter_of_measure_lt_add
{m : measurable_space α} (μ : measure α)
{s t u : set α} (ht : measurable_set t) (h's : s ⊆ u) (h't : t ⊆ u)
(h : μ u < μ s + μ t) :
(s ∩ t).nonempty :=
begin
rw ←set.not_disjoint_iff_nonempty_inter,
contrapose! h,
calc μ s + μ t = μ (s ∪ t) : (measure_union h ht).symm
... ≤ μ u : measure_mono (union_subset h's h't)
end
/-- If two sets `s` and `t` are included in a set `u`, and `μ s + μ t > μ u`,
then `s` intersects `t`. Version assuming that `s` is measurable. -/
lemma nonempty_inter_of_measure_lt_add'
{m : measurable_space α} (μ : measure α)
{s t u : set α} (hs : measurable_set s) (h's : s ⊆ u) (h't : t ⊆ u)
(h : μ u < μ s + μ t) :
(s ∩ t).nonempty :=
begin
rw add_comm at h,
rw inter_comm,
exact nonempty_inter_of_measure_lt_add μ hs h't h's h
end
/-- Continuity from below: the measure of the union of a directed sequence of (not necessarily
-measurable) sets is the supremum of the measures. -/
lemma measure_Union_eq_supr [countable ι] {s : ι → set α} (hd : directed (⊆) s) :
μ (⋃ i, s i) = ⨆ i, μ (s i) :=
begin
casesI nonempty_encodable ι,
-- WLOG, `ι = ℕ`
generalize ht : function.extend encodable.encode s ⊥ = t,
replace hd : directed (⊆) t := ht ▸ hd.extend_bot encodable.encode_injective,
suffices : μ (⋃ n, t n) = ⨆ n, μ (t n),
{ simp only [← ht, encodable.encode_injective.apply_extend μ, ← supr_eq_Union,
supr_extend_bot encodable.encode_injective, (∘), pi.bot_apply, bot_eq_empty,
measure_empty] at this,
exact this.trans (supr_extend_bot encodable.encode_injective _) },
unfreezingI { clear_dependent ι },
-- The `≥` inequality is trivial
refine le_antisymm _ (supr_le $ λ i, measure_mono $ subset_Union _ _),
-- Choose `T n ⊇ t n` of the same measure, put `Td n = disjointed T`
set T : ℕ → set α := λ n, to_measurable μ (t n),
set Td : ℕ → set α := disjointed T,
have hm : ∀ n, measurable_set (Td n),
from measurable_set.disjointed (λ n, measurable_set_to_measurable _ _),
calc μ (⋃ n, t n) ≤ μ (⋃ n, T n) : measure_mono (Union_mono $ λ i, subset_to_measurable _ _)
... = μ (⋃ n, Td n) : by rw [Union_disjointed]
... ≤ ∑' n, μ (Td n) : measure_Union_le _
... = ⨆ I : finset ℕ, ∑ n in I, μ (Td n) : ennreal.tsum_eq_supr_sum
... ≤ ⨆ n, μ (t n) : supr_le (λ I, _),
rcases hd.finset_le I with ⟨N, hN⟩,
calc ∑ n in I, μ (Td n) = μ (⋃ n ∈ I, Td n) :
(measure_bUnion_finset ((disjoint_disjointed T).set_pairwise I) (λ n _, hm n)).symm
... ≤ μ (⋃ n ∈ I, T n) : measure_mono (Union₂_mono $ λ n hn, disjointed_subset _ _)
... = μ (⋃ n ∈ I, t n) : measure_bUnion_to_measurable I.countable_to_set _
... ≤ μ (t N) : measure_mono (Union₂_subset hN)
... ≤ ⨆ n, μ (t n) : le_supr (μ ∘ t) N,
end
lemma measure_bUnion_eq_supr {s : ι → set α} {t : set ι} (ht : t.countable)
(hd : directed_on ((⊆) on s) t) :
μ (⋃ i ∈ t, s i) = ⨆ i ∈ t, μ (s i) :=
begin
haveI := ht.to_encodable,
rw [bUnion_eq_Union, measure_Union_eq_supr hd.directed_coe, ← supr_subtype'']
end
/-- Continuity from above: the measure of the intersection of a decreasing sequence of measurable
sets is the infimum of the measures. -/
lemma measure_Inter_eq_infi [countable ι] {s : ι → set α}
(h : ∀ i, measurable_set (s i)) (hd : directed (⊇) s) (hfin : ∃ i, μ (s i) ≠ ∞) :
μ (⋂ i, s i) = (⨅ i, μ (s i)) :=
begin
rcases hfin with ⟨k, hk⟩,
have : ∀ t ⊆ s k, μ t ≠ ∞, from λ t ht, ne_top_of_le_ne_top hk (measure_mono ht),
rw [← ennreal.sub_sub_cancel (by exact hk) (infi_le _ k), ennreal.sub_infi,
← ennreal.sub_sub_cancel (by exact hk) (measure_mono (Inter_subset _ k)),
← measure_diff (Inter_subset _ k) (measurable_set.Inter h) (this _ (Inter_subset _ k)),
diff_Inter, measure_Union_eq_supr],
{ congr' 1,
refine le_antisymm (supr_mono' $ λ i, _) (supr_mono $ λ i, _),
{ rcases hd i k with ⟨j, hji, hjk⟩,
use j,
rw [← measure_diff hjk (h _) (this _ hjk)],
exact measure_mono (diff_subset_diff_right hji) },
{ rw [tsub_le_iff_right, ← measure_union disjoint_diff.symm (h i), set.union_comm],
exact measure_mono (diff_subset_iff.1 $ subset.refl _) } },
{ exact hd.mono_comp _ (λ _ _, diff_subset_diff_right) }
end
/-- Continuity from below: the measure of the union of an increasing sequence of measurable sets
is the limit of the measures. -/
lemma tendsto_measure_Union [semilattice_sup ι] [countable ι] {s : ι → set α} (hm : monotone s) :
tendsto (μ ∘ s) at_top (𝓝 (μ (⋃ n, s n))) :=
begin
rw measure_Union_eq_supr (directed_of_sup hm),
exact tendsto_at_top_supr (λ n m hnm, measure_mono $ hm hnm)
end
/-- Continuity from above: the measure of the intersection of a decreasing sequence of measurable
sets is the limit of the measures. -/
lemma tendsto_measure_Inter [countable ι] [semilattice_sup ι] {s : ι → set α}
(hs : ∀ n, measurable_set (s n)) (hm : antitone s) (hf : ∃ i, μ (s i) ≠ ∞) :
tendsto (μ ∘ s) at_top (𝓝 (μ (⋂ n, s n))) :=
begin
rw measure_Inter_eq_infi hs (directed_of_sup hm) hf,
exact tendsto_at_top_infi (λ n m hnm, measure_mono $ hm hnm),
end
/-- The measure of the intersection of a decreasing sequence of measurable
sets indexed by a linear order with first countable topology is the limit of the measures. -/
lemma tendsto_measure_bInter_gt {ι : Type*} [linear_order ι] [topological_space ι]
[order_topology ι] [densely_ordered ι] [topological_space.first_countable_topology ι]
{s : ι → set α} {a : ι}
(hs : ∀ r > a, measurable_set (s r)) (hm : ∀ i j, a < i → i ≤ j → s i ⊆ s j)
(hf : ∃ r > a, μ (s r) ≠ ∞) :
tendsto (μ ∘ s) (𝓝[Ioi a] a) (𝓝 (μ (⋂ r > a, s r))) :=
begin
refine tendsto_order.2 ⟨λ l hl, _, λ L hL, _⟩,
{ filter_upwards [self_mem_nhds_within] with r hr
using hl.trans_le (measure_mono (bInter_subset_of_mem hr)), },
obtain ⟨u, u_anti, u_pos, u_lim⟩ : ∃ (u : ℕ → ι), strict_anti u ∧ (∀ (n : ℕ), a < u n)
∧ tendsto u at_top (𝓝 a),
{ rcases hf with ⟨r, ar, hr⟩,
rcases exists_seq_strict_anti_tendsto' ar with ⟨w, w_anti, w_mem, w_lim⟩,
exact ⟨w, w_anti, λ n, (w_mem n).1, w_lim⟩ },
have A : tendsto (μ ∘ (s ∘ u)) at_top (𝓝(μ (⋂ n, s (u n)))),
{ refine tendsto_measure_Inter (λ n, hs _ (u_pos n)) _ _,
{ intros m n hmn,
exact hm _ _ (u_pos n) (u_anti.antitone hmn) },
{ rcases hf with ⟨r, rpos, hr⟩,
obtain ⟨n, hn⟩ : ∃ (n : ℕ), u n < r := ((tendsto_order.1 u_lim).2 r rpos).exists,
refine ⟨n, ne_of_lt (lt_of_le_of_lt _ hr.lt_top)⟩,
exact measure_mono (hm _ _ (u_pos n) hn.le) } },
have B : (⋂ n, s (u n)) = (⋂ r > a, s r),
{ apply subset.antisymm,
{ simp only [subset_Inter_iff, gt_iff_lt],
intros r rpos,
obtain ⟨n, hn⟩ : ∃ n, u n < r := ((tendsto_order.1 u_lim).2 _ rpos).exists,
exact subset.trans (Inter_subset _ n) (hm (u n) r (u_pos n) hn.le) },
{ simp only [subset_Inter_iff, gt_iff_lt],
intros n,
apply bInter_subset_of_mem,
exact u_pos n } },
rw B at A,
obtain ⟨n, hn⟩ : ∃ n, μ (s (u n)) < L := ((tendsto_order.1 A).2 _ hL).exists,
have : Ioc a (u n) ∈ 𝓝[>] a := Ioc_mem_nhds_within_Ioi ⟨le_rfl, u_pos n⟩,
filter_upwards [this] with r hr using lt_of_le_of_lt (measure_mono (hm _ _ hr.1 hr.2)) hn,
end
/-- One direction of the **Borel-Cantelli lemma**: if (sᵢ) is a sequence of sets such
that `∑ μ sᵢ` is finite, then the limit superior of the `sᵢ` is a null set. -/
lemma measure_limsup_eq_zero {s : ℕ → set α} (hs : ∑' i, μ (s i) ≠ ∞) : μ (limsup s at_top) = 0 :=
begin
-- First we replace the sequence `sₙ` with a sequence of measurable sets `tₙ ⊇ sₙ` of the same
-- measure.
set t : ℕ → set α := λ n, to_measurable μ (s n),
have ht : ∑' i, μ (t i) ≠ ∞, by simpa only [t, measure_to_measurable] using hs,
suffices : μ (limsup t at_top) = 0,
{ have A : s ≤ t := λ n, subset_to_measurable μ (s n),
-- TODO default args fail
exact measure_mono_null (limsup_le_limsup (eventually_of_forall (pi.le_def.mp A))
is_cobounded_le_of_bot is_bounded_le_of_top) this },
-- Next we unfold `limsup` for sets and replace equality with an inequality
simp only [limsup_eq_infi_supr_of_nat', set.infi_eq_Inter, set.supr_eq_Union,
← nonpos_iff_eq_zero],
-- Finally, we estimate `μ (⋃ i, t (i + n))` by `∑ i', μ (t (i + n))`
refine le_of_tendsto_of_tendsto'
(tendsto_measure_Inter (λ i, measurable_set.Union (λ b, measurable_set_to_measurable _ _)) _
⟨0, ne_top_of_le_ne_top ht (measure_Union_le t)⟩)
(ennreal.tendsto_sum_nat_add (μ ∘ t) ht) (λ n, measure_Union_le _),
intros n m hnm x,
simp only [set.mem_Union],
exact λ ⟨i, hi⟩, ⟨i + (m - n), by simpa only [add_assoc, tsub_add_cancel_of_le hnm] using hi⟩
end
lemma measure_liminf_eq_zero {s : ℕ → set α} (h : ∑' i, μ (s i) ≠ ⊤) : μ (liminf s at_top) = 0 :=
begin
rw ← le_zero_iff,
have : liminf s at_top ≤ limsup s at_top :=
liminf_le_limsup (by is_bounded_default) (by is_bounded_default),
exact (μ.mono this).trans (by simp [measure_limsup_eq_zero h]),
end
lemma limsup_ae_eq_of_forall_ae_eq (s : ℕ → set α) {t : set α} (h : ∀ n, s n =ᵐ[μ] t) :
-- Need `@` below because of diamond; see gh issue #16932
@limsup (set α) ℕ _ s at_top =ᵐ[μ] t :=
begin
simp_rw ae_eq_set at h ⊢,
split,
{ rw at_top.limsup_sdiff s t,
apply measure_limsup_eq_zero,
simp [h], },
{ rw at_top.sdiff_limsup s t,
apply measure_liminf_eq_zero,
simp [h], },
end
lemma liminf_ae_eq_of_forall_ae_eq (s : ℕ → set α) {t : set α} (h : ∀ n, s n =ᵐ[μ] t) :
-- Need `@` below because of diamond; see gh issue #16932
@liminf (set α) ℕ _ s at_top =ᵐ[μ] t :=
begin
simp_rw ae_eq_set at h ⊢,
split,
{ rw at_top.liminf_sdiff s t,
apply measure_liminf_eq_zero,
simp [h], },
{ rw at_top.sdiff_liminf s t,
apply measure_limsup_eq_zero,
simp [h], },
end
lemma measure_if {x : β} {t : set β} {s : set α} :
μ (if x ∈ t then s else ∅) = indicator t (λ _, μ s) x :=
by { split_ifs; simp [h] }
end
section outer_measure
variables [ms : measurable_space α] {s t : set α}
include ms
/-- Obtain a measure by giving an outer measure where all sets in the σ-algebra are
Carathéodory measurable. -/
def outer_measure.to_measure (m : outer_measure α) (h : ms ≤ m.caratheodory) : measure α :=
measure.of_measurable (λ s _, m s) m.empty
(λ f hf hd, m.Union_eq_of_caratheodory (λ i, h _ (hf i)) hd)
lemma le_to_outer_measure_caratheodory (μ : measure α) : ms ≤ μ.to_outer_measure.caratheodory :=
λ s hs t, (measure_inter_add_diff _ hs).symm
@[simp] lemma to_measure_to_outer_measure (m : outer_measure α) (h : ms ≤ m.caratheodory) :
(m.to_measure h).to_outer_measure = m.trim := rfl
@[simp] lemma to_measure_apply (m : outer_measure α) (h : ms ≤ m.caratheodory)
{s : set α} (hs : measurable_set s) : m.to_measure h s = m s :=
m.trim_eq hs
lemma le_to_measure_apply (m : outer_measure α) (h : ms ≤ m.caratheodory) (s : set α) :
m s ≤ m.to_measure h s :=
m.le_trim s
lemma to_measure_apply₀ (m : outer_measure α) (h : ms ≤ m.caratheodory)
{s : set α} (hs : null_measurable_set s (m.to_measure h)) : m.to_measure h s = m s :=
begin
refine le_antisymm _ (le_to_measure_apply _ _ _),
rcases hs.exists_measurable_subset_ae_eq with ⟨t, hts, htm, heq⟩,
calc m.to_measure h s = m.to_measure h t : measure_congr heq.symm
... = m t : to_measure_apply m h htm
... ≤ m s : m.mono hts
end
@[simp] lemma to_outer_measure_to_measure {μ : measure α} :
μ.to_outer_measure.to_measure (le_to_outer_measure_caratheodory _) = μ :=
measure.ext $ λ s, μ.to_outer_measure.trim_eq
@[simp] lemma bounded_by_measure (μ : measure α) :
outer_measure.bounded_by μ = μ.to_outer_measure :=
μ.to_outer_measure.bounded_by_eq_self
end outer_measure
variables {m0 : measurable_space α} [measurable_space β] [measurable_space γ]
variables {μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : measure α} {s s' t : set α}
namespace measure
/-- If `u` is a superset of `t` with the same (finite) measure (both sets possibly non-measurable),
then for any measurable set `s` one also has `μ (t ∩ s) = μ (u ∩ s)`. -/
lemma measure_inter_eq_of_measure_eq {s t u : set α} (hs : measurable_set s)
(h : μ t = μ u) (htu : t ⊆ u) (ht_ne_top : μ t ≠ ∞) :
μ (t ∩ s) = μ (u ∩ s) :=
begin
rw h at ht_ne_top,
refine le_antisymm (measure_mono (inter_subset_inter_left _ htu)) _,
have A : μ (u ∩ s) + μ (u \ s) ≤ μ (t ∩ s) + μ (u \ s) := calc
μ (u ∩ s) + μ (u \ s) = μ u : measure_inter_add_diff _ hs
... = μ t : h.symm
... = μ (t ∩ s) + μ (t \ s) : (measure_inter_add_diff _ hs).symm
... ≤ μ (t ∩ s) + μ (u \ s) :
add_le_add le_rfl (measure_mono (diff_subset_diff htu subset.rfl)),
have B : μ (u \ s) ≠ ∞ := (lt_of_le_of_lt (measure_mono (diff_subset _ _)) ht_ne_top.lt_top).ne,
exact ennreal.le_of_add_le_add_right B A
end
/-- The measurable superset `to_measurable μ t` of `t` (which has the same measure as `t`)
satisfies, for any measurable set `s`, the equality `μ (to_measurable μ t ∩ s) = μ (u ∩ s)`.
Here, we require that the measure of `t` is finite. The conclusion holds without this assumption
when the measure is sigma_finite, see `measure_to_measurable_inter_of_sigma_finite`. -/
lemma measure_to_measurable_inter {s t : set α} (hs : measurable_set s) (ht : μ t ≠ ∞) :
μ (to_measurable μ t ∩ s) = μ (t ∩ s) :=
(measure_inter_eq_of_measure_eq hs (measure_to_measurable t).symm
(subset_to_measurable μ t) ht).symm
/-! ### The `ℝ≥0∞`-module of measures -/
instance [measurable_space α] : has_zero (measure α) :=
⟨{ to_outer_measure := 0,
m_Union := λ f hf hd, tsum_zero.symm,
trimmed := outer_measure.trim_zero }⟩
@[simp] theorem zero_to_outer_measure {m : measurable_space α} :
(0 : measure α).to_outer_measure = 0 := rfl
@[simp, norm_cast] theorem coe_zero {m : measurable_space α} : ⇑(0 : measure α) = 0 := rfl
lemma eq_zero_of_is_empty [is_empty α] {m : measurable_space α} (μ : measure α) : μ = 0 :=
ext $ λ s hs, by simp only [eq_empty_of_is_empty s, measure_empty]
instance [measurable_space α] : inhabited (measure α) := ⟨0⟩
instance [measurable_space α] : has_add (measure α) :=
⟨λ μ₁ μ₂,
{ to_outer_measure := μ₁.to_outer_measure + μ₂.to_outer_measure,
m_Union := λ s hs hd,
show μ₁ (⋃ i, s i) + μ₂ (⋃ i, s i) = ∑' i, (μ₁ (s i) + μ₂ (s i)),
by rw [ennreal.tsum_add, measure_Union hd hs, measure_Union hd hs],
trimmed := by rw [outer_measure.trim_add, μ₁.trimmed, μ₂.trimmed] }⟩
@[simp] theorem add_to_outer_measure {m : measurable_space α} (μ₁ μ₂ : measure α) :
(μ₁ + μ₂).to_outer_measure = μ₁.to_outer_measure + μ₂.to_outer_measure := rfl
@[simp, norm_cast] theorem coe_add {m : measurable_space α} (μ₁ μ₂ : measure α) :
⇑(μ₁ + μ₂) = μ₁ + μ₂ := rfl
theorem add_apply {m : measurable_space α} (μ₁ μ₂ : measure α) (s : set α) :
(μ₁ + μ₂) s = μ₁ s + μ₂ s := rfl
section has_smul
variables [has_smul R ℝ≥0∞] [is_scalar_tower R ℝ≥0∞ ℝ≥0∞]
variables [has_smul R' ℝ≥0∞] [is_scalar_tower R' ℝ≥0∞ ℝ≥0∞]
instance [measurable_space α] : has_smul R (measure α) :=
⟨λ c μ,
{ to_outer_measure := c • μ.to_outer_measure,
m_Union := λ s hs hd, begin
rw ←smul_one_smul ℝ≥0∞ c (_ : outer_measure α),
dsimp,
simp_rw [measure_Union hd hs, ennreal.tsum_mul_left],
end,
trimmed := by rw [outer_measure.trim_smul, μ.trimmed] }⟩
@[simp] theorem smul_to_outer_measure {m : measurable_space α} (c : R) (μ : measure α) :
(c • μ).to_outer_measure = c • μ.to_outer_measure :=
rfl
@[simp, norm_cast] theorem coe_smul {m : measurable_space α} (c : R) (μ : measure α) :
⇑(c • μ) = c • μ :=
rfl
@[simp] theorem smul_apply {m : measurable_space α} (c : R) (μ : measure α) (s : set α) :
(c • μ) s = c • μ s :=
rfl
instance [smul_comm_class R R' ℝ≥0∞] [measurable_space α] :
smul_comm_class R R' (measure α) :=
⟨λ _ _ _, ext $ λ _ _, smul_comm _ _ _⟩
instance [has_smul R R'] [is_scalar_tower R R' ℝ≥0∞] [measurable_space α] :
is_scalar_tower R R' (measure α) :=
⟨λ _ _ _, ext $ λ _ _, smul_assoc _ _ _⟩
instance [has_smul Rᵐᵒᵖ ℝ≥0∞] [is_central_scalar R ℝ≥0∞] [measurable_space α] :
is_central_scalar R (measure α) :=
⟨λ _ _, ext $ λ _ _, op_smul_eq_smul _ _⟩
end has_smul
instance [monoid R] [mul_action R ℝ≥0∞] [is_scalar_tower R ℝ≥0∞ ℝ≥0∞] [measurable_space α] :
mul_action R (measure α) :=
injective.mul_action _ to_outer_measure_injective smul_to_outer_measure
instance add_comm_monoid [measurable_space α] : add_comm_monoid (measure α) :=
to_outer_measure_injective.add_comm_monoid to_outer_measure zero_to_outer_measure
add_to_outer_measure (λ _ _, smul_to_outer_measure _ _)
/-- Coercion to function as an additive monoid homomorphism. -/
def coe_add_hom {m : measurable_space α} : measure α →+ (set α → ℝ≥0∞) :=
⟨coe_fn, coe_zero, coe_add⟩
@[simp] lemma coe_finset_sum {m : measurable_space α} (I : finset ι) (μ : ι → measure α) :
⇑(∑ i in I, μ i) = ∑ i in I, μ i :=
(@coe_add_hom α m).map_sum _ _
theorem finset_sum_apply {m : measurable_space α} (I : finset ι) (μ : ι → measure α) (s : set α) :
(∑ i in I, μ i) s = ∑ i in I, μ i s :=
by rw [coe_finset_sum, finset.sum_apply]
instance [monoid R] [distrib_mul_action R ℝ≥0∞] [is_scalar_tower R ℝ≥0∞ ℝ≥0∞]
[measurable_space α] :
distrib_mul_action R (measure α) :=
injective.distrib_mul_action ⟨to_outer_measure, zero_to_outer_measure, add_to_outer_measure⟩
to_outer_measure_injective smul_to_outer_measure
instance [semiring R] [module R ℝ≥0∞] [is_scalar_tower R ℝ≥0∞ ℝ≥0∞] [measurable_space α] :
module R (measure α) :=
injective.module R ⟨to_outer_measure, zero_to_outer_measure, add_to_outer_measure⟩
to_outer_measure_injective smul_to_outer_measure
@[simp] theorem coe_nnreal_smul_apply {m : measurable_space α} (c : ℝ≥0) (μ : measure α)
(s : set α) :
(c • μ) s = c * μ s :=
rfl
lemma ae_smul_measure_iff {p : α → Prop} {c : ℝ≥0∞} (hc : c ≠ 0) :
(∀ᵐ x ∂(c • μ), p x) ↔ ∀ᵐ x ∂μ, p x :=
by simp [ae_iff, hc]
lemma measure_eq_left_of_subset_of_measure_add_eq {s t : set α}
(h : (μ + ν) t ≠ ∞) (h' : s ⊆ t) (h'' : (μ + ν) s = (μ + ν) t) :
μ s = μ t :=
begin
refine le_antisymm (measure_mono h') _,
have : μ t + ν t ≤ μ s + ν t := calc
μ t + ν t = μ s + ν s : h''.symm
... ≤ μ s + ν t : add_le_add le_rfl (measure_mono h'),
apply ennreal.le_of_add_le_add_right _ this,
simp only [not_or_distrib, ennreal.add_eq_top, pi.add_apply, ne.def, coe_add] at h,
exact h.2
end
lemma measure_eq_right_of_subset_of_measure_add_eq {s t : set α}
(h : (μ + ν) t ≠ ∞) (h' : s ⊆ t) (h'' : (μ + ν) s = (μ + ν) t) :
ν s = ν t :=
begin
rw add_comm at h'' h,
exact measure_eq_left_of_subset_of_measure_add_eq h h' h''
end
lemma measure_to_measurable_add_inter_left {s t : set α}
(hs : measurable_set s) (ht : (μ + ν) t ≠ ∞) :
μ (to_measurable (μ + ν) t ∩ s) = μ (t ∩ s) :=
begin
refine (measure_inter_eq_of_measure_eq hs _ (subset_to_measurable _ _) _).symm,
{ refine measure_eq_left_of_subset_of_measure_add_eq _ (subset_to_measurable _ _)
(measure_to_measurable t).symm,
rwa measure_to_measurable t, },
{ simp only [not_or_distrib, ennreal.add_eq_top, pi.add_apply, ne.def, coe_add] at ht,
exact ht.1 }
end
lemma measure_to_measurable_add_inter_right {s t : set α}
(hs : measurable_set s) (ht : (μ + ν) t ≠ ∞) :
ν (to_measurable (μ + ν) t ∩ s) = ν (t ∩ s) :=
begin
rw add_comm at ht ⊢,
exact measure_to_measurable_add_inter_left hs ht
end
/-! ### The complete lattice of measures -/
/-- Measures are partially ordered.
The definition of less equal here is equivalent to the definition without the
measurable set condition, and this is shown by `measure.le_iff'`. It is defined
this way since, to prove `μ ≤ ν`, we may simply `intros s hs` instead of rewriting followed
by `intros s hs`. -/
instance [measurable_space α] : partial_order (measure α) :=
{ le := λ m₁ m₂, ∀ s, measurable_set s → m₁ s ≤ m₂ s,
le_refl := λ m s hs, le_rfl,
le_trans := λ m₁ m₂ m₃ h₁ h₂ s hs, le_trans (h₁ s hs) (h₂ s hs),
le_antisymm := λ m₁ m₂ h₁ h₂, ext $
λ s hs, le_antisymm (h₁ s hs) (h₂ s hs) }
theorem le_iff : μ₁ ≤ μ₂ ↔ ∀ s, measurable_set s → μ₁ s ≤ μ₂ s := iff.rfl
theorem to_outer_measure_le : μ₁.to_outer_measure ≤ μ₂.to_outer_measure ↔ μ₁ ≤ μ₂ :=
by rw [← μ₂.trimmed, outer_measure.le_trim_iff]; refl
theorem le_iff' : μ₁ ≤ μ₂ ↔ ∀ s, μ₁ s ≤ μ₂ s :=
to_outer_measure_le.symm
theorem lt_iff : μ < ν ↔ μ ≤ ν ∧ ∃ s, measurable_set s ∧ μ s < ν s :=
lt_iff_le_not_le.trans $ and_congr iff.rfl $ by simp only [le_iff, not_forall, not_le, exists_prop]
theorem lt_iff' : μ < ν ↔ μ ≤ ν ∧ ∃ s, μ s < ν s :=
lt_iff_le_not_le.trans $ and_congr iff.rfl $ by simp only [le_iff', not_forall, not_le]
instance covariant_add_le [measurable_space α] : covariant_class (measure α) (measure α) (+) (≤) :=
⟨λ ν μ₁ μ₂ hμ s hs, add_le_add_left (hμ s hs) _⟩
protected lemma le_add_left (h : μ ≤ ν) : μ ≤ ν' + ν :=
λ s hs, le_add_left (h s hs)
protected lemma le_add_right (h : μ ≤ ν) : μ ≤ ν + ν' :=
λ s hs, le_add_right (h s hs)
section Inf
variables {m : set (measure α)}
lemma Inf_caratheodory (s : set α) (hs : measurable_set s) :
measurable_set[(Inf (to_outer_measure '' m)).caratheodory] s :=
begin
rw [outer_measure.Inf_eq_bounded_by_Inf_gen],
refine outer_measure.bounded_by_caratheodory (λ t, _),
simp only [outer_measure.Inf_gen, le_infi_iff, ball_image_iff, coe_to_outer_measure,
measure_eq_infi t],
intros μ hμ u htu hu,
have hm : ∀ {s t}, s ⊆ t → outer_measure.Inf_gen (to_outer_measure '' m) s ≤ μ t,
{ intros s t hst,
rw [outer_measure.Inf_gen_def],
refine infi_le_of_le (μ.to_outer_measure) (infi_le_of_le (mem_image_of_mem _ hμ) _),
rw [to_outer_measure_apply],
refine measure_mono hst },
rw [← measure_inter_add_diff u hs],
refine add_le_add (hm $ inter_subset_inter_left _ htu) (hm $ diff_subset_diff_left htu)
end
instance [measurable_space α] : has_Inf (measure α) :=
⟨λ m, (Inf (to_outer_measure '' m)).to_measure $ Inf_caratheodory⟩
lemma Inf_apply (hs : measurable_set s) : Inf m s = Inf (to_outer_measure '' m) s :=
to_measure_apply _ _ hs
private lemma measure_Inf_le (h : μ ∈ m) : Inf m ≤ μ :=
have Inf (to_outer_measure '' m) ≤ μ.to_outer_measure := Inf_le (mem_image_of_mem _ h),
λ s hs, by rw [Inf_apply hs, ← to_outer_measure_apply]; exact this s
private lemma measure_le_Inf (h : ∀ μ' ∈ m, μ ≤ μ') : μ ≤ Inf m :=
have μ.to_outer_measure ≤ Inf (to_outer_measure '' m) :=
le_Inf $ ball_image_of_ball $ λ μ hμ, to_outer_measure_le.2 $ h _ hμ,
λ s hs, by rw [Inf_apply hs, ← to_outer_measure_apply]; exact this s
instance [measurable_space α] : complete_semilattice_Inf (measure α) :=
{ Inf_le := λ s a, measure_Inf_le,
le_Inf := λ s a, measure_le_Inf,
..(by apply_instance : partial_order (measure α)),
..(by apply_instance : has_Inf (measure α)), }
instance [measurable_space α] : complete_lattice (measure α) :=
{ bot := 0,
bot_le := λ a s hs, by exact bot_le,
/- Adding an explicit `top` makes `leanchecker` fail, see lean#364, disable for now
top := (⊤ : outer_measure α).to_measure (by rw [outer_measure.top_caratheodory]; exact le_top),
le_top := λ a s hs,
by cases s.eq_empty_or_nonempty with h h;
simp [h, to_measure_apply ⊤ _ hs, outer_measure.top_apply],
-/
.. complete_lattice_of_complete_semilattice_Inf (measure α) }
end Inf
@[simp] lemma top_add : ⊤ + μ = ⊤ := top_unique $ measure.le_add_right le_rfl
@[simp] lemma add_top : μ + ⊤ = ⊤ := top_unique $ measure.le_add_left le_rfl
protected lemma zero_le {m0 : measurable_space α} (μ : measure α) : 0 ≤ μ := bot_le
lemma nonpos_iff_eq_zero' : μ ≤ 0 ↔ μ = 0 :=
μ.zero_le.le_iff_eq
@[simp] lemma measure_univ_eq_zero : μ univ = 0 ↔ μ = 0 :=
⟨λ h, bot_unique $ λ s hs, trans_rel_left (≤) (measure_mono (subset_univ s)) h, λ h, h.symm ▸ rfl⟩
/-! ### Pushforward and pullback -/
/-- Lift a linear map between `outer_measure` spaces such that for each measure `μ` every measurable
set is caratheodory-measurable w.r.t. `f μ` to a linear map between `measure` spaces. -/
def lift_linear {m0 : measurable_space α} (f : outer_measure α →ₗ[ℝ≥0∞] outer_measure β)
(hf : ∀ μ : measure α, ‹_› ≤ (f μ.to_outer_measure).caratheodory) :
measure α →ₗ[ℝ≥0∞] measure β :=
{ to_fun := λ μ, (f μ.to_outer_measure).to_measure (hf μ),
map_add' := λ μ₁ μ₂, ext $ λ s hs, by simp [hs],
map_smul' := λ c μ, ext $ λ s hs, by simp [hs] }
@[simp] lemma lift_linear_apply {f : outer_measure α →ₗ[ℝ≥0∞] outer_measure β} (hf)
{s : set β} (hs : measurable_set s) : lift_linear f hf μ s = f μ.to_outer_measure s :=
to_measure_apply _ _ hs
lemma le_lift_linear_apply {f : outer_measure α →ₗ[ℝ≥0∞] outer_measure β} (hf) (s : set β) :
f μ.to_outer_measure s ≤ lift_linear f hf μ s :=
le_to_measure_apply _ _ s
/-- The pushforward of a measure as a linear map. It is defined to be `0` if `f` is not
a measurable function. -/
def mapₗ [measurable_space α] (f : α → β) : measure α →ₗ[ℝ≥0∞] measure β :=
if hf : measurable f then
lift_linear (outer_measure.map f) $ λ μ s hs t,
le_to_outer_measure_caratheodory μ _ (hf hs) (f ⁻¹' t)
else 0
lemma mapₗ_congr {f g : α → β} (hf : measurable f) (hg : measurable g) (h : f =ᵐ[μ] g) :
mapₗ f μ = mapₗ g μ :=
begin
ext1 s hs,
simpa only [mapₗ, hf, hg, hs, dif_pos, lift_linear_apply, outer_measure.map_apply,
coe_to_outer_measure] using measure_congr (h.preimage s),
end
/-- The pushforward of a measure. It is defined to be `0` if `f` is not an almost everywhere
measurable function. -/
@[irreducible] def map [measurable_space α] (f : α → β) (μ : measure α) : measure β :=
if hf : ae_measurable f μ then mapₗ (hf.mk f) μ else 0
include m0
lemma mapₗ_mk_apply_of_ae_measurable {f : α → β} (hf : ae_measurable f μ) :
mapₗ (hf.mk f) μ = map f μ :=
by simp [map, hf]
lemma mapₗ_apply_of_measurable {f : α → β} (hf : measurable f) (μ : measure α) :
mapₗ f μ = map f μ :=
begin
simp only [← mapₗ_mk_apply_of_ae_measurable hf.ae_measurable],
exact mapₗ_congr hf hf.ae_measurable.measurable_mk hf.ae_measurable.ae_eq_mk
end
@[simp] lemma map_add (μ ν : measure α) {f : α → β} (hf : measurable f) :
(μ + ν).map f = μ.map f + ν.map f :=
by simp [← mapₗ_apply_of_measurable hf]
@[simp] lemma map_zero (f : α → β) :
(0 : measure α).map f = 0 :=
begin
by_cases hf : ae_measurable f (0 : measure α);
simp [map, hf],
end
theorem map_of_not_ae_measurable {f : α → β} {μ : measure α} (hf : ¬ ae_measurable f μ) :
μ.map f = 0 :=
by simp [map, hf]
lemma map_congr {f g : α → β} (h : f =ᵐ[μ] g) : measure.map f μ = measure.map g μ :=
begin
by_cases hf : ae_measurable f μ,
{ have hg : ae_measurable g μ := hf.congr h,
simp only [← mapₗ_mk_apply_of_ae_measurable hf, ← mapₗ_mk_apply_of_ae_measurable hg],