-
Notifications
You must be signed in to change notification settings - Fork 298
/
prod.lean
1019 lines (874 loc) · 50.7 KB
/
prod.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) 2020 Floris van Doorn. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Floris van Doorn
-/
import measure_theory.measure.giry_monad
import dynamics.ergodic.measure_preserving
import measure_theory.integral.set_integral
/-!
# The product measure
In this file we define and prove properties about the binary product measure. If `α` and `β` have
σ-finite measures `μ` resp. `ν` then `α × β` can be equipped with a σ-finite measure `μ.prod ν` that
satisfies `(μ.prod ν) s = ∫⁻ x, ν {y | (x, y) ∈ s} ∂μ`.
We also have `(μ.prod ν) (s ×ˢ t) = μ s * ν t`, i.e. the measure of a rectangle is the product of
the measures of the sides.
We also prove Tonelli's theorem and Fubini's theorem.
## Main definition
* `measure_theory.measure.prod`: The product of two measures.
## Main results
* `measure_theory.measure.prod_apply` states `μ.prod ν s = ∫⁻ x, ν {y | (x, y) ∈ s} ∂μ`
for measurable `s`. `measure_theory.measure.prod_apply_symm` is the reversed version.
* `measure_theory.measure.prod_prod` states `μ.prod ν (s ×ˢ t) = μ s * ν t` for measurable sets
`s` and `t`.
* `measure_theory.lintegral_prod`: Tonelli's theorem. It states that for a measurable function
`α × β → ℝ≥0∞` we have `∫⁻ z, f z ∂(μ.prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ`. The version
for functions `α → β → ℝ≥0∞` is reversed, and called `lintegral_lintegral`. Both versions have
a variant with `_symm` appended, where the order of integration is reversed.
The lemma `measurable.lintegral_prod_right'` states that the inner integral of the right-hand side
is measurable.
* `measure_theory.integrable_prod_iff` states that a binary function is integrable iff both
* `y ↦ f (x, y)` is integrable for almost every `x`, and
* the function `x ↦ ∫ ∥f (x, y)∥ dy` is integrable.
* `measure_theory.integral_prod`: Fubini's theorem. It states that for a integrable function
`α × β → E` (where `E` is a second countable Banach space) we have
`∫ z, f z ∂(μ.prod ν) = ∫ x, ∫ y, f (x, y) ∂ν ∂μ`. This theorem has the same variants as
Tonelli's theorem. The lemma `measure_theory.integrable.integral_prod_right` states that the
inner integral of the right-hand side is integrable.
## Implementation Notes
Many results are proven twice, once for functions in curried form (`α → β → γ`) and one for
functions in uncurried form (`α × β → γ`). The former often has an assumption
`measurable (uncurry f)`, which could be inconvenient to discharge, but for the latter it is more
common that the function has to be given explicitly, since Lean cannot synthesize the function by
itself. We name the lemmas about the uncurried form with a prime.
Tonelli's theorem and Fubini's theorem have a different naming scheme, since the version for the
uncurried version is reversed.
## Tags
product measure, Fubini's theorem, Tonelli's theorem, Fubini-Tonelli theorem
-/
noncomputable theory
open_locale classical topological_space ennreal measure_theory
open set function real ennreal
open measure_theory measurable_space measure_theory.measure
open topological_space (hiding generate_from)
open filter (hiding prod_eq map)
variables {α α' β β' γ E : Type*}
/-- Rectangles formed by π-systems form a π-system. -/
lemma is_pi_system.prod {C : set (set α)} {D : set (set β)} (hC : is_pi_system C)
(hD : is_pi_system D) : is_pi_system (image2 (×ˢ) C D) :=
begin
rintro _ ⟨s₁, t₁, hs₁, ht₁, rfl⟩ _ ⟨s₂, t₂, hs₂, ht₂, rfl⟩ hst,
rw [prod_inter_prod] at hst ⊢, rw [prod_nonempty_iff] at hst,
exact mem_image2_of_mem (hC _ hs₁ _ hs₂ hst.1) (hD _ ht₁ _ ht₂ hst.2)
end
/-- Rectangles of countably spanning sets are countably spanning. -/
lemma is_countably_spanning.prod {C : set (set α)} {D : set (set β)}
(hC : is_countably_spanning C) (hD : is_countably_spanning D) :
is_countably_spanning (image2 (×ˢ) C D) :=
begin
rcases ⟨hC, hD⟩ with ⟨⟨s, h1s, h2s⟩, t, h1t, h2t⟩,
refine ⟨λ n, (s n.unpair.1) ×ˢ (t n.unpair.2), λ n, mem_image2_of_mem (h1s _) (h1t _), _⟩,
rw [Union_unpair_prod, h2s, h2t, univ_prod_univ]
end
variables [measurable_space α] [measurable_space α'] [measurable_space β] [measurable_space β']
variables [measurable_space γ]
variables {μ : measure α} {ν : measure β} {τ : measure γ}
variables [normed_group E]
/-! ### Measurability
Before we define the product measure, we can talk about the measurability of operations on binary
functions. We show that if `f` is a binary measurable function, then the function that integrates
along one of the variables (using either the Lebesgue or Bochner integral) is measurable.
-/
/-- The product of generated σ-algebras is the one generated by rectangles, if both generating sets
are countably spanning. -/
lemma generate_from_prod_eq {α β} {C : set (set α)} {D : set (set β)}
(hC : is_countably_spanning C) (hD : is_countably_spanning D) :
@prod.measurable_space _ _ (generate_from C) (generate_from D) =
generate_from (image2 (×ˢ) C D) :=
begin
apply le_antisymm,
{ refine sup_le _ _; rw [comap_generate_from];
apply generate_from_le; rintro _ ⟨s, hs, rfl⟩,
{ rcases hD with ⟨t, h1t, h2t⟩,
rw [← prod_univ, ← h2t, prod_Union],
apply measurable_set.Union,
intro n, apply measurable_set_generate_from,
exact ⟨s, t n, hs, h1t n, rfl⟩ },
{ rcases hC with ⟨t, h1t, h2t⟩,
rw [← univ_prod, ← h2t, Union_prod_const],
apply measurable_set.Union,
rintro n, apply measurable_set_generate_from,
exact mem_image2_of_mem (h1t n) hs } },
{ apply generate_from_le, rintro _ ⟨s, t, hs, ht, rfl⟩, rw [prod_eq],
apply (measurable_fst _).inter (measurable_snd _),
{ exact measurable_set_generate_from hs },
{ exact measurable_set_generate_from ht } }
end
/-- If `C` and `D` generate the σ-algebras on `α` resp. `β`, then rectangles formed by `C` and `D`
generate the σ-algebra on `α × β`. -/
lemma generate_from_eq_prod {C : set (set α)} {D : set (set β)} (hC : generate_from C = ‹_›)
(hD : generate_from D = ‹_›) (h2C : is_countably_spanning C) (h2D : is_countably_spanning D) :
generate_from (image2 (×ˢ) C D) = prod.measurable_space :=
by rw [← hC, ← hD, generate_from_prod_eq h2C h2D]
/-- The product σ-algebra is generated from boxes, i.e. `s ×ˢ t` for sets `s : set α` and
`t : set β`. -/
lemma generate_from_prod :
generate_from (image2 (×ˢ) {s : set α | measurable_set s} {t : set β | measurable_set t}) =
prod.measurable_space :=
generate_from_eq_prod generate_from_measurable_set generate_from_measurable_set
is_countably_spanning_measurable_set is_countably_spanning_measurable_set
/-- Rectangles form a π-system. -/
lemma is_pi_system_prod :
is_pi_system (image2 (×ˢ) {s : set α | measurable_set s} {t : set β | measurable_set t}) :=
is_pi_system_measurable_set.prod is_pi_system_measurable_set
/-- If `ν` is a finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is
a measurable function. `measurable_measure_prod_mk_left` is strictly more general. -/
lemma measurable_measure_prod_mk_left_finite [is_finite_measure ν] {s : set (α × β)}
(hs : measurable_set s) : measurable (λ x, ν (prod.mk x ⁻¹' s)) :=
begin
refine induction_on_inter generate_from_prod.symm is_pi_system_prod _ _ _ _ hs,
{ simp [measurable_zero, const_def] },
{ rintro _ ⟨s, t, hs, ht, rfl⟩, simp only [mk_preimage_prod_right_eq_if, measure_if],
exact measurable_const.indicator hs },
{ intros t ht h2t,
simp_rw [preimage_compl, measure_compl (measurable_prod_mk_left ht) (measure_ne_top ν _)],
exact h2t.const_sub _ },
{ intros f h1f h2f h3f, simp_rw [preimage_Union],
have : ∀ b, ν (⋃ i, prod.mk b ⁻¹' f i) = ∑' i, ν (prod.mk b ⁻¹' f i) :=
λ b, measure_Union (λ i j hij, disjoint.preimage _ (h1f i j hij))
(λ i, measurable_prod_mk_left (h2f i)),
simp_rw [this], apply measurable.ennreal_tsum h3f },
end
/-- If `ν` is a σ-finite measure, and `s ⊆ α × β` is measurable, then `x ↦ ν { y | (x, y) ∈ s }` is
a measurable function. -/
lemma measurable_measure_prod_mk_left [sigma_finite ν] {s : set (α × β)}
(hs : measurable_set s) : measurable (λ x, ν (prod.mk x ⁻¹' s)) :=
begin
have : ∀ x, measurable_set (prod.mk x ⁻¹' s) := λ x, measurable_prod_mk_left hs,
simp only [← @supr_restrict_spanning_sets _ _ ν, this],
apply measurable_supr, intro i,
haveI := fact.mk (measure_spanning_sets_lt_top ν i),
exact measurable_measure_prod_mk_left_finite hs
end
/-- If `μ` is a σ-finite measure, and `s ⊆ α × β` is measurable, then `y ↦ μ { x | (x, y) ∈ s }` is
a measurable function. -/
lemma measurable_measure_prod_mk_right {μ : measure α} [sigma_finite μ] {s : set (α × β)}
(hs : measurable_set s) : measurable (λ y, μ ((λ x, (x, y)) ⁻¹' s)) :=
measurable_measure_prod_mk_left (measurable_set_swap_iff.mpr hs)
lemma measurable.map_prod_mk_left [sigma_finite ν] : measurable (λ x : α, map (prod.mk x) ν) :=
begin
apply measurable_of_measurable_coe, intros s hs,
simp_rw [map_apply measurable_prod_mk_left hs],
exact measurable_measure_prod_mk_left hs
end
lemma measurable.map_prod_mk_right {μ : measure α} [sigma_finite μ] :
measurable (λ y : β, map (λ x : α, (x, y)) μ) :=
begin
apply measurable_of_measurable_coe, intros s hs,
simp_rw [map_apply measurable_prod_mk_right hs],
exact measurable_measure_prod_mk_right hs
end
/-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
Tonelli's theorem is measurable. -/
lemma measurable.lintegral_prod_right' [sigma_finite ν] :
∀ {f : α × β → ℝ≥0∞} (hf : measurable f), measurable (λ x, ∫⁻ y, f (x, y) ∂ν) :=
begin
have m := @measurable_prod_mk_left,
refine measurable.ennreal_induction _ _ _,
{ intros c s hs, simp only [← indicator_comp_right],
suffices : measurable (λ x, c * ν (prod.mk x ⁻¹' s)),
{ simpa [lintegral_indicator _ (m hs)] },
exact (measurable_measure_prod_mk_left hs).const_mul _ },
{ rintro f g - hf hg h2f h2g, simp_rw [pi.add_apply, lintegral_add (hf.comp m) (hg.comp m)],
exact h2f.add h2g },
{ intros f hf h2f h3f,
have := measurable_supr h3f,
have : ∀ x, monotone (λ n y, f n (x, y)) := λ x i j hij y, h2f hij (x, y),
simpa [lintegral_supr (λ n, (hf n).comp m), this] }
end
/-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
Tonelli's theorem is measurable.
This version has the argument `f` in curried form. -/
lemma measurable.lintegral_prod_right [sigma_finite ν] {f : α → β → ℝ≥0∞}
(hf : measurable (uncurry f)) : measurable (λ x, ∫⁻ y, f x y ∂ν) :=
hf.lintegral_prod_right'
/-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
the symmetric version of Tonelli's theorem is measurable. -/
lemma measurable.lintegral_prod_left' [sigma_finite μ] {f : α × β → ℝ≥0∞}
(hf : measurable f) : measurable (λ y, ∫⁻ x, f (x, y) ∂μ) :=
(measurable_swap_iff.mpr hf).lintegral_prod_right'
/-- The Lebesgue integral is measurable. This shows that the integrand of (the right-hand-side of)
the symmetric version of Tonelli's theorem is measurable.
This version has the argument `f` in curried form. -/
lemma measurable.lintegral_prod_left [sigma_finite μ] {f : α → β → ℝ≥0∞}
(hf : measurable (uncurry f)) : measurable (λ y, ∫⁻ x, f x y ∂μ) :=
hf.lintegral_prod_left'
lemma measurable_set_integrable [sigma_finite ν] ⦃f : α → β → E⦄
(hf : strongly_measurable (uncurry f)) : measurable_set {x | integrable (f x) ν} :=
begin
simp_rw [integrable, hf.of_uncurry_left.ae_strongly_measurable, true_and],
exact measurable_set_lt (measurable.lintegral_prod_right hf.ennnorm) measurable_const
end
section
variables [normed_space ℝ E] [complete_space E]
/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
Fubini's theorem is measurable.
This version has `f` in curried form. -/
lemma measure_theory.strongly_measurable.integral_prod_right [sigma_finite ν] ⦃f : α → β → E⦄
(hf : strongly_measurable (uncurry f)) : strongly_measurable (λ x, ∫ y, f x y ∂ν) :=
begin
borelize E,
haveI : separable_space (range (uncurry f) ∪ {0} : set E) :=
hf.separable_space_range_union_singleton,
let s : ℕ → simple_func (α × β) E := simple_func.approx_on _ hf.measurable
(range (uncurry f) ∪ {0}) 0 (by simp),
let s' : ℕ → α → simple_func β E := λ n x, (s n).comp (prod.mk x) measurable_prod_mk_left,
let f' : ℕ → α → E := λ n, {x | integrable (f x) ν}.indicator
(λ x, (s' n x).integral ν),
have hf' : ∀ n, strongly_measurable (f' n),
{ intro n, refine strongly_measurable.indicator _ (measurable_set_integrable hf),
have : ∀ x, (s' n x).range.filter (λ x, x ≠ 0) ⊆ (s n).range,
{ intros x, refine finset.subset.trans (finset.filter_subset _ _) _, intro y,
simp_rw [simple_func.mem_range], rintro ⟨z, rfl⟩, exact ⟨(x, z), rfl⟩ },
simp only [simple_func.integral_eq_sum_of_subset (this _)],
refine finset.strongly_measurable_sum _ (λ x _, _),
refine (measurable.ennreal_to_real _).strongly_measurable.smul_const _,
simp only [simple_func.coe_comp, preimage_comp] {single_pass := tt},
apply measurable_measure_prod_mk_left,
exact (s n).measurable_set_fiber x },
have h2f' : tendsto f' at_top (𝓝 (λ (x : α), ∫ (y : β), f x y ∂ν)),
{ rw [tendsto_pi_nhds], intro x,
by_cases hfx : integrable (f x) ν,
{ have : ∀ n, integrable (s' n x) ν,
{ intro n, apply (hfx.norm.add hfx.norm).mono' (s' n x).ae_strongly_measurable,
apply eventually_of_forall, intro y,
simp_rw [s', simple_func.coe_comp], exact simple_func.norm_approx_on_zero_le _ _ (x, y) n },
simp only [f', hfx, simple_func.integral_eq_integral _ (this _), indicator_of_mem,
mem_set_of_eq],
refine tendsto_integral_of_dominated_convergence (λ y, ∥f x y∥ + ∥f x y∥)
(λ n, (s' n x).ae_strongly_measurable) (hfx.norm.add hfx.norm) _ _,
{ exact λ n, eventually_of_forall (λ y, simple_func.norm_approx_on_zero_le _ _ (x, y) n) },
{ refine eventually_of_forall (λ y, simple_func.tendsto_approx_on _ _ _),
apply subset_closure,
simp [-uncurry_apply_pair], } },
{ simpa [f', hfx, integral_undef] using @tendsto_const_nhds _ _ _ (0 : E) _, } },
exact strongly_measurable_of_tendsto _ hf' h2f'
end
/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
Fubini's theorem is measurable. -/
lemma measure_theory.strongly_measurable.integral_prod_right' [sigma_finite ν] ⦃f : α × β → E⦄
(hf : strongly_measurable f) : strongly_measurable (λ x, ∫ y, f (x, y) ∂ν) :=
by { rw [← uncurry_curry f] at hf, exact hf.integral_prod_right }
/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
the symmetric version of Fubini's theorem is measurable.
This version has `f` in curried form. -/
lemma measure_theory.strongly_measurable.integral_prod_left [sigma_finite μ] ⦃f : α → β → E⦄
(hf : strongly_measurable (uncurry f)) : strongly_measurable (λ y, ∫ x, f x y ∂μ) :=
(hf.comp_measurable measurable_swap).integral_prod_right'
/-- The Bochner integral is measurable. This shows that the integrand of (the right-hand-side of)
the symmetric version of Fubini's theorem is measurable. -/
lemma measure_theory.strongly_measurable.integral_prod_left' [sigma_finite μ] ⦃f : α × β → E⦄
(hf : strongly_measurable f) : strongly_measurable (λ y, ∫ x, f (x, y) ∂μ) :=
(hf.comp_measurable measurable_swap).integral_prod_right'
end
/-! ### The product measure -/
namespace measure_theory
namespace measure
/-- The binary product of measures. They are defined for arbitrary measures, but we basically
prove all properties under the assumption that at least one of them is σ-finite. -/
@[irreducible] protected def prod (μ : measure α) (ν : measure β) : measure (α × β) :=
bind μ $ λ x : α, map (prod.mk x) ν
instance prod.measure_space {α β} [measure_space α] [measure_space β] : measure_space (α × β) :=
{ volume := volume.prod volume }
variables {μ ν} [sigma_finite ν]
lemma volume_eq_prod (α β) [measure_space α] [measure_space β] :
(volume : measure (α × β)) = (volume : measure α).prod (volume : measure β) :=
rfl
lemma prod_apply {s : set (α × β)} (hs : measurable_set s) :
μ.prod ν s = ∫⁻ x, ν (prod.mk x ⁻¹' s) ∂μ :=
by simp_rw [measure.prod, bind_apply hs measurable.map_prod_mk_left,
map_apply measurable_prod_mk_left hs]
/-- The product measure of the product of two sets is the product of their measures. Note that we
do not need the sets to be measurable. -/
@[simp] lemma prod_prod (s : set α) (t : set β) : μ.prod ν (s ×ˢ t) = μ s * ν t :=
begin
apply le_antisymm,
{ set ST := (to_measurable μ s) ×ˢ (to_measurable ν t),
have hSTm : measurable_set ST :=
(measurable_set_to_measurable _ _).prod (measurable_set_to_measurable _ _),
calc μ.prod ν (s ×ˢ t) ≤ μ.prod ν ST :
measure_mono $ set.prod_mono (subset_to_measurable _ _) (subset_to_measurable _ _)
... = μ (to_measurable μ s) * ν (to_measurable ν t) :
by simp_rw [prod_apply hSTm, mk_preimage_prod_right_eq_if, measure_if,
lintegral_indicator _ (measurable_set_to_measurable _ _), lintegral_const,
restrict_apply_univ, mul_comm]
... = μ s * ν t : by rw [measure_to_measurable, measure_to_measurable] },
{ /- Formalization is based on https://mathoverflow.net/a/254134/136589 -/
set ST := to_measurable (μ.prod ν) (s ×ˢ t),
have hSTm : measurable_set ST := measurable_set_to_measurable _ _,
have hST : s ×ˢ t ⊆ ST := subset_to_measurable _ _,
set f : α → ℝ≥0∞ := λ x, ν (prod.mk x ⁻¹' ST),
have hfm : measurable f := measurable_measure_prod_mk_left hSTm,
set s' : set α := {x | ν t ≤ f x},
have hss' : s ⊆ s' := λ x hx, measure_mono (λ y hy, hST $ mk_mem_prod hx hy),
calc μ s * ν t ≤ μ s' * ν t : mul_le_mul_right' (measure_mono hss') _
... = ∫⁻ x in s', ν t ∂μ : by rw [set_lintegral_const, mul_comm]
... ≤ ∫⁻ x in s', f x ∂μ : set_lintegral_mono measurable_const hfm (λ x, id)
... ≤ ∫⁻ x, f x ∂μ : lintegral_mono' restrict_le_self le_rfl
... = μ.prod ν ST : (prod_apply hSTm).symm
... = μ.prod ν (s ×ˢ t) : measure_to_measurable _ }
end
lemma ae_measure_lt_top {s : set (α × β)} (hs : measurable_set s)
(h2s : (μ.prod ν) s ≠ ∞) : ∀ᵐ x ∂μ, ν (prod.mk x ⁻¹' s) < ∞ :=
by { simp_rw [prod_apply hs] at h2s, refine ae_lt_top (measurable_measure_prod_mk_left hs) h2s }
lemma integrable_measure_prod_mk_left {s : set (α × β)}
(hs : measurable_set s) (h2s : (μ.prod ν) s ≠ ∞) :
integrable (λ x, (ν (prod.mk x ⁻¹' s)).to_real) μ :=
begin
refine ⟨(measurable_measure_prod_mk_left hs).ennreal_to_real.ae_measurable.ae_strongly_measurable,
_⟩,
simp_rw [has_finite_integral, ennnorm_eq_of_real to_real_nonneg],
convert h2s.lt_top using 1, simp_rw [prod_apply hs], apply lintegral_congr_ae,
refine (ae_measure_lt_top hs h2s).mp _, apply eventually_of_forall, intros x hx,
rw [lt_top_iff_ne_top] at hx, simp [of_real_to_real, hx],
end
/-- Note: the assumption `hs` cannot be dropped. For a counterexample, see
Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/
lemma measure_prod_null {s : set (α × β)}
(hs : measurable_set s) : μ.prod ν s = 0 ↔ (λ x, ν (prod.mk x ⁻¹' s)) =ᵐ[μ] 0 :=
by simp_rw [prod_apply hs, lintegral_eq_zero_iff (measurable_measure_prod_mk_left hs)]
/-- Note: the converse is not true without assuming that `s` is measurable. For a counterexample,
see Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/
lemma measure_ae_null_of_prod_null {s : set (α × β)}
(h : μ.prod ν s = 0) : (λ x, ν (prod.mk x ⁻¹' s)) =ᵐ[μ] 0 :=
begin
obtain ⟨t, hst, mt, ht⟩ := exists_measurable_superset_of_null h,
simp_rw [measure_prod_null mt] at ht,
rw [eventually_le_antisymm_iff],
exact ⟨eventually_le.trans_eq
(eventually_of_forall $ λ x, (measure_mono (preimage_mono hst) : _)) ht,
eventually_of_forall $ λ x, zero_le _⟩
end
/-- Note: the converse is not true. For a counterexample, see
Walter Rudin *Real and Complex Analysis*, example (c) in section 8.9. -/
lemma ae_ae_of_ae_prod {p : α × β → Prop} (h : ∀ᵐ z ∂μ.prod ν, p z) :
∀ᵐ x ∂ μ, ∀ᵐ y ∂ ν, p (x, y) :=
measure_ae_null_of_prod_null h
/-- `μ.prod ν` has finite spanning sets in rectangles of finite spanning sets. -/
noncomputable! def finite_spanning_sets_in.prod {ν : measure β} {C : set (set α)} {D : set (set β)}
(hμ : μ.finite_spanning_sets_in C) (hν : ν.finite_spanning_sets_in D) :
(μ.prod ν).finite_spanning_sets_in (image2 (×ˢ) C D) :=
begin
haveI := hν.sigma_finite,
refine ⟨λ n, hμ.set n.unpair.1 ×ˢ hν.set n.unpair.2,
λ n, mem_image2_of_mem (hμ.set_mem _) (hν.set_mem _), λ n, _, _⟩,
{ rw [prod_prod],
exact mul_lt_top (hμ.finite _).ne (hν.finite _).ne },
{ simp_rw [Union_unpair_prod, hμ.spanning, hν.spanning, univ_prod_univ] }
end
lemma prod_fst_absolutely_continuous : map prod.fst (μ.prod ν) ≪ μ :=
begin
refine absolutely_continuous.mk (λ s hs h2s, _),
rw [map_apply measurable_fst hs, ← prod_univ, prod_prod, h2s, zero_mul],
end
lemma prod_snd_absolutely_continuous : map prod.snd (μ.prod ν) ≪ ν :=
begin
refine absolutely_continuous.mk (λ s hs h2s, _),
rw [map_apply measurable_snd hs, ← univ_prod, prod_prod, h2s, mul_zero]
end
variables [sigma_finite μ]
instance prod.sigma_finite : sigma_finite (μ.prod ν) :=
(μ.to_finite_spanning_sets_in.prod ν.to_finite_spanning_sets_in).sigma_finite
/-- A measure on a product space equals the product measure if they are equal on rectangles
with as sides sets that generate the corresponding σ-algebras. -/
lemma prod_eq_generate_from {μ : measure α} {ν : measure β} {C : set (set α)}
{D : set (set β)} (hC : generate_from C = ‹_›)
(hD : generate_from D = ‹_›) (h2C : is_pi_system C) (h2D : is_pi_system D)
(h3C : μ.finite_spanning_sets_in C) (h3D : ν.finite_spanning_sets_in D)
{μν : measure (α × β)}
(h₁ : ∀ (s ∈ C) (t ∈ D), μν (s ×ˢ t) = μ s * ν t) : μ.prod ν = μν :=
begin
refine (h3C.prod h3D).ext
(generate_from_eq_prod hC hD h3C.is_countably_spanning h3D.is_countably_spanning).symm
(h2C.prod h2D) _,
{ rintro _ ⟨s, t, hs, ht, rfl⟩, haveI := h3D.sigma_finite,
rw [h₁ s hs t ht, prod_prod] }
end
/-- A measure on a product space equals the product measure if they are equal on rectangles. -/
lemma prod_eq {μν : measure (α × β)}
(h : ∀ s t, measurable_set s → measurable_set t → μν (s ×ˢ t) = μ s * ν t) : μ.prod ν = μν :=
prod_eq_generate_from generate_from_measurable_set generate_from_measurable_set
is_pi_system_measurable_set is_pi_system_measurable_set
μ.to_finite_spanning_sets_in ν.to_finite_spanning_sets_in (λ s hs t ht, h s t hs ht)
lemma prod_swap : map prod.swap (μ.prod ν) = ν.prod μ :=
begin
refine (prod_eq _).symm,
intros s t hs ht,
simp_rw [map_apply measurable_swap (hs.prod ht), preimage_swap_prod, prod_prod, mul_comm]
end
lemma prod_apply_symm {s : set (α × β)} (hs : measurable_set s) :
μ.prod ν s = ∫⁻ y, μ ((λ x, (x, y)) ⁻¹' s) ∂ν :=
by { rw [← prod_swap, map_apply measurable_swap hs],
simp only [prod_apply (measurable_swap hs)], refl }
lemma prod_assoc_prod [sigma_finite τ] :
map measurable_equiv.prod_assoc ((μ.prod ν).prod τ) = μ.prod (ν.prod τ) :=
begin
refine (prod_eq_generate_from generate_from_measurable_set generate_from_prod
is_pi_system_measurable_set is_pi_system_prod μ.to_finite_spanning_sets_in
(ν.to_finite_spanning_sets_in.prod τ.to_finite_spanning_sets_in) _).symm,
rintro s hs _ ⟨t, u, ht, hu, rfl⟩, rw [mem_set_of_eq] at hs ht hu,
simp_rw [map_apply (measurable_equiv.measurable _) (hs.prod (ht.prod hu)),
measurable_equiv.prod_assoc, measurable_equiv.coe_mk, equiv.prod_assoc_preimage,
prod_prod, mul_assoc]
end
/-! ### The product of specific measures -/
lemma prod_restrict (s : set α) (t : set β) :
(μ.restrict s).prod (ν.restrict t) = (μ.prod ν).restrict (s ×ˢ t) :=
begin
refine prod_eq (λ s' t' hs' ht', _),
rw [restrict_apply (hs'.prod ht'), prod_inter_prod, prod_prod, restrict_apply hs',
restrict_apply ht']
end
lemma restrict_prod_eq_prod_univ (s : set α) :
(μ.restrict s).prod ν = (μ.prod ν).restrict (s ×ˢ (univ : set β)) :=
begin
have : ν = ν.restrict set.univ := measure.restrict_univ.symm,
rwa [this, measure.prod_restrict, ← this],
end
lemma prod_dirac (y : β) : μ.prod (dirac y) = map (λ x, (x, y)) μ :=
begin
refine prod_eq (λ s t hs ht, _),
simp_rw [map_apply measurable_prod_mk_right (hs.prod ht), mk_preimage_prod_left_eq_if, measure_if,
dirac_apply' _ ht, ← indicator_mul_right _ (λ x, μ s), pi.one_apply, mul_one]
end
lemma dirac_prod (x : α) : (dirac x).prod ν = map (prod.mk x) ν :=
begin
refine prod_eq (λ s t hs ht, _),
simp_rw [map_apply measurable_prod_mk_left (hs.prod ht), mk_preimage_prod_right_eq_if, measure_if,
dirac_apply' _ hs, ← indicator_mul_left _ _ (λ x, ν t), pi.one_apply, one_mul]
end
lemma dirac_prod_dirac {x : α} {y : β} : (dirac x).prod (dirac y) = dirac (x, y) :=
by rw [prod_dirac, map_dirac measurable_prod_mk_right]
lemma prod_sum {ι : Type*} [fintype ι] (ν : ι → measure β) [∀ i, sigma_finite (ν i)] :
μ.prod (sum ν) = sum (λ i, μ.prod (ν i)) :=
begin
refine prod_eq (λ s t hs ht, _),
simp_rw [sum_apply _ (hs.prod ht), sum_apply _ ht, prod_prod, ennreal.tsum_mul_left]
end
lemma sum_prod {ι : Type*} [fintype ι] (μ : ι → measure α) [∀ i, sigma_finite (μ i)] :
(sum μ).prod ν = sum (λ i, (μ i).prod ν) :=
begin
refine prod_eq (λ s t hs ht, _),
simp_rw [sum_apply _ (hs.prod ht), sum_apply _ hs, prod_prod, ennreal.tsum_mul_right]
end
lemma prod_add (ν' : measure β) [sigma_finite ν'] : μ.prod (ν + ν') = μ.prod ν + μ.prod ν' :=
by { refine prod_eq (λ s t hs ht, _), simp_rw [add_apply, prod_prod, left_distrib] }
lemma add_prod (μ' : measure α) [sigma_finite μ'] : (μ + μ').prod ν = μ.prod ν + μ'.prod ν :=
by { refine prod_eq (λ s t hs ht, _), simp_rw [add_apply, prod_prod, right_distrib] }
@[simp] lemma zero_prod (ν : measure β) : (0 : measure α).prod ν = 0 :=
by { rw measure.prod, exact bind_zero_left _ }
@[simp] lemma prod_zero (μ : measure α) : μ.prod (0 : measure β) = 0 :=
by simp [measure.prod]
lemma map_prod_map {δ} [measurable_space δ] {f : α → β} {g : γ → δ}
{μa : measure α} {μc : measure γ} (hfa : sigma_finite (map f μa))
(hgc : sigma_finite (map g μc)) (hf : measurable f) (hg : measurable g) :
(map f μa).prod (map g μc) = map (prod.map f g) (μa.prod μc) :=
begin
haveI := hgc.of_map μc hg.ae_measurable,
refine prod_eq (λ s t hs ht, _),
rw [map_apply (hf.prod_map hg) (hs.prod ht), map_apply hf hs, map_apply hg ht],
exact prod_prod (f ⁻¹' s) (g ⁻¹' t)
end
end measure
open measure
namespace measure_preserving
variables {δ : Type*} [measurable_space δ] {μa : measure α} {μb : measure β}
{μc : measure γ} {μd : measure δ}
lemma skew_product [sigma_finite μb] [sigma_finite μd]
{f : α → β} (hf : measure_preserving f μa μb) {g : α → γ → δ}
(hgm : measurable (uncurry g)) (hg : ∀ᵐ x ∂μa, map (g x) μc = μd) :
measure_preserving (λ p : α × γ, (f p.1, g p.1 p.2)) (μa.prod μc) (μb.prod μd) :=
begin
classical,
have : measurable (λ p : α × γ, (f p.1, g p.1 p.2)) := (hf.1.comp measurable_fst).prod_mk hgm,
/- if `μa = 0`, then the lemma is trivial, otherwise we can use `hg`
to deduce `sigma_finite μc`. -/
rcases eq_or_ne μa 0 with (rfl|ha),
{ rw [← hf.map_eq, zero_prod, measure.map_zero, zero_prod],
exact ⟨this, by simp only [measure.map_zero]⟩ },
haveI : sigma_finite μc,
{ rcases (ae_ne_bot.2 ha).nonempty_of_mem hg with ⟨x, hx : map (g x) μc = μd⟩,
exact sigma_finite.of_map _ hgm.of_uncurry_left.ae_measurable (by rwa hx) },
-- Thus we can apply `measure.prod_eq` to prove equality of measures.
refine ⟨this, (prod_eq $ λ s t hs ht, _).symm⟩,
rw [map_apply this (hs.prod ht)],
refine (prod_apply (this $ hs.prod ht)).trans _,
have : ∀ᵐ x ∂μa, μc ((λ y, (f x, g x y)) ⁻¹' s ×ˢ t) = indicator (f ⁻¹' s) (λ y, μd t) x,
{ refine hg.mono (λ x hx, _), unfreezingI { subst hx },
simp only [mk_preimage_prod_right_fn_eq_if, indicator_apply, mem_preimage],
split_ifs,
exacts [(map_apply hgm.of_uncurry_left ht).symm, measure_empty] },
simp only [preimage_preimage],
rw [lintegral_congr_ae this, lintegral_indicator _ (hf.1 hs),
set_lintegral_const, hf.measure_preimage hs, mul_comm]
end
/-- If `f : α → β` sends the measure `μa` to `μb` and `g : γ → δ` sends the measure `μc` to `μd`,
then `prod.map f g` sends `μa.prod μc` to `μb.prod μd`. -/
protected lemma prod [sigma_finite μb] [sigma_finite μd] {f : α → β} {g : γ → δ}
(hf : measure_preserving f μa μb) (hg : measure_preserving g μc μd) :
measure_preserving (prod.map f g) (μa.prod μc) (μb.prod μd) :=
have measurable (uncurry $ λ _ : α, g), from (hg.1.comp measurable_snd),
hf.skew_product this $ filter.eventually_of_forall $ λ _, hg.map_eq
end measure_preserving
namespace quasi_measure_preserving
lemma prod_of_right {f : α × β → γ} {μ : measure α} {ν : measure β} {τ : measure γ}
(hf : measurable f) [sigma_finite ν]
(h2f : ∀ᵐ x ∂μ, quasi_measure_preserving (λ y, f (x, y)) ν τ) :
quasi_measure_preserving f (μ.prod ν) τ :=
begin
refine ⟨hf, _⟩,
refine absolutely_continuous.mk (λ s hs h2s, _),
simp_rw [map_apply hf hs, prod_apply (hf hs), preimage_preimage,
lintegral_congr_ae (h2f.mono (λ x hx, hx.preimage_null h2s)), lintegral_zero],
end
lemma prod_of_left {α β γ} [measurable_space α] [measurable_space β]
[measurable_space γ] {f : α × β → γ} {μ : measure α} {ν : measure β} {τ : measure γ}
(hf : measurable f) [sigma_finite μ] [sigma_finite ν]
(h2f : ∀ᵐ y ∂ν, quasi_measure_preserving (λ x, f (x, y)) μ τ) :
quasi_measure_preserving f (μ.prod ν) τ :=
begin
rw [← prod_swap],
convert (quasi_measure_preserving.prod_of_right (hf.comp measurable_swap) h2f).comp
((measurable_swap.measure_preserving (ν.prod μ)).symm measurable_equiv.prod_comm)
.quasi_measure_preserving,
ext ⟨x, y⟩, refl,
end
end quasi_measure_preserving
end measure_theory
open measure_theory.measure
section
lemma ae_measurable.prod_swap [sigma_finite μ] [sigma_finite ν] {f : β × α → γ}
(hf : ae_measurable f (ν.prod μ)) : ae_measurable (λ (z : α × β), f z.swap) (μ.prod ν) :=
by { rw ← prod_swap at hf, exact hf.comp_measurable measurable_swap }
lemma measure_theory.ae_strongly_measurable.prod_swap
{γ : Type*} [topological_space γ] [sigma_finite μ] [sigma_finite ν] {f : β × α → γ}
(hf : ae_strongly_measurable f (ν.prod μ)) :
ae_strongly_measurable (λ (z : α × β), f z.swap) (μ.prod ν) :=
by { rw ← prod_swap at hf, exact hf.comp_measurable measurable_swap }
lemma ae_measurable.fst [sigma_finite ν] {f : α → γ}
(hf : ae_measurable f μ) : ae_measurable (λ (z : α × β), f z.1) (μ.prod ν) :=
hf.comp_measurable' measurable_fst prod_fst_absolutely_continuous
lemma ae_measurable.snd [sigma_finite ν] {f : β → γ}
(hf : ae_measurable f ν) : ae_measurable (λ (z : α × β), f z.2) (μ.prod ν) :=
hf.comp_measurable' measurable_snd prod_snd_absolutely_continuous
lemma measure_theory.ae_strongly_measurable.fst {γ} [topological_space γ] [sigma_finite ν]
{f : α → γ} (hf : ae_strongly_measurable f μ) :
ae_strongly_measurable (λ (z : α × β), f z.1) (μ.prod ν) :=
hf.comp_measurable' measurable_fst prod_fst_absolutely_continuous
lemma measure_theory.ae_strongly_measurable.snd {γ} [topological_space γ] [sigma_finite ν]
{f : β → γ} (hf : ae_strongly_measurable f ν) :
ae_strongly_measurable (λ (z : α × β), f z.2) (μ.prod ν) :=
hf.comp_measurable' measurable_snd prod_snd_absolutely_continuous
/-- The Bochner integral is a.e.-measurable.
This shows that the integrand of (the right-hand-side of) Fubini's theorem is a.e.-measurable. -/
lemma measure_theory.ae_strongly_measurable.integral_prod_right' [sigma_finite ν]
[normed_space ℝ E] [complete_space E]
⦃f : α × β → E⦄ (hf : ae_strongly_measurable f (μ.prod ν)) :
ae_strongly_measurable (λ x, ∫ y, f (x, y) ∂ν) μ :=
⟨λ x, ∫ y, hf.mk f (x, y) ∂ν, hf.strongly_measurable_mk.integral_prod_right',
by { filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk] with _ hx using integral_congr_ae hx }⟩
lemma measure_theory.ae_strongly_measurable.prod_mk_left
{γ : Type*} [sigma_finite ν] [topological_space γ] {f : α × β → γ}
(hf : ae_strongly_measurable f (μ.prod ν)) : ∀ᵐ x ∂μ, ae_strongly_measurable (λ y, f (x, y)) ν :=
begin
filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk] with x hx,
exact ⟨λ y, hf.mk f (x, y), hf.strongly_measurable_mk.comp_measurable measurable_prod_mk_left, hx⟩
end
end
namespace measure_theory
/-! ### The Lebesgue integral on a product -/
variables [sigma_finite ν]
lemma lintegral_prod_swap [sigma_finite μ] (f : α × β → ℝ≥0∞)
(hf : ae_measurable f (μ.prod ν)) : ∫⁻ z, f z.swap ∂(ν.prod μ) = ∫⁻ z, f z ∂(μ.prod ν) :=
by { rw ← prod_swap at hf, rw [← lintegral_map' hf measurable_swap.ae_measurable, prod_swap] }
/-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued measurable functions on `α × β`,
the integral of `f` is equal to the iterated integral. -/
lemma lintegral_prod_of_measurable :
∀ (f : α × β → ℝ≥0∞) (hf : measurable f), ∫⁻ z, f z ∂(μ.prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ :=
begin
have m := @measurable_prod_mk_left,
refine measurable.ennreal_induction _ _ _,
{ intros c s hs, simp only [← indicator_comp_right],
simp [lintegral_indicator, m hs, hs, lintegral_const_mul, measurable_measure_prod_mk_left hs,
prod_apply] },
{ rintro f g - hf hg h2f h2g,
simp [lintegral_add, measurable.lintegral_prod_right', hf.comp m, hg.comp m,
hf, hg, h2f, h2g] },
{ intros f hf h2f h3f,
have kf : ∀ x n, measurable (λ y, f n (x, y)) := λ x n, (hf n).comp m,
have k2f : ∀ x, monotone (λ n y, f n (x, y)) := λ x i j hij y, h2f hij (x, y),
have lf : ∀ n, measurable (λ x, ∫⁻ y, f n (x, y) ∂ν) := λ n, (hf n).lintegral_prod_right',
have l2f : monotone (λ n x, ∫⁻ y, f n (x, y) ∂ν) := λ i j hij x, lintegral_mono (k2f x hij),
simp only [lintegral_supr hf h2f, lintegral_supr (kf _), k2f, lintegral_supr lf l2f, h3f] },
end
/-- **Tonelli's Theorem**: For `ℝ≥0∞`-valued almost everywhere measurable functions on `α × β`,
the integral of `f` is equal to the iterated integral. -/
lemma lintegral_prod (f : α × β → ℝ≥0∞) (hf : ae_measurable f (μ.prod ν)) :
∫⁻ z, f z ∂(μ.prod ν) = ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ :=
begin
have A : ∫⁻ z, f z ∂(μ.prod ν) = ∫⁻ z, hf.mk f z ∂(μ.prod ν) :=
lintegral_congr_ae hf.ae_eq_mk,
have B : ∫⁻ x, ∫⁻ y, f (x, y) ∂ν ∂μ = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂ν ∂μ,
{ apply lintegral_congr_ae,
filter_upwards [ae_ae_of_ae_prod hf.ae_eq_mk] with _ ha using lintegral_congr_ae ha, },
rw [A, B, lintegral_prod_of_measurable _ hf.measurable_mk],
apply_instance
end
/-- The symmetric verion of Tonelli's Theorem: For `ℝ≥0∞`-valued almost everywhere measurable
functions on `α × β`, the integral of `f` is equal to the iterated integral, in reverse order. -/
lemma lintegral_prod_symm [sigma_finite μ] (f : α × β → ℝ≥0∞)
(hf : ae_measurable f (μ.prod ν)) : ∫⁻ z, f z ∂(μ.prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
by { simp_rw [← lintegral_prod_swap f hf], exact lintegral_prod _ hf.prod_swap }
/-- The symmetric verion of Tonelli's Theorem: For `ℝ≥0∞`-valued measurable
functions on `α × β`, the integral of `f` is equal to the iterated integral, in reverse order. -/
lemma lintegral_prod_symm' [sigma_finite μ] (f : α × β → ℝ≥0∞)
(hf : measurable f) : ∫⁻ z, f z ∂(μ.prod ν) = ∫⁻ y, ∫⁻ x, f (x, y) ∂μ ∂ν :=
lintegral_prod_symm f hf.ae_measurable
/-- The reversed version of **Tonelli's Theorem**. In this version `f` is in curried form, which
makes it easier for the elaborator to figure out `f` automatically. -/
lemma lintegral_lintegral ⦃f : α → β → ℝ≥0∞⦄
(hf : ae_measurable (uncurry f) (μ.prod ν)) :
∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ z, f z.1 z.2 ∂(μ.prod ν) :=
(lintegral_prod _ hf).symm
/-- The reversed version of **Tonelli's Theorem** (symmetric version). In this version `f` is in
curried form, which makes it easier for the elaborator to figure out `f` automatically. -/
lemma lintegral_lintegral_symm [sigma_finite μ] ⦃f : α → β → ℝ≥0∞⦄
(hf : ae_measurable (uncurry f) (μ.prod ν)) :
∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ z, f z.2 z.1 ∂(ν.prod μ) :=
(lintegral_prod_symm _ hf.prod_swap).symm
/-- Change the order of Lebesgue integration. -/
lemma lintegral_lintegral_swap [sigma_finite μ] ⦃f : α → β → ℝ≥0∞⦄
(hf : ae_measurable (uncurry f) (μ.prod ν)) :
∫⁻ x, ∫⁻ y, f x y ∂ν ∂μ = ∫⁻ y, ∫⁻ x, f x y ∂μ ∂ν :=
(lintegral_lintegral hf).trans (lintegral_prod_symm _ hf)
lemma lintegral_prod_mul {f : α → ℝ≥0∞} {g : β → ℝ≥0∞}
(hf : ae_measurable f μ) (hg : ae_measurable g ν) :
∫⁻ z, f z.1 * g z.2 ∂(μ.prod ν) = ∫⁻ x, f x ∂μ * ∫⁻ y, g y ∂ν :=
by simp [lintegral_prod _ (hf.fst.mul hg.snd), lintegral_lintegral_mul hf hg]
/-! ### Integrability on a product -/
section
lemma integrable.swap [sigma_finite μ] ⦃f : α × β → E⦄
(hf : integrable f (μ.prod ν)) : integrable (f ∘ prod.swap) (ν.prod μ) :=
⟨hf.ae_strongly_measurable.prod_swap,
(lintegral_prod_swap _ hf.ae_strongly_measurable.ennnorm : _).le.trans_lt hf.has_finite_integral⟩
lemma integrable_swap_iff [sigma_finite μ] ⦃f : α × β → E⦄ :
integrable (f ∘ prod.swap) (ν.prod μ) ↔ integrable f (μ.prod ν) :=
⟨λ hf, by { convert hf.swap, ext ⟨x, y⟩, refl }, λ hf, hf.swap⟩
lemma has_finite_integral_prod_iff ⦃f : α × β → E⦄ (h1f : strongly_measurable f) :
has_finite_integral f (μ.prod ν) ↔ (∀ᵐ x ∂ μ, has_finite_integral (λ y, f (x, y)) ν) ∧
has_finite_integral (λ x, ∫ y, ∥f (x, y)∥ ∂ν) μ :=
begin
simp only [has_finite_integral, lintegral_prod_of_measurable _ h1f.ennnorm],
have : ∀ x, ∀ᵐ y ∂ν, 0 ≤ ∥f (x, y)∥ := λ x, eventually_of_forall (λ y, norm_nonneg _),
simp_rw [integral_eq_lintegral_of_nonneg_ae (this _)
(h1f.norm.comp_measurable measurable_prod_mk_left).ae_strongly_measurable,
ennnorm_eq_of_real to_real_nonneg, of_real_norm_eq_coe_nnnorm],
-- this fact is probably too specialized to be its own lemma
have : ∀ {p q r : Prop} (h1 : r → p), (r ↔ p ∧ q) ↔ (p → (r ↔ q)) :=
λ p q r h1, by rw [← and.congr_right_iff, and_iff_right_of_imp h1],
rw [this],
{ intro h2f, rw lintegral_congr_ae,
refine h2f.mp _, apply eventually_of_forall, intros x hx, dsimp only,
rw [of_real_to_real], rw [← lt_top_iff_ne_top], exact hx },
{ intro h2f, refine ae_lt_top _ h2f.ne, exact h1f.ennnorm.lintegral_prod_right' },
end
lemma has_finite_integral_prod_iff' ⦃f : α × β → E⦄ (h1f : ae_strongly_measurable f (μ.prod ν)) :
has_finite_integral f (μ.prod ν) ↔ (∀ᵐ x ∂ μ, has_finite_integral (λ y, f (x, y)) ν) ∧
has_finite_integral (λ x, ∫ y, ∥f (x, y)∥ ∂ν) μ :=
begin
rw [has_finite_integral_congr h1f.ae_eq_mk,
has_finite_integral_prod_iff h1f.strongly_measurable_mk],
apply and_congr,
{ apply eventually_congr,
filter_upwards [ae_ae_of_ae_prod h1f.ae_eq_mk.symm],
assume x hx,
exact has_finite_integral_congr hx },
{ apply has_finite_integral_congr,
filter_upwards [ae_ae_of_ae_prod h1f.ae_eq_mk.symm] with _ hx
using integral_congr_ae (eventually_eq.fun_comp hx _), },
{ apply_instance, },
end
/-- A binary function is integrable if the function `y ↦ f (x, y)` is integrable for almost every
`x` and the function `x ↦ ∫ ∥f (x, y)∥ dy` is integrable. -/
lemma integrable_prod_iff ⦃f : α × β → E⦄ (h1f : ae_strongly_measurable f (μ.prod ν)) :
integrable f (μ.prod ν) ↔
(∀ᵐ x ∂ μ, integrable (λ y, f (x, y)) ν) ∧ integrable (λ x, ∫ y, ∥f (x, y)∥ ∂ν) μ :=
by simp [integrable, h1f, has_finite_integral_prod_iff', h1f.norm.integral_prod_right',
h1f.prod_mk_left]
/-- A binary function is integrable if the function `x ↦ f (x, y)` is integrable for almost every
`y` and the function `y ↦ ∫ ∥f (x, y)∥ dx` is integrable. -/
lemma integrable_prod_iff' [sigma_finite μ] ⦃f : α × β → E⦄
(h1f : ae_strongly_measurable f (μ.prod ν)) :
integrable f (μ.prod ν) ↔
(∀ᵐ y ∂ ν, integrable (λ x, f (x, y)) μ) ∧ integrable (λ y, ∫ x, ∥f (x, y)∥ ∂μ) ν :=
by { convert integrable_prod_iff (h1f.prod_swap) using 1, rw [integrable_swap_iff] }
lemma integrable.prod_left_ae [sigma_finite μ] ⦃f : α × β → E⦄
(hf : integrable f (μ.prod ν)) : ∀ᵐ y ∂ ν, integrable (λ x, f (x, y)) μ :=
((integrable_prod_iff' hf.ae_strongly_measurable).mp hf).1
lemma integrable.prod_right_ae [sigma_finite μ] ⦃f : α × β → E⦄
(hf : integrable f (μ.prod ν)) : ∀ᵐ x ∂ μ, integrable (λ y, f (x, y)) ν :=
hf.swap.prod_left_ae
lemma integrable.integral_norm_prod_left ⦃f : α × β → E⦄
(hf : integrable f (μ.prod ν)) : integrable (λ x, ∫ y, ∥f (x, y)∥ ∂ν) μ :=
((integrable_prod_iff hf.ae_strongly_measurable).mp hf).2
lemma integrable.integral_norm_prod_right [sigma_finite μ] ⦃f : α × β → E⦄
(hf : integrable f (μ.prod ν)) : integrable (λ y, ∫ x, ∥f (x, y)∥ ∂μ) ν :=
hf.swap.integral_norm_prod_left
end
variables [normed_space ℝ E] [complete_space E]
lemma integrable.integral_prod_left ⦃f : α × β → E⦄
(hf : integrable f (μ.prod ν)) : integrable (λ x, ∫ y, f (x, y) ∂ν) μ :=
integrable.mono hf.integral_norm_prod_left hf.ae_strongly_measurable.integral_prod_right' $
eventually_of_forall $ λ x, (norm_integral_le_integral_norm _).trans_eq $
(norm_of_nonneg $ integral_nonneg_of_ae $ eventually_of_forall $
λ y, (norm_nonneg (f (x, y)) : _)).symm
lemma integrable.integral_prod_right [sigma_finite μ] ⦃f : α × β → E⦄
(hf : integrable f (μ.prod ν)) : integrable (λ y, ∫ x, f (x, y) ∂μ) ν :=
hf.swap.integral_prod_left
/-! ### The Bochner integral on a product -/
variables [sigma_finite μ]
lemma integral_prod_swap (f : α × β → E)
(hf : ae_strongly_measurable f (μ.prod ν)) : ∫ z, f z.swap ∂(ν.prod μ) = ∫ z, f z ∂(μ.prod ν) :=
begin
rw ← prod_swap at hf,
rw [← integral_map measurable_swap.ae_measurable hf, prod_swap]
end
variables {E' : Type*} [normed_group E'] [complete_space E'] [normed_space ℝ E']
/-! Some rules about the sum/difference of double integrals. They follow from `integral_add`, but
we separate them out as separate lemmas, because they involve quite some steps. -/
/-- Integrals commute with addition inside another integral. `F` can be any function. -/
lemma integral_fn_integral_add ⦃f g : α × β → E⦄ (F : E → E')
(hf : integrable f (μ.prod ν)) (hg : integrable g (μ.prod ν)) :
∫ x, F (∫ y, f (x, y) + g (x, y) ∂ν) ∂μ = ∫ x, F (∫ y, f (x, y) ∂ν + ∫ y, g (x, y) ∂ν) ∂μ :=
begin
refine integral_congr_ae _,
filter_upwards [hf.prod_right_ae, hg.prod_right_ae] with _ h2f h2g,
simp [integral_add h2f h2g],
end
/-- Integrals commute with subtraction inside another integral.
`F` can be any measurable function. -/
lemma integral_fn_integral_sub ⦃f g : α × β → E⦄ (F : E → E')
(hf : integrable f (μ.prod ν)) (hg : integrable g (μ.prod ν)) :
∫ x, F (∫ y, f (x, y) - g (x, y) ∂ν) ∂μ = ∫ x, F (∫ y, f (x, y) ∂ν - ∫ y, g (x, y) ∂ν) ∂μ :=
begin
refine integral_congr_ae _,
filter_upwards [hf.prod_right_ae, hg.prod_right_ae] with _ h2f h2g,
simp [integral_sub h2f h2g],
end
/-- Integrals commute with subtraction inside a lower Lebesgue integral.
`F` can be any function. -/
lemma lintegral_fn_integral_sub ⦃f g : α × β → E⦄
(F : E → ℝ≥0∞) (hf : integrable f (μ.prod ν)) (hg : integrable g (μ.prod ν)) :
∫⁻ x, F (∫ y, f (x, y) - g (x, y) ∂ν) ∂μ = ∫⁻ x, F (∫ y, f (x, y) ∂ν - ∫ y, g (x, y) ∂ν) ∂μ :=
begin
refine lintegral_congr_ae _,
filter_upwards [hf.prod_right_ae, hg.prod_right_ae] with _ h2f h2g,
simp [integral_sub h2f h2g],
end
/-- Double integrals commute with addition. -/
lemma integral_integral_add ⦃f g : α × β → E⦄
(hf : integrable f (μ.prod ν)) (hg : integrable g (μ.prod ν)) :
∫ x, ∫ y, f (x, y) + g (x, y) ∂ν ∂μ = ∫ x, ∫ y, f (x, y) ∂ν ∂μ + ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
(integral_fn_integral_add id hf hg).trans $
integral_add hf.integral_prod_left hg.integral_prod_left
/-- Double integrals commute with addition. This is the version with `(f + g) (x, y)`
(instead of `f (x, y) + g (x, y)`) in the LHS. -/
lemma integral_integral_add' ⦃f g : α × β → E⦄
(hf : integrable f (μ.prod ν)) (hg : integrable g (μ.prod ν)) :
∫ x, ∫ y, (f + g) (x, y) ∂ν ∂μ = ∫ x, ∫ y, f (x, y) ∂ν ∂μ + ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
integral_integral_add hf hg
/-- Double integrals commute with subtraction. -/
lemma integral_integral_sub ⦃f g : α × β → E⦄
(hf : integrable f (μ.prod ν)) (hg : integrable g (μ.prod ν)) :
∫ x, ∫ y, f (x, y) - g (x, y) ∂ν ∂μ = ∫ x, ∫ y, f (x, y) ∂ν ∂μ - ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
(integral_fn_integral_sub id hf hg).trans $
integral_sub hf.integral_prod_left hg.integral_prod_left
/-- Double integrals commute with subtraction. This is the version with `(f - g) (x, y)`
(instead of `f (x, y) - g (x, y)`) in the LHS. -/
lemma integral_integral_sub' ⦃f g : α × β → E⦄
(hf : integrable f (μ.prod ν)) (hg : integrable g (μ.prod ν)) :
∫ x, ∫ y, (f - g) (x, y) ∂ν ∂μ = ∫ x, ∫ y, f (x, y) ∂ν ∂μ - ∫ x, ∫ y, g (x, y) ∂ν ∂μ :=
integral_integral_sub hf hg
/-- The map that sends an L¹-function `f : α × β → E` to `∫∫f` is continuous. -/
lemma continuous_integral_integral :
continuous (λ (f : α × β →₁[μ.prod ν] E), ∫ x, ∫ y, f (x, y) ∂ν ∂μ) :=
begin
rw [continuous_iff_continuous_at], intro g,
refine tendsto_integral_of_L1 _ (L1.integrable_coe_fn g).integral_prod_left
(eventually_of_forall $ λ h, (L1.integrable_coe_fn h).integral_prod_left) _,
simp_rw [← lintegral_fn_integral_sub (λ x, (∥x∥₊ : ℝ≥0∞)) (L1.integrable_coe_fn _)
(L1.integrable_coe_fn g)],
refine tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds _ (λ i, zero_le _) _,
{ exact λ i, ∫⁻ x, ∫⁻ y, ∥i (x, y) - g (x, y)∥₊ ∂ν ∂μ },
swap, { exact λ i, lintegral_mono (λ x, ennnorm_integral_le_lintegral_ennnorm _) },
show tendsto (λ (i : α × β →₁[μ.prod ν] E),
∫⁻ x, ∫⁻ (y : β), ∥i (x, y) - g (x, y)∥₊ ∂ν ∂μ) (𝓝 g) (𝓝 0),
have : ∀ (i : α × β →₁[μ.prod ν] E), measurable (λ z, (∥i z - g z∥₊ : ℝ≥0∞)) :=
λ i, ((Lp.strongly_measurable i).sub (Lp.strongly_measurable g)).ennnorm,
simp_rw [← lintegral_prod_of_measurable _ (this _), ← L1.of_real_norm_sub_eq_lintegral,
← of_real_zero],
refine (continuous_of_real.tendsto 0).comp _,
rw [← tendsto_iff_norm_tendsto_zero], exact tendsto_id
end
/-- **Fubini's Theorem**: For integrable functions on `α × β`,
the Bochner integral of `f` is equal to the iterated Bochner integral.
`integrable_prod_iff` can be useful to show that the function in question in integrable.
`measure_theory.integrable.integral_prod_right` is useful to show that the inner integral
of the right-hand side is integrable. -/
lemma integral_prod : ∀ (f : α × β → E) (hf : integrable f (μ.prod ν)),
∫ z, f z ∂(μ.prod ν) = ∫ x, ∫ y, f (x, y) ∂ν ∂μ :=
begin
apply integrable.induction,
{ intros c s hs h2s,
simp_rw [integral_indicator hs, ← indicator_comp_right,
function.comp, integral_indicator (measurable_prod_mk_left hs),
set_integral_const, integral_smul_const,
integral_to_real (measurable_measure_prod_mk_left hs).ae_measurable
(ae_measure_lt_top hs h2s.ne), prod_apply hs] },
{ intros f g hfg i_f i_g hf hg,
simp_rw [integral_add' i_f i_g, integral_integral_add' i_f i_g, hf, hg] },
{ exact is_closed_eq continuous_integral continuous_integral_integral },
{ intros f g hfg i_f hf, convert hf using 1,
{ exact integral_congr_ae hfg.symm },
{ refine integral_congr_ae _,
refine (ae_ae_of_ae_prod hfg).mp _,
apply eventually_of_forall, intros x hfgx,
exact integral_congr_ae (ae_eq_symm hfgx) } }
end
/-- Symmetric version of **Fubini's Theorem**: For integrable functions on `α × β`,
the Bochner integral of `f` is equal to the iterated Bochner integral.
This version has the integrals on the right-hand side in the other order. -/
lemma integral_prod_symm (f : α × β → E) (hf : integrable f (μ.prod ν)) :
∫ z, f z ∂(μ.prod ν) = ∫ y, ∫ x, f (x, y) ∂μ ∂ν :=
by { simp_rw [← integral_prod_swap f hf.ae_strongly_measurable], exact integral_prod _ hf.swap }
/-- Reversed version of **Fubini's Theorem**. -/
lemma integral_integral {f : α → β → E} (hf : integrable (uncurry f) (μ.prod ν)) :
∫ x, ∫ y, f x y ∂ν ∂μ = ∫ z, f z.1 z.2 ∂(μ.prod ν) :=
(integral_prod _ hf).symm
/-- Reversed version of **Fubini's Theorem** (symmetric version). -/