src/HOL/Analysis/Infinite_Set_Sum.thy
author wenzelm
Mon Mar 25 17:21:26 2019 +0100 (3 weeks ago)
changeset 69981 3dced198b9ec
parent 69710 61372780515b
child 70136 f03a01a18c6e
permissions -rw-r--r--
more strict AFP properties;
lp15@69710
     1
(*
eberlm@66480
     2
  Title:    HOL/Analysis/Infinite_Set_Sum.thy
eberlm@66480
     3
  Author:   Manuel Eberl, TU M√ľnchen
eberlm@66480
     4
eberlm@66480
     5
  A theory of sums over possible infinite sets. (Only works for absolute summability)
eberlm@66480
     6
*)
nipkow@69517
     7
section \<open>Sums over Infinite Sets\<close>
nipkow@69517
     8
eberlm@66480
     9
theory Infinite_Set_Sum
eberlm@66480
    10
  imports Set_Integral
eberlm@66480
    11
begin
eberlm@66480
    12
eberlm@66480
    13
(* TODO Move *)
eberlm@66480
    14
lemma sets_eq_countable:
eberlm@66480
    15
  assumes "countable A" "space M = A" "\<And>x. x \<in> A \<Longrightarrow> {x} \<in> sets M"
eberlm@66480
    16
  shows   "sets M = Pow A"
eberlm@66480
    17
proof (intro equalityI subsetI)
eberlm@66480
    18
  fix X assume "X \<in> Pow A"
eberlm@66480
    19
  hence "(\<Union>x\<in>X. {x}) \<in> sets M"
eberlm@66480
    20
    by (intro sets.countable_UN' countable_subset[OF _ assms(1)]) (auto intro!: assms(3))
eberlm@66480
    21
  also have "(\<Union>x\<in>X. {x}) = X" by auto
eberlm@66480
    22
  finally show "X \<in> sets M" .
eberlm@66480
    23
next
eberlm@66480
    24
  fix X assume "X \<in> sets M"
lp15@69710
    25
  from sets.sets_into_space[OF this] and assms
eberlm@66480
    26
    show "X \<in> Pow A" by simp
eberlm@66480
    27
qed
eberlm@66480
    28
eberlm@66480
    29
lemma measure_eqI_countable':
lp15@69710
    30
  assumes spaces: "space M = A" "space N = A"
eberlm@66480
    31
  assumes sets: "\<And>x. x \<in> A \<Longrightarrow> {x} \<in> sets M" "\<And>x. x \<in> A \<Longrightarrow> {x} \<in> sets N"
eberlm@66480
    32
  assumes A: "countable A"
eberlm@66480
    33
  assumes eq: "\<And>a. a \<in> A \<Longrightarrow> emeasure M {a} = emeasure N {a}"
eberlm@66480
    34
  shows "M = N"
eberlm@66480
    35
proof (rule measure_eqI_countable)
eberlm@66480
    36
  show "sets M = Pow A"
eberlm@66480
    37
    by (intro sets_eq_countable assms)
eberlm@66480
    38
  show "sets N = Pow A"
eberlm@66480
    39
    by (intro sets_eq_countable assms)
eberlm@66480
    40
qed fact+
eberlm@66480
    41
eberlm@66480
    42
lemma count_space_PiM_finite:
eberlm@66480
    43
  fixes B :: "'a \<Rightarrow> 'b set"
eberlm@66480
    44
  assumes "finite A" "\<And>i. countable (B i)"
eberlm@66480
    45
  shows   "PiM A (\<lambda>i. count_space (B i)) = count_space (PiE A B)"
eberlm@66480
    46
proof (rule measure_eqI_countable')
lp15@69710
    47
  show "space (PiM A (\<lambda>i. count_space (B i))) = PiE A B"
eberlm@66480
    48
    by (simp add: space_PiM)
eberlm@66480
    49
  show "space (count_space (PiE A B)) = PiE A B" by simp
eberlm@66480
    50
next
eberlm@66480
    51
  fix f assume f: "f \<in> PiE A B"
eberlm@66480
    52
  hence "PiE A (\<lambda>x. {f x}) \<in> sets (Pi\<^sub>M A (\<lambda>i. count_space (B i)))"
eberlm@66480
    53
    by (intro sets_PiM_I_finite assms) auto
lp15@69710
    54
  also from f have "PiE A (\<lambda>x. {f x}) = {f}"
eberlm@66480
    55
    by (intro PiE_singleton) (auto simp: PiE_def)
eberlm@66480
    56
  finally show "{f} \<in> sets (Pi\<^sub>M A (\<lambda>i. count_space (B i)))" .
eberlm@66480
    57
next
eberlm@66480
    58
  interpret product_sigma_finite "(\<lambda>i. count_space (B i))"
eberlm@66480
    59
    by (intro product_sigma_finite.intro sigma_finite_measure_count_space_countable assms)
eberlm@66480
    60
  thm sigma_finite_measure_count_space
eberlm@66480
    61
  fix f assume f: "f \<in> PiE A B"
eberlm@66480
    62
  hence "{f} = PiE A (\<lambda>x. {f x})"
eberlm@66480
    63
    by (intro PiE_singleton [symmetric]) (auto simp: PiE_def)
lp15@69710
    64
  also have "emeasure (Pi\<^sub>M A (\<lambda>i. count_space (B i))) \<dots> =
eberlm@66480
    65
               (\<Prod>i\<in>A. emeasure (count_space (B i)) {f i})"
eberlm@66480
    66
    using f assms by (subst emeasure_PiM) auto
eberlm@66480
    67
  also have "\<dots> = (\<Prod>i\<in>A. 1)"
eberlm@66480
    68
    by (intro prod.cong refl, subst emeasure_count_space_finite) (use f in auto)
eberlm@66480
    69
  also have "\<dots> = emeasure (count_space (PiE A B)) {f}"
eberlm@66480
    70
    using f by (subst emeasure_count_space_finite) auto
eberlm@66480
    71
  finally show "emeasure (Pi\<^sub>M A (\<lambda>i. count_space (B i))) {f} =
eberlm@66480
    72
                  emeasure (count_space (Pi\<^sub>E A B)) {f}" .
eberlm@66480
    73
qed (simp_all add: countable_PiE assms)
eberlm@66480
    74
eberlm@66480
    75
eberlm@66480
    76
eberlm@68651
    77
definition%important abs_summable_on ::
lp15@69710
    78
    "('a \<Rightarrow> 'b :: {banach, second_countable_topology}) \<Rightarrow> 'a set \<Rightarrow> bool"
eberlm@66480
    79
    (infix "abs'_summable'_on" 50)
eberlm@66480
    80
 where
eberlm@66480
    81
   "f abs_summable_on A \<longleftrightarrow> integrable (count_space A) f"
eberlm@66480
    82
eberlm@66480
    83
eberlm@68651
    84
definition%important infsetsum ::
eberlm@66480
    85
    "('a \<Rightarrow> 'b :: {banach, second_countable_topology}) \<Rightarrow> 'a set \<Rightarrow> 'b"
eberlm@66480
    86
 where
eberlm@66480
    87
   "infsetsum f A = lebesgue_integral (count_space A) f"
eberlm@66480
    88
eberlm@66480
    89
syntax (ASCII)
lp15@69710
    90
  "_infsetsum" :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b::{banach, second_countable_topology}"
eberlm@66480
    91
  ("(3INFSETSUM _:_./ _)" [0, 51, 10] 10)
eberlm@66480
    92
syntax
lp15@69710
    93
  "_infsetsum" :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b::{banach, second_countable_topology}"
eberlm@66480
    94
  ("(2\<Sum>\<^sub>a_\<in>_./ _)" [0, 51, 10] 10)
eberlm@66480
    95
translations \<comment> \<open>Beware of argument permutation!\<close>
eberlm@66480
    96
  "\<Sum>\<^sub>ai\<in>A. b" \<rightleftharpoons> "CONST infsetsum (\<lambda>i. b) A"
eberlm@66480
    97
eberlm@66480
    98
syntax (ASCII)
lp15@69710
    99
  "_uinfsetsum" :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b::{banach, second_countable_topology}"
eberlm@66526
   100
  ("(3INFSETSUM _:_./ _)" [0, 51, 10] 10)
eberlm@66526
   101
syntax
lp15@69710
   102
  "_uinfsetsum" :: "pttrn \<Rightarrow> 'b \<Rightarrow> 'b::{banach, second_countable_topology}"
eberlm@66526
   103
  ("(2\<Sum>\<^sub>a_./ _)" [0, 10] 10)
eberlm@66526
   104
translations \<comment> \<open>Beware of argument permutation!\<close>
eberlm@66526
   105
  "\<Sum>\<^sub>ai. b" \<rightleftharpoons> "CONST infsetsum (\<lambda>i. b) (CONST UNIV)"
eberlm@66526
   106
eberlm@66526
   107
syntax (ASCII)
lp15@69710
   108
  "_qinfsetsum" :: "pttrn \<Rightarrow> bool \<Rightarrow> 'a \<Rightarrow> 'a::{banach, second_countable_topology}"
eberlm@66480
   109
  ("(3INFSETSUM _ |/ _./ _)" [0, 0, 10] 10)
eberlm@66480
   110
syntax
lp15@69710
   111
  "_qinfsetsum" :: "pttrn \<Rightarrow> bool \<Rightarrow> 'a \<Rightarrow> 'a::{banach, second_countable_topology}"
eberlm@66480
   112
  ("(2\<Sum>\<^sub>a_ | (_)./ _)" [0, 0, 10] 10)
eberlm@66480
   113
translations
eberlm@66480
   114
  "\<Sum>\<^sub>ax|P. t" => "CONST infsetsum (\<lambda>x. t) {x. P}"
eberlm@66480
   115
eberlm@66480
   116
print_translation \<open>
eberlm@66480
   117
let
wenzelm@69597
   118
  fun sum_tr' [Abs (x, Tx, t), Const (\<^const_syntax>\<open>Collect\<close>, _) $ Abs (y, Ty, P)] =
eberlm@66480
   119
        if x <> y then raise Match
eberlm@66480
   120
        else
eberlm@66480
   121
          let
eberlm@66480
   122
            val x' = Syntax_Trans.mark_bound_body (x, Tx);
eberlm@66480
   123
            val t' = subst_bound (x', t);
eberlm@66480
   124
            val P' = subst_bound (x', P);
eberlm@66480
   125
          in
wenzelm@69597
   126
            Syntax.const \<^syntax_const>\<open>_qinfsetsum\<close> $ Syntax_Trans.mark_bound_abs (x, Tx) $ P' $ t'
eberlm@66480
   127
          end
eberlm@66480
   128
    | sum_tr' _ = raise Match;
wenzelm@69597
   129
in [(\<^const_syntax>\<open>infsetsum\<close>, K sum_tr')] end
eberlm@66480
   130
\<close>
eberlm@66480
   131
eberlm@66480
   132
eberlm@66480
   133
lemma restrict_count_space_subset:
eberlm@66480
   134
  "A \<subseteq> B \<Longrightarrow> restrict_space (count_space B) A = count_space A"
eberlm@66480
   135
  by (subst restrict_count_space) (simp_all add: Int_absorb2)
eberlm@66480
   136
eberlm@66480
   137
lemma abs_summable_on_restrict:
eberlm@66480
   138
  fixes f :: "'a \<Rightarrow> 'b :: {banach, second_countable_topology}"
eberlm@66480
   139
  assumes "A \<subseteq> B"
eberlm@66480
   140
  shows   "f abs_summable_on A \<longleftrightarrow> (\<lambda>x. indicator A x *\<^sub>R f x) abs_summable_on B"
eberlm@66480
   141
proof -
eberlm@66480
   142
  have "count_space A = restrict_space (count_space B) A"
eberlm@66480
   143
    by (rule restrict_count_space_subset [symmetric]) fact+
eberlm@66480
   144
  also have "integrable \<dots> f \<longleftrightarrow> set_integrable (count_space B) A f"
lp15@67974
   145
    by (simp add: integrable_restrict_space set_integrable_def)
lp15@69710
   146
  finally show ?thesis
lp15@67974
   147
    unfolding abs_summable_on_def set_integrable_def .
eberlm@66480
   148
qed
eberlm@66480
   149
eberlm@66480
   150
lemma abs_summable_on_altdef: "f abs_summable_on A \<longleftrightarrow> set_integrable (count_space UNIV) A f"
lp15@67974
   151
  unfolding abs_summable_on_def set_integrable_def
lp15@67974
   152
  by (metis (no_types) inf_top.right_neutral integrable_restrict_space restrict_count_space sets_UNIV)
eberlm@66480
   153
lp15@69710
   154
lemma abs_summable_on_altdef':
eberlm@66480
   155
  "A \<subseteq> B \<Longrightarrow> f abs_summable_on A \<longleftrightarrow> set_integrable (count_space B) A f"
lp15@67974
   156
  unfolding abs_summable_on_def set_integrable_def
lp15@67974
   157
  by (metis (no_types) Pow_iff abs_summable_on_def inf.orderE integrable_restrict_space restrict_count_space_subset set_integrable_def sets_count_space space_count_space)
eberlm@66480
   158
lp15@69710
   159
lemma abs_summable_on_norm_iff [simp]:
eberlm@66526
   160
  "(\<lambda>x. norm (f x)) abs_summable_on A \<longleftrightarrow> f abs_summable_on A"
eberlm@66526
   161
  by (simp add: abs_summable_on_def integrable_norm_iff)
eberlm@66526
   162
eberlm@66526
   163
lemma abs_summable_on_normI: "f abs_summable_on A \<Longrightarrow> (\<lambda>x. norm (f x)) abs_summable_on A"
eberlm@66526
   164
  by simp
eberlm@66526
   165
lp15@67268
   166
lemma abs_summable_complex_of_real [simp]: "(\<lambda>n. complex_of_real (f n)) abs_summable_on A \<longleftrightarrow> f abs_summable_on A"
lp15@67268
   167
  by (simp add: abs_summable_on_def complex_of_real_integrable_eq)
lp15@67268
   168
eberlm@66526
   169
lemma abs_summable_on_comparison_test:
eberlm@66526
   170
  assumes "g abs_summable_on A"
eberlm@66526
   171
  assumes "\<And>x. x \<in> A \<Longrightarrow> norm (f x) \<le> norm (g x)"
eberlm@66526
   172
  shows   "f abs_summable_on A"
lp15@69710
   173
  using assms Bochner_Integration.integrable_bound[of "count_space A" g f]
lp15@69710
   174
  unfolding abs_summable_on_def by (auto simp: AE_count_space)
eberlm@66526
   175
eberlm@66526
   176
lemma abs_summable_on_comparison_test':
eberlm@66526
   177
  assumes "g abs_summable_on A"
eberlm@66526
   178
  assumes "\<And>x. x \<in> A \<Longrightarrow> norm (f x) \<le> g x"
eberlm@66526
   179
  shows   "f abs_summable_on A"
eberlm@66526
   180
proof (rule abs_summable_on_comparison_test[OF assms(1), of f])
eberlm@66526
   181
  fix x assume "x \<in> A"
eberlm@66526
   182
  with assms(2) have "norm (f x) \<le> g x" .
eberlm@66526
   183
  also have "\<dots> \<le> norm (g x)" by simp
eberlm@66526
   184
  finally show "norm (f x) \<le> norm (g x)" .
eberlm@66526
   185
qed
eberlm@66526
   186
eberlm@66480
   187
lemma abs_summable_on_cong [cong]:
eberlm@66480
   188
  "(\<And>x. x \<in> A \<Longrightarrow> f x = g x) \<Longrightarrow> A = B \<Longrightarrow> (f abs_summable_on A) \<longleftrightarrow> (g abs_summable_on B)"
eberlm@66480
   189
  unfolding abs_summable_on_def by (intro integrable_cong) auto
eberlm@66480
   190
eberlm@66480
   191
lemma abs_summable_on_cong_neutral:
eberlm@66480
   192
  assumes "\<And>x. x \<in> A - B \<Longrightarrow> f x = 0"
eberlm@66480
   193
  assumes "\<And>x. x \<in> B - A \<Longrightarrow> g x = 0"
eberlm@66480
   194
  assumes "\<And>x. x \<in> A \<inter> B \<Longrightarrow> f x = g x"
eberlm@66480
   195
  shows   "f abs_summable_on A \<longleftrightarrow> g abs_summable_on B"
lp15@67974
   196
  unfolding abs_summable_on_altdef set_integrable_def using assms
eberlm@66480
   197
  by (intro Bochner_Integration.integrable_cong refl)
eberlm@66480
   198
     (auto simp: indicator_def split: if_splits)
eberlm@66480
   199
eberlm@66480
   200
lemma abs_summable_on_restrict':
eberlm@66480
   201
  fixes f :: "'a \<Rightarrow> 'b :: {banach, second_countable_topology}"
eberlm@66480
   202
  assumes "A \<subseteq> B"
eberlm@66480
   203
  shows   "f abs_summable_on A \<longleftrightarrow> (\<lambda>x. if x \<in> A then f x else 0) abs_summable_on B"
eberlm@66480
   204
  by (subst abs_summable_on_restrict[OF assms]) (intro abs_summable_on_cong, auto)
eberlm@66480
   205
eberlm@66480
   206
lemma abs_summable_on_nat_iff:
eberlm@66480
   207
  "f abs_summable_on (A :: nat set) \<longleftrightarrow> summable (\<lambda>n. if n \<in> A then norm (f n) else 0)"
eberlm@66480
   208
proof -
eberlm@66480
   209
  have "f abs_summable_on A \<longleftrightarrow> summable (\<lambda>x. norm (if x \<in> A then f x else 0))"
lp15@69710
   210
    by (subst abs_summable_on_restrict'[of _ UNIV])
eberlm@66480
   211
       (simp_all add: abs_summable_on_def integrable_count_space_nat_iff)
eberlm@66480
   212
  also have "(\<lambda>x. norm (if x \<in> A then f x else 0)) = (\<lambda>x. if x \<in> A then norm (f x) else 0)"
eberlm@66480
   213
    by auto
eberlm@66480
   214
  finally show ?thesis .
eberlm@66480
   215
qed
eberlm@66480
   216
eberlm@66480
   217
lemma abs_summable_on_nat_iff':
eberlm@66480
   218
  "f abs_summable_on (UNIV :: nat set) \<longleftrightarrow> summable (\<lambda>n. norm (f n))"
eberlm@66480
   219
  by (subst abs_summable_on_nat_iff) auto
eberlm@66480
   220
lp15@67268
   221
lemma nat_abs_summable_on_comparison_test:
lp15@67268
   222
  fixes f :: "nat \<Rightarrow> 'a :: {banach, second_countable_topology}"
lp15@67268
   223
  assumes "g abs_summable_on I"
lp15@67268
   224
  assumes "\<And>n. \<lbrakk>n\<ge>N; n \<in> I\<rbrakk> \<Longrightarrow> norm (f n) \<le> g n"
lp15@67268
   225
  shows   "f abs_summable_on I"
lp15@67268
   226
  using assms by (fastforce simp add: abs_summable_on_nat_iff intro: summable_comparison_test')
lp15@67268
   227
lp15@67268
   228
lemma abs_summable_comparison_test_ev:
lp15@67268
   229
  assumes "g abs_summable_on I"
lp15@67268
   230
  assumes "eventually (\<lambda>x. x \<in> I \<longrightarrow> norm (f x) \<le> g x) sequentially"
lp15@67268
   231
  shows   "f abs_summable_on I"
lp15@67268
   232
  by (metis (no_types, lifting) nat_abs_summable_on_comparison_test eventually_at_top_linorder assms)
lp15@67268
   233
lp15@67268
   234
lemma abs_summable_on_Cauchy:
lp15@67268
   235
  "f abs_summable_on (UNIV :: nat set) \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n. (\<Sum>x = m..<n. norm (f x)) < e)"
lp15@67268
   236
  by (simp add: abs_summable_on_nat_iff' summable_Cauchy sum_nonneg)
lp15@67268
   237
eberlm@66480
   238
lemma abs_summable_on_finite [simp]: "finite A \<Longrightarrow> f abs_summable_on A"
eberlm@66480
   239
  unfolding abs_summable_on_def by (rule integrable_count_space)
eberlm@66480
   240
eberlm@66480
   241
lemma abs_summable_on_empty [simp, intro]: "f abs_summable_on {}"
eberlm@66480
   242
  by simp
eberlm@66480
   243
eberlm@66480
   244
lemma abs_summable_on_subset:
eberlm@66480
   245
  assumes "f abs_summable_on B" and "A \<subseteq> B"
eberlm@66480
   246
  shows   "f abs_summable_on A"
eberlm@66480
   247
  unfolding abs_summable_on_altdef
eberlm@66480
   248
  by (rule set_integrable_subset) (insert assms, auto simp: abs_summable_on_altdef)
eberlm@66480
   249
eberlm@66480
   250
lemma abs_summable_on_union [intro]:
eberlm@66480
   251
  assumes "f abs_summable_on A" and "f abs_summable_on B"
eberlm@66480
   252
  shows   "f abs_summable_on (A \<union> B)"
eberlm@66480
   253
  using assms unfolding abs_summable_on_altdef by (intro set_integrable_Un) auto
eberlm@66480
   254
eberlm@66526
   255
lemma abs_summable_on_insert_iff [simp]:
eberlm@66526
   256
  "f abs_summable_on insert x A \<longleftrightarrow> f abs_summable_on A"
eberlm@66526
   257
proof safe
eberlm@66526
   258
  assume "f abs_summable_on insert x A"
eberlm@66526
   259
  thus "f abs_summable_on A"
eberlm@66526
   260
    by (rule abs_summable_on_subset) auto
eberlm@66526
   261
next
eberlm@66526
   262
  assume "f abs_summable_on A"
eberlm@66526
   263
  from abs_summable_on_union[OF this, of "{x}"]
eberlm@66526
   264
    show "f abs_summable_on insert x A" by simp
eberlm@66526
   265
qed
eberlm@66526
   266
lp15@69710
   267
lemma abs_summable_sum:
eberlm@67167
   268
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x abs_summable_on B"
eberlm@67167
   269
  shows   "(\<lambda>y. \<Sum>x\<in>A. f x y) abs_summable_on B"
eberlm@67167
   270
  using assms unfolding abs_summable_on_def by (intro Bochner_Integration.integrable_sum)
eberlm@67167
   271
eberlm@67167
   272
lemma abs_summable_Re: "f abs_summable_on A \<Longrightarrow> (\<lambda>x. Re (f x)) abs_summable_on A"
eberlm@67167
   273
  by (simp add: abs_summable_on_def)
eberlm@67167
   274
eberlm@67167
   275
lemma abs_summable_Im: "f abs_summable_on A \<Longrightarrow> (\<lambda>x. Im (f x)) abs_summable_on A"
eberlm@67167
   276
  by (simp add: abs_summable_on_def)
eberlm@67167
   277
eberlm@67167
   278
lemma abs_summable_on_finite_diff:
eberlm@67167
   279
  assumes "f abs_summable_on A" "A \<subseteq> B" "finite (B - A)"
eberlm@67167
   280
  shows   "f abs_summable_on B"
eberlm@67167
   281
proof -
eberlm@67167
   282
  have "f abs_summable_on (A \<union> (B - A))"
eberlm@67167
   283
    by (intro abs_summable_on_union assms abs_summable_on_finite)
eberlm@67167
   284
  also from assms have "A \<union> (B - A) = B" by blast
eberlm@67167
   285
  finally show ?thesis .
eberlm@67167
   286
qed
eberlm@67167
   287
eberlm@66480
   288
lemma abs_summable_on_reindex_bij_betw:
eberlm@66480
   289
  assumes "bij_betw g A B"
eberlm@66480
   290
  shows   "(\<lambda>x. f (g x)) abs_summable_on A \<longleftrightarrow> f abs_summable_on B"
eberlm@66480
   291
proof -
eberlm@66480
   292
  have *: "count_space B = distr (count_space A) (count_space B) g"
eberlm@66480
   293
    by (rule distr_bij_count_space [symmetric]) fact
eberlm@66480
   294
  show ?thesis unfolding abs_summable_on_def
lp15@69710
   295
    by (subst *, subst integrable_distr_eq[of _ _ "count_space B"])
eberlm@66480
   296
       (insert assms, auto simp: bij_betw_def)
eberlm@66480
   297
qed
eberlm@66480
   298
eberlm@66480
   299
lemma abs_summable_on_reindex:
eberlm@66480
   300
  assumes "(\<lambda>x. f (g x)) abs_summable_on A"
eberlm@66480
   301
  shows   "f abs_summable_on (g ` A)"
eberlm@66480
   302
proof -
eberlm@66480
   303
  define g' where "g' = inv_into A g"
lp15@69710
   304
  from assms have "(\<lambda>x. f (g x)) abs_summable_on (g' ` g ` A)"
eberlm@66480
   305
    by (rule abs_summable_on_subset) (auto simp: g'_def inv_into_into)
eberlm@66480
   306
  also have "?this \<longleftrightarrow> (\<lambda>x. f (g (g' x))) abs_summable_on (g ` A)" unfolding g'_def
eberlm@66480
   307
    by (intro abs_summable_on_reindex_bij_betw [symmetric] inj_on_imp_bij_betw inj_on_inv_into) auto
eberlm@66480
   308
  also have "\<dots> \<longleftrightarrow> f abs_summable_on (g ` A)"
eberlm@66480
   309
    by (intro abs_summable_on_cong refl) (auto simp: g'_def f_inv_into_f)
eberlm@66480
   310
  finally show ?thesis .
eberlm@66480
   311
qed
eberlm@66480
   312
lp15@69710
   313
lemma abs_summable_on_reindex_iff:
eberlm@66480
   314
  "inj_on g A \<Longrightarrow> (\<lambda>x. f (g x)) abs_summable_on A \<longleftrightarrow> f abs_summable_on (g ` A)"
eberlm@66480
   315
  by (intro abs_summable_on_reindex_bij_betw inj_on_imp_bij_betw)
eberlm@66480
   316
eberlm@66526
   317
lemma abs_summable_on_Sigma_project2:
eberlm@66480
   318
  fixes A :: "'a set" and B :: "'a \<Rightarrow> 'b set"
eberlm@66480
   319
  assumes "f abs_summable_on (Sigma A B)" "x \<in> A"
eberlm@66480
   320
  shows   "(\<lambda>y. f (x, y)) abs_summable_on (B x)"
eberlm@66480
   321
proof -
eberlm@66480
   322
  from assms(2) have "f abs_summable_on (Sigma {x} B)"
eberlm@66480
   323
    by (intro abs_summable_on_subset [OF assms(1)]) auto
eberlm@66480
   324
  also have "?this \<longleftrightarrow> (\<lambda>z. f (x, snd z)) abs_summable_on (Sigma {x} B)"
eberlm@66480
   325
    by (rule abs_summable_on_cong) auto
eberlm@66480
   326
  finally have "(\<lambda>y. f (x, y)) abs_summable_on (snd ` Sigma {x} B)"
eberlm@66480
   327
    by (rule abs_summable_on_reindex)
eberlm@66480
   328
  also have "snd ` Sigma {x} B = B x"
eberlm@66480
   329
    using assms by (auto simp: image_iff)
eberlm@66480
   330
  finally show ?thesis .
eberlm@66480
   331
qed
eberlm@66480
   332
eberlm@66480
   333
lemma abs_summable_on_Times_swap:
eberlm@66480
   334
  "f abs_summable_on A \<times> B \<longleftrightarrow> (\<lambda>(x,y). f (y,x)) abs_summable_on B \<times> A"
eberlm@66480
   335
proof -
eberlm@66480
   336
  have bij: "bij_betw (\<lambda>(x,y). (y,x)) (B \<times> A) (A \<times> B)"
eberlm@66480
   337
    by (auto simp: bij_betw_def inj_on_def)
eberlm@66480
   338
  show ?thesis
eberlm@66480
   339
    by (subst abs_summable_on_reindex_bij_betw[OF bij, of f, symmetric])
eberlm@66480
   340
       (simp_all add: case_prod_unfold)
eberlm@66480
   341
qed
eberlm@66480
   342
eberlm@66480
   343
lemma abs_summable_on_0 [simp, intro]: "(\<lambda>_. 0) abs_summable_on A"
eberlm@66480
   344
  by (simp add: abs_summable_on_def)
eberlm@66480
   345
eberlm@66480
   346
lemma abs_summable_on_uminus [intro]:
eberlm@66480
   347
  "f abs_summable_on A \<Longrightarrow> (\<lambda>x. -f x) abs_summable_on A"
eberlm@66480
   348
  unfolding abs_summable_on_def by (rule Bochner_Integration.integrable_minus)
eberlm@66480
   349
eberlm@66480
   350
lemma abs_summable_on_add [intro]:
eberlm@66480
   351
  assumes "f abs_summable_on A" and "g abs_summable_on A"
eberlm@66480
   352
  shows   "(\<lambda>x. f x + g x) abs_summable_on A"
eberlm@66480
   353
  using assms unfolding abs_summable_on_def by (rule Bochner_Integration.integrable_add)
eberlm@66480
   354
eberlm@66480
   355
lemma abs_summable_on_diff [intro]:
eberlm@66480
   356
  assumes "f abs_summable_on A" and "g abs_summable_on A"
eberlm@66480
   357
  shows   "(\<lambda>x. f x - g x) abs_summable_on A"
eberlm@66480
   358
  using assms unfolding abs_summable_on_def by (rule Bochner_Integration.integrable_diff)
eberlm@66480
   359
eberlm@66480
   360
lemma abs_summable_on_scaleR_left [intro]:
eberlm@66480
   361
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
eberlm@66480
   362
  shows   "(\<lambda>x. f x *\<^sub>R c) abs_summable_on A"
eberlm@66480
   363
  using assms unfolding abs_summable_on_def by (intro Bochner_Integration.integrable_scaleR_left)
eberlm@66480
   364
eberlm@66480
   365
lemma abs_summable_on_scaleR_right [intro]:
eberlm@66480
   366
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
eberlm@66480
   367
  shows   "(\<lambda>x. c *\<^sub>R f x) abs_summable_on A"
eberlm@66480
   368
  using assms unfolding abs_summable_on_def by (intro Bochner_Integration.integrable_scaleR_right)
eberlm@66480
   369
eberlm@66480
   370
lemma abs_summable_on_cmult_right [intro]:
eberlm@66480
   371
  fixes f :: "'a \<Rightarrow> 'b :: {banach, real_normed_algebra, second_countable_topology}"
eberlm@66480
   372
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
eberlm@66480
   373
  shows   "(\<lambda>x. c * f x) abs_summable_on A"
eberlm@66480
   374
  using assms unfolding abs_summable_on_def by (intro Bochner_Integration.integrable_mult_right)
eberlm@66480
   375
eberlm@66480
   376
lemma abs_summable_on_cmult_left [intro]:
eberlm@66480
   377
  fixes f :: "'a \<Rightarrow> 'b :: {banach, real_normed_algebra, second_countable_topology}"
eberlm@66480
   378
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
eberlm@66480
   379
  shows   "(\<lambda>x. f x * c) abs_summable_on A"
eberlm@66480
   380
  using assms unfolding abs_summable_on_def by (intro Bochner_Integration.integrable_mult_left)
eberlm@66480
   381
eberlm@66568
   382
lemma abs_summable_on_prod_PiE:
eberlm@66568
   383
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c :: {real_normed_field,banach,second_countable_topology}"
eberlm@66568
   384
  assumes finite: "finite A" and countable: "\<And>x. x \<in> A \<Longrightarrow> countable (B x)"
eberlm@66568
   385
  assumes summable: "\<And>x. x \<in> A \<Longrightarrow> f x abs_summable_on B x"
eberlm@66568
   386
  shows   "(\<lambda>g. \<Prod>x\<in>A. f x (g x)) abs_summable_on PiE A B"
eberlm@66568
   387
proof -
eberlm@66568
   388
  define B' where "B' = (\<lambda>x. if x \<in> A then B x else {})"
eberlm@66568
   389
  from assms have [simp]: "countable (B' x)" for x
eberlm@66568
   390
    by (auto simp: B'_def)
eberlm@66568
   391
  then interpret product_sigma_finite "count_space \<circ> B'"
eberlm@66568
   392
    unfolding o_def by (intro product_sigma_finite.intro sigma_finite_measure_count_space_countable)
eberlm@66568
   393
  from assms have "integrable (PiM A (count_space \<circ> B')) (\<lambda>g. \<Prod>x\<in>A. f x (g x))"
eberlm@66568
   394
    by (intro product_integrable_prod) (auto simp: abs_summable_on_def B'_def)
eberlm@66568
   395
  also have "PiM A (count_space \<circ> B') = count_space (PiE A B')"
eberlm@66568
   396
    unfolding o_def using finite by (intro count_space_PiM_finite) simp_all
eberlm@66568
   397
  also have "PiE A B' = PiE A B" by (intro PiE_cong) (simp_all add: B'_def)
eberlm@66568
   398
  finally show ?thesis by (simp add: abs_summable_on_def)
eberlm@66568
   399
qed
eberlm@66568
   400
eberlm@66480
   401
eberlm@66480
   402
eberlm@66480
   403
lemma not_summable_infsetsum_eq:
eberlm@66480
   404
  "\<not>f abs_summable_on A \<Longrightarrow> infsetsum f A = 0"
eberlm@66480
   405
  by (simp add: abs_summable_on_def infsetsum_def not_integrable_integral_eq)
eberlm@66480
   406
eberlm@66480
   407
lemma infsetsum_altdef:
eberlm@66480
   408
  "infsetsum f A = set_lebesgue_integral (count_space UNIV) A f"
lp15@67974
   409
  unfolding set_lebesgue_integral_def
eberlm@66480
   410
  by (subst integral_restrict_space [symmetric])
eberlm@66480
   411
     (auto simp: restrict_count_space_subset infsetsum_def)
eberlm@66480
   412
eberlm@66480
   413
lemma infsetsum_altdef':
eberlm@66480
   414
  "A \<subseteq> B \<Longrightarrow> infsetsum f A = set_lebesgue_integral (count_space B) A f"
lp15@67974
   415
  unfolding set_lebesgue_integral_def
eberlm@66480
   416
  by (subst integral_restrict_space [symmetric])
eberlm@66480
   417
     (auto simp: restrict_count_space_subset infsetsum_def)
eberlm@66480
   418
eberlm@66568
   419
lemma nn_integral_conv_infsetsum:
eberlm@66568
   420
  assumes "f abs_summable_on A" "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
eberlm@66568
   421
  shows   "nn_integral (count_space A) f = ennreal (infsetsum f A)"
eberlm@66568
   422
  using assms unfolding infsetsum_def abs_summable_on_def
eberlm@66568
   423
  by (subst nn_integral_eq_integral) auto
eberlm@66568
   424
eberlm@66568
   425
lemma infsetsum_conv_nn_integral:
eberlm@66568
   426
  assumes "nn_integral (count_space A) f \<noteq> \<infinity>" "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
eberlm@66568
   427
  shows   "infsetsum f A = enn2real (nn_integral (count_space A) f)"
eberlm@66568
   428
  unfolding infsetsum_def using assms
eberlm@66568
   429
  by (subst integral_eq_nn_integral) auto
eberlm@66568
   430
eberlm@66480
   431
lemma infsetsum_cong [cong]:
eberlm@66480
   432
  "(\<And>x. x \<in> A \<Longrightarrow> f x = g x) \<Longrightarrow> A = B \<Longrightarrow> infsetsum f A = infsetsum g B"
eberlm@66480
   433
  unfolding infsetsum_def by (intro Bochner_Integration.integral_cong) auto
eberlm@66480
   434
eberlm@66480
   435
lemma infsetsum_0 [simp]: "infsetsum (\<lambda>_. 0) A = 0"
eberlm@66480
   436
  by (simp add: infsetsum_def)
eberlm@66480
   437
eberlm@66480
   438
lemma infsetsum_all_0: "(\<And>x. x \<in> A \<Longrightarrow> f x = 0) \<Longrightarrow> infsetsum f A = 0"
eberlm@66480
   439
  by simp
eberlm@66480
   440
eberlm@67167
   441
lemma infsetsum_nonneg: "(\<And>x. x \<in> A \<Longrightarrow> f x \<ge> (0::real)) \<Longrightarrow> infsetsum f A \<ge> 0"
eberlm@67167
   442
  unfolding infsetsum_def by (rule Bochner_Integration.integral_nonneg) auto
eberlm@67167
   443
eberlm@67167
   444
lemma sum_infsetsum:
eberlm@67167
   445
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x abs_summable_on B"
eberlm@67167
   446
  shows   "(\<Sum>x\<in>A. \<Sum>\<^sub>ay\<in>B. f x y) = (\<Sum>\<^sub>ay\<in>B. \<Sum>x\<in>A. f x y)"
eberlm@67167
   447
  using assms by (simp add: infsetsum_def abs_summable_on_def Bochner_Integration.integral_sum)
eberlm@67167
   448
eberlm@67167
   449
lemma Re_infsetsum: "f abs_summable_on A \<Longrightarrow> Re (infsetsum f A) = (\<Sum>\<^sub>ax\<in>A. Re (f x))"
eberlm@67167
   450
  by (simp add: infsetsum_def abs_summable_on_def)
eberlm@67167
   451
eberlm@67167
   452
lemma Im_infsetsum: "f abs_summable_on A \<Longrightarrow> Im (infsetsum f A) = (\<Sum>\<^sub>ax\<in>A. Im (f x))"
eberlm@67167
   453
  by (simp add: infsetsum_def abs_summable_on_def)
eberlm@67167
   454
lp15@69710
   455
lemma infsetsum_of_real:
lp15@69710
   456
  shows "infsetsum (\<lambda>x. of_real (f x)
lp15@69710
   457
           :: 'a :: {real_normed_algebra_1,banach,second_countable_topology,real_inner}) A =
eberlm@67167
   458
             of_real (infsetsum f A)"
eberlm@67167
   459
  unfolding infsetsum_def
eberlm@67167
   460
  by (rule integral_bounded_linear'[OF bounded_linear_of_real bounded_linear_inner_left[of 1]]) auto
eberlm@67167
   461
eberlm@66480
   462
lemma infsetsum_finite [simp]: "finite A \<Longrightarrow> infsetsum f A = (\<Sum>x\<in>A. f x)"
eberlm@66480
   463
  by (simp add: infsetsum_def lebesgue_integral_count_space_finite)
eberlm@66480
   464
lp15@69710
   465
lemma infsetsum_nat:
eberlm@66480
   466
  assumes "f abs_summable_on A"
eberlm@66480
   467
  shows   "infsetsum f A = (\<Sum>n. if n \<in> A then f n else 0)"
eberlm@66480
   468
proof -
eberlm@66480
   469
  from assms have "infsetsum f A = (\<Sum>n. indicator A n *\<^sub>R f n)"
lp15@67974
   470
    unfolding infsetsum_altdef abs_summable_on_altdef set_lebesgue_integral_def set_integrable_def
lp15@67974
   471
 by (subst integral_count_space_nat) auto
eberlm@66480
   472
  also have "(\<lambda>n. indicator A n *\<^sub>R f n) = (\<lambda>n. if n \<in> A then f n else 0)"
eberlm@66480
   473
    by auto
eberlm@66480
   474
  finally show ?thesis .
eberlm@66480
   475
qed
eberlm@66480
   476
lp15@69710
   477
lemma infsetsum_nat':
eberlm@66480
   478
  assumes "f abs_summable_on UNIV"
eberlm@66480
   479
  shows   "infsetsum f UNIV = (\<Sum>n. f n)"
eberlm@66480
   480
  using assms by (subst infsetsum_nat) auto
eberlm@66480
   481
eberlm@66480
   482
lemma sums_infsetsum_nat:
eberlm@66480
   483
  assumes "f abs_summable_on A"
eberlm@66480
   484
  shows   "(\<lambda>n. if n \<in> A then f n else 0) sums infsetsum f A"
eberlm@66480
   485
proof -
eberlm@66480
   486
  from assms have "summable (\<lambda>n. if n \<in> A then norm (f n) else 0)"
eberlm@66480
   487
    by (simp add: abs_summable_on_nat_iff)
eberlm@66480
   488
  also have "(\<lambda>n. if n \<in> A then norm (f n) else 0) = (\<lambda>n. norm (if n \<in> A then f n else 0))"
eberlm@66480
   489
    by auto
eberlm@66480
   490
  finally have "summable (\<lambda>n. if n \<in> A then f n else 0)"
eberlm@66480
   491
    by (rule summable_norm_cancel)
eberlm@66480
   492
  with assms show ?thesis
eberlm@66480
   493
    by (auto simp: sums_iff infsetsum_nat)
eberlm@66480
   494
qed
eberlm@66480
   495
eberlm@66480
   496
lemma sums_infsetsum_nat':
eberlm@66480
   497
  assumes "f abs_summable_on UNIV"
eberlm@66480
   498
  shows   "f sums infsetsum f UNIV"
eberlm@66480
   499
  using sums_infsetsum_nat [OF assms] by simp
eberlm@66480
   500
eberlm@66480
   501
lemma infsetsum_Un_disjoint:
eberlm@66480
   502
  assumes "f abs_summable_on A" "f abs_summable_on B" "A \<inter> B = {}"
eberlm@66480
   503
  shows   "infsetsum f (A \<union> B) = infsetsum f A + infsetsum f B"
eberlm@66480
   504
  using assms unfolding infsetsum_altdef abs_summable_on_altdef
eberlm@66480
   505
  by (subst set_integral_Un) auto
eberlm@66480
   506
eberlm@66480
   507
lemma infsetsum_Diff:
eberlm@66480
   508
  assumes "f abs_summable_on B" "A \<subseteq> B"
eberlm@66480
   509
  shows   "infsetsum f (B - A) = infsetsum f B - infsetsum f A"
eberlm@66480
   510
proof -
eberlm@66480
   511
  have "infsetsum f ((B - A) \<union> A) = infsetsum f (B - A) + infsetsum f A"
eberlm@66480
   512
    using assms(2) by (intro infsetsum_Un_disjoint abs_summable_on_subset[OF assms(1)]) auto
eberlm@66480
   513
  also from assms(2) have "(B - A) \<union> A = B"
eberlm@66480
   514
    by auto
eberlm@66480
   515
  ultimately show ?thesis
eberlm@66480
   516
    by (simp add: algebra_simps)
eberlm@66480
   517
qed
eberlm@66480
   518
eberlm@66480
   519
lemma infsetsum_Un_Int:
eberlm@66480
   520
  assumes "f abs_summable_on (A \<union> B)"
eberlm@66480
   521
  shows   "infsetsum f (A \<union> B) = infsetsum f A + infsetsum f B - infsetsum f (A \<inter> B)"
eberlm@66480
   522
proof -
eberlm@66480
   523
  have "A \<union> B = A \<union> (B - A \<inter> B)"
eberlm@66480
   524
    by auto
eberlm@66480
   525
  also have "infsetsum f \<dots> = infsetsum f A + infsetsum f (B - A \<inter> B)"
eberlm@66480
   526
    by (intro infsetsum_Un_disjoint abs_summable_on_subset[OF assms]) auto
eberlm@66480
   527
  also have "infsetsum f (B - A \<inter> B) = infsetsum f B - infsetsum f (A \<inter> B)"
eberlm@66480
   528
    by (intro infsetsum_Diff abs_summable_on_subset[OF assms]) auto
lp15@69710
   529
  finally show ?thesis
eberlm@66480
   530
    by (simp add: algebra_simps)
eberlm@66480
   531
qed
eberlm@66480
   532
eberlm@66480
   533
lemma infsetsum_reindex_bij_betw:
eberlm@66480
   534
  assumes "bij_betw g A B"
eberlm@66480
   535
  shows   "infsetsum (\<lambda>x. f (g x)) A = infsetsum f B"
eberlm@66480
   536
proof -
eberlm@66480
   537
  have *: "count_space B = distr (count_space A) (count_space B) g"
eberlm@66480
   538
    by (rule distr_bij_count_space [symmetric]) fact
eberlm@66480
   539
  show ?thesis unfolding infsetsum_def
lp15@69710
   540
    by (subst *, subst integral_distr[of _ _ "count_space B"])
lp15@69710
   541
       (insert assms, auto simp: bij_betw_def)
eberlm@66480
   542
qed
eberlm@66480
   543
eberlm@68651
   544
theorem infsetsum_reindex:
eberlm@66480
   545
  assumes "inj_on g A"
eberlm@66480
   546
  shows   "infsetsum f (g ` A) = infsetsum (\<lambda>x. f (g x)) A"
eberlm@66480
   547
  by (intro infsetsum_reindex_bij_betw [symmetric] inj_on_imp_bij_betw assms)
eberlm@66480
   548
eberlm@66480
   549
lemma infsetsum_cong_neutral:
eberlm@66480
   550
  assumes "\<And>x. x \<in> A - B \<Longrightarrow> f x = 0"
eberlm@66480
   551
  assumes "\<And>x. x \<in> B - A \<Longrightarrow> g x = 0"
eberlm@66480
   552
  assumes "\<And>x. x \<in> A \<inter> B \<Longrightarrow> f x = g x"
eberlm@66480
   553
  shows   "infsetsum f A = infsetsum g B"
lp15@67974
   554
  unfolding infsetsum_altdef set_lebesgue_integral_def using assms
eberlm@66480
   555
  by (intro Bochner_Integration.integral_cong refl)
eberlm@66480
   556
     (auto simp: indicator_def split: if_splits)
eberlm@66480
   557
eberlm@66526
   558
lemma infsetsum_mono_neutral:
eberlm@66526
   559
  fixes f g :: "'a \<Rightarrow> real"
eberlm@66526
   560
  assumes "f abs_summable_on A" and "g abs_summable_on B"
eberlm@66526
   561
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<le> g x"
eberlm@66526
   562
  assumes "\<And>x. x \<in> A - B \<Longrightarrow> f x \<le> 0"
eberlm@66526
   563
  assumes "\<And>x. x \<in> B - A \<Longrightarrow> g x \<ge> 0"
eberlm@66526
   564
  shows   "infsetsum f A \<le> infsetsum g B"
lp15@67974
   565
  using assms unfolding infsetsum_altdef set_lebesgue_integral_def abs_summable_on_altdef set_integrable_def
eberlm@66526
   566
  by (intro Bochner_Integration.integral_mono) (auto simp: indicator_def)
eberlm@66526
   567
eberlm@66526
   568
lemma infsetsum_mono_neutral_left:
eberlm@66526
   569
  fixes f g :: "'a \<Rightarrow> real"
eberlm@66526
   570
  assumes "f abs_summable_on A" and "g abs_summable_on B"
eberlm@66526
   571
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<le> g x"
eberlm@66526
   572
  assumes "A \<subseteq> B"
eberlm@66526
   573
  assumes "\<And>x. x \<in> B - A \<Longrightarrow> g x \<ge> 0"
eberlm@66526
   574
  shows   "infsetsum f A \<le> infsetsum g B"
eberlm@66526
   575
  using \<open>A \<subseteq> B\<close> by (intro infsetsum_mono_neutral assms) auto
eberlm@66526
   576
eberlm@66526
   577
lemma infsetsum_mono_neutral_right:
eberlm@66526
   578
  fixes f g :: "'a \<Rightarrow> real"
eberlm@66526
   579
  assumes "f abs_summable_on A" and "g abs_summable_on B"
eberlm@66526
   580
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<le> g x"
eberlm@66526
   581
  assumes "B \<subseteq> A"
eberlm@66526
   582
  assumes "\<And>x. x \<in> A - B \<Longrightarrow> f x \<le> 0"
eberlm@66526
   583
  shows   "infsetsum f A \<le> infsetsum g B"
eberlm@66526
   584
  using \<open>B \<subseteq> A\<close> by (intro infsetsum_mono_neutral assms) auto
eberlm@66526
   585
eberlm@66526
   586
lemma infsetsum_mono:
eberlm@66526
   587
  fixes f g :: "'a \<Rightarrow> real"
eberlm@66526
   588
  assumes "f abs_summable_on A" and "g abs_summable_on A"
eberlm@66526
   589
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<le> g x"
eberlm@66526
   590
  shows   "infsetsum f A \<le> infsetsum g A"
eberlm@66526
   591
  by (intro infsetsum_mono_neutral assms) auto
eberlm@66526
   592
eberlm@66526
   593
lemma norm_infsetsum_bound:
eberlm@66526
   594
  "norm (infsetsum f A) \<le> infsetsum (\<lambda>x. norm (f x)) A"
eberlm@66526
   595
  unfolding abs_summable_on_def infsetsum_def
eberlm@66526
   596
  by (rule Bochner_Integration.integral_norm_bound)
eberlm@66526
   597
eberlm@68651
   598
theorem infsetsum_Sigma:
eberlm@66480
   599
  fixes A :: "'a set" and B :: "'a \<Rightarrow> 'b set"
eberlm@66480
   600
  assumes [simp]: "countable A" and "\<And>i. countable (B i)"
eberlm@66480
   601
  assumes summable: "f abs_summable_on (Sigma A B)"
eberlm@66480
   602
  shows   "infsetsum f (Sigma A B) = infsetsum (\<lambda>x. infsetsum (\<lambda>y. f (x, y)) (B x)) A"
eberlm@66480
   603
proof -
eberlm@66480
   604
  define B' where "B' = (\<Union>i\<in>A. B i)"
lp15@69710
   605
  have [simp]: "countable B'"
eberlm@66480
   606
    unfolding B'_def by (intro countable_UN assms)
eberlm@66480
   607
  interpret pair_sigma_finite "count_space A" "count_space B'"
eberlm@66480
   608
    by (intro pair_sigma_finite.intro sigma_finite_measure_count_space_countable) fact+
eberlm@66480
   609
eberlm@66480
   610
  have "integrable (count_space (A \<times> B')) (\<lambda>z. indicator (Sigma A B) z *\<^sub>R f z)"
lp15@67974
   611
    using summable
lp15@67974
   612
    by (metis (mono_tags, lifting) abs_summable_on_altdef abs_summable_on_def integrable_cong integrable_mult_indicator set_integrable_def sets_UNIV)
eberlm@66480
   613
  also have "?this \<longleftrightarrow> integrable (count_space A \<Otimes>\<^sub>M count_space B') (\<lambda>(x, y). indicator (B x) y *\<^sub>R f (x, y))"
eberlm@66480
   614
    by (intro Bochner_Integration.integrable_cong)
eberlm@66480
   615
       (auto simp: pair_measure_countable indicator_def split: if_splits)
eberlm@66480
   616
  finally have integrable: \<dots> .
lp15@69710
   617
eberlm@66480
   618
  have "infsetsum (\<lambda>x. infsetsum (\<lambda>y. f (x, y)) (B x)) A =
eberlm@66480
   619
          (\<integral>x. infsetsum (\<lambda>y. f (x, y)) (B x) \<partial>count_space A)"
eberlm@66480
   620
    unfolding infsetsum_def by simp
eberlm@66480
   621
  also have "\<dots> = (\<integral>x. \<integral>y. indicator (B x) y *\<^sub>R f (x, y) \<partial>count_space B' \<partial>count_space A)"
lp15@67974
   622
  proof (rule Bochner_Integration.integral_cong [OF refl])
lp15@67974
   623
    show "\<And>x. x \<in> space (count_space A) \<Longrightarrow>
lp15@67974
   624
         (\<Sum>\<^sub>ay\<in>B x. f (x, y)) = LINT y|count_space B'. indicat_real (B x) y *\<^sub>R f (x, y)"
lp15@69710
   625
      using infsetsum_altdef'[of _ B']
lp15@67974
   626
      unfolding set_lebesgue_integral_def B'_def
lp15@69710
   627
      by auto
lp15@67974
   628
  qed
eberlm@66480
   629
  also have "\<dots> = (\<integral>(x,y). indicator (B x) y *\<^sub>R f (x, y) \<partial>(count_space A \<Otimes>\<^sub>M count_space B'))"
eberlm@66480
   630
    by (subst integral_fst [OF integrable]) auto
eberlm@66480
   631
  also have "\<dots> = (\<integral>z. indicator (Sigma A B) z *\<^sub>R f z \<partial>count_space (A \<times> B'))"
eberlm@66480
   632
    by (intro Bochner_Integration.integral_cong)
eberlm@66480
   633
       (auto simp: pair_measure_countable indicator_def split: if_splits)
eberlm@66480
   634
  also have "\<dots> = infsetsum f (Sigma A B)"
lp15@67974
   635
    unfolding set_lebesgue_integral_def [symmetric]
eberlm@66480
   636
    by (rule infsetsum_altdef' [symmetric]) (auto simp: B'_def)
eberlm@66480
   637
  finally show ?thesis ..
eberlm@66480
   638
qed
eberlm@66480
   639
eberlm@66526
   640
lemma infsetsum_Sigma':
eberlm@66526
   641
  fixes A :: "'a set" and B :: "'a \<Rightarrow> 'b set"
eberlm@66526
   642
  assumes [simp]: "countable A" and "\<And>i. countable (B i)"
eberlm@66526
   643
  assumes summable: "(\<lambda>(x,y). f x y) abs_summable_on (Sigma A B)"
eberlm@66526
   644
  shows   "infsetsum (\<lambda>x. infsetsum (\<lambda>y. f x y) (B x)) A = infsetsum (\<lambda>(x,y). f x y) (Sigma A B)"
eberlm@66526
   645
  using assms by (subst infsetsum_Sigma) auto
eberlm@66526
   646
eberlm@66480
   647
lemma infsetsum_Times:
eberlm@66480
   648
  fixes A :: "'a set" and B :: "'b set"
eberlm@66480
   649
  assumes [simp]: "countable A" and "countable B"
eberlm@66480
   650
  assumes summable: "f abs_summable_on (A \<times> B)"
eberlm@66480
   651
  shows   "infsetsum f (A \<times> B) = infsetsum (\<lambda>x. infsetsum (\<lambda>y. f (x, y)) B) A"
eberlm@66480
   652
  using assms by (subst infsetsum_Sigma) auto
eberlm@66480
   653
eberlm@66480
   654
lemma infsetsum_Times':
eberlm@66480
   655
  fixes A :: "'a set" and B :: "'b set"
eberlm@66480
   656
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c :: {banach, second_countable_topology}"
eberlm@66480
   657
  assumes [simp]: "countable A" and [simp]: "countable B"
eberlm@66480
   658
  assumes summable: "(\<lambda>(x,y). f x y) abs_summable_on (A \<times> B)"
eberlm@66480
   659
  shows   "infsetsum (\<lambda>x. infsetsum (\<lambda>y. f x y) B) A = infsetsum (\<lambda>(x,y). f x y) (A \<times> B)"
eberlm@66480
   660
  using assms by (subst infsetsum_Times) auto
eberlm@66480
   661
eberlm@66480
   662
lemma infsetsum_swap:
eberlm@66480
   663
  fixes A :: "'a set" and B :: "'b set"
eberlm@66480
   664
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c :: {banach, second_countable_topology}"
eberlm@66480
   665
  assumes [simp]: "countable A" and [simp]: "countable B"
eberlm@66480
   666
  assumes summable: "(\<lambda>(x,y). f x y) abs_summable_on A \<times> B"
eberlm@66480
   667
  shows   "infsetsum (\<lambda>x. infsetsum (\<lambda>y. f x y) B) A = infsetsum (\<lambda>y. infsetsum (\<lambda>x. f x y) A) B"
eberlm@66480
   668
proof -
eberlm@66480
   669
  from summable have summable': "(\<lambda>(x,y). f y x) abs_summable_on B \<times> A"
eberlm@66480
   670
    by (subst abs_summable_on_Times_swap) auto
eberlm@66480
   671
  have bij: "bij_betw (\<lambda>(x, y). (y, x)) (B \<times> A) (A \<times> B)"
eberlm@66480
   672
    by (auto simp: bij_betw_def inj_on_def)
eberlm@66480
   673
  have "infsetsum (\<lambda>x. infsetsum (\<lambda>y. f x y) B) A = infsetsum (\<lambda>(x,y). f x y) (A \<times> B)"
eberlm@66480
   674
    using summable by (subst infsetsum_Times) auto
eberlm@66480
   675
  also have "\<dots> = infsetsum (\<lambda>(x,y). f y x) (B \<times> A)"
eberlm@66480
   676
    by (subst infsetsum_reindex_bij_betw[OF bij, of "\<lambda>(x,y). f x y", symmetric])
eberlm@66480
   677
       (simp_all add: case_prod_unfold)
eberlm@66480
   678
  also have "\<dots> = infsetsum (\<lambda>y. infsetsum (\<lambda>x. f x y) A) B"
eberlm@66480
   679
    using summable' by (subst infsetsum_Times) auto
eberlm@66480
   680
  finally show ?thesis .
eberlm@66480
   681
qed
eberlm@66480
   682
eberlm@68651
   683
theorem abs_summable_on_Sigma_iff:
eberlm@66526
   684
  assumes [simp]: "countable A" and "\<And>x. x \<in> A \<Longrightarrow> countable (B x)"
lp15@69710
   685
  shows   "f abs_summable_on Sigma A B \<longleftrightarrow>
eberlm@66526
   686
             (\<forall>x\<in>A. (\<lambda>y. f (x, y)) abs_summable_on B x) \<and>
eberlm@66526
   687
             ((\<lambda>x. infsetsum (\<lambda>y. norm (f (x, y))) (B x)) abs_summable_on A)"
eberlm@66526
   688
proof safe
eberlm@66526
   689
  define B' where "B' = (\<Union>x\<in>A. B x)"
lp15@69710
   690
  have [simp]: "countable B'"
eberlm@66526
   691
    unfolding B'_def using assms by auto
eberlm@66526
   692
  interpret pair_sigma_finite "count_space A" "count_space B'"
eberlm@66526
   693
    by (intro pair_sigma_finite.intro sigma_finite_measure_count_space_countable) fact+
eberlm@66526
   694
  {
eberlm@66526
   695
    assume *: "f abs_summable_on Sigma A B"
eberlm@66526
   696
    thus "(\<lambda>y. f (x, y)) abs_summable_on B x" if "x \<in> A" for x
eberlm@66526
   697
      using that by (rule abs_summable_on_Sigma_project2)
eberlm@66526
   698
eberlm@66526
   699
    have "set_integrable (count_space (A \<times> B')) (Sigma A B) (\<lambda>z. norm (f z))"
eberlm@66526
   700
      using abs_summable_on_normI[OF *]
eberlm@66526
   701
      by (subst abs_summable_on_altdef' [symmetric]) (auto simp: B'_def)
eberlm@66526
   702
    also have "count_space (A \<times> B') = count_space A \<Otimes>\<^sub>M count_space B'"
eberlm@66526
   703
      by (simp add: pair_measure_countable)
lp15@69710
   704
    finally have "integrable (count_space A)
lp15@69710
   705
                    (\<lambda>x. lebesgue_integral (count_space B')
eberlm@66526
   706
                      (\<lambda>y. indicator (Sigma A B) (x, y) *\<^sub>R norm (f (x, y))))"
lp15@67974
   707
      unfolding set_integrable_def by (rule integrable_fst')
eberlm@66526
   708
    also have "?this \<longleftrightarrow> integrable (count_space A)
lp15@69710
   709
                    (\<lambda>x. lebesgue_integral (count_space B')
eberlm@66526
   710
                      (\<lambda>y. indicator (B x) y *\<^sub>R norm (f (x, y))))"
eberlm@66526
   711
      by (intro integrable_cong refl) (simp_all add: indicator_def)
eberlm@66526
   712
    also have "\<dots> \<longleftrightarrow> integrable (count_space A) (\<lambda>x. infsetsum (\<lambda>y. norm (f (x, y))) (B x))"
lp15@67974
   713
      unfolding set_lebesgue_integral_def [symmetric]
eberlm@66526
   714
      by (intro integrable_cong refl infsetsum_altdef' [symmetric]) (auto simp: B'_def)
eberlm@66526
   715
    also have "\<dots> \<longleftrightarrow> (\<lambda>x. infsetsum (\<lambda>y. norm (f (x, y))) (B x)) abs_summable_on A"
eberlm@66526
   716
      by (simp add: abs_summable_on_def)
eberlm@66526
   717
    finally show \<dots> .
eberlm@66526
   718
  }
eberlm@66526
   719
  {
eberlm@66526
   720
    assume *: "\<forall>x\<in>A. (\<lambda>y. f (x, y)) abs_summable_on B x"
eberlm@66526
   721
    assume "(\<lambda>x. \<Sum>\<^sub>ay\<in>B x. norm (f (x, y))) abs_summable_on A"
eberlm@66526
   722
    also have "?this \<longleftrightarrow> (\<lambda>x. \<integral>y\<in>B x. norm (f (x, y)) \<partial>count_space B') abs_summable_on A"
eberlm@66526
   723
      by (intro abs_summable_on_cong refl infsetsum_altdef') (auto simp: B'_def)
eberlm@66526
   724
    also have "\<dots> \<longleftrightarrow> (\<lambda>x. \<integral>y. indicator (Sigma A B) (x, y) *\<^sub>R norm (f (x, y)) \<partial>count_space B')
eberlm@66526
   725
                        abs_summable_on A" (is "_ \<longleftrightarrow> ?h abs_summable_on _")
lp15@67974
   726
      unfolding set_lebesgue_integral_def
eberlm@66526
   727
      by (intro abs_summable_on_cong) (auto simp: indicator_def)
eberlm@66526
   728
    also have "\<dots> \<longleftrightarrow> integrable (count_space A) ?h"
eberlm@66526
   729
      by (simp add: abs_summable_on_def)
eberlm@66526
   730
    finally have **: \<dots> .
eberlm@66526
   731
eberlm@66526
   732
    have "integrable (count_space A \<Otimes>\<^sub>M count_space B') (\<lambda>z. indicator (Sigma A B) z *\<^sub>R f z)"
eberlm@66526
   733
    proof (rule Fubini_integrable, goal_cases)
eberlm@66526
   734
      case 3
eberlm@66526
   735
      {
eberlm@66526
   736
        fix x assume x: "x \<in> A"
eberlm@66526
   737
        with * have "(\<lambda>y. f (x, y)) abs_summable_on B x"
eberlm@66526
   738
          by blast
lp15@69710
   739
        also have "?this \<longleftrightarrow> integrable (count_space B')
eberlm@66526
   740
                      (\<lambda>y. indicator (B x) y *\<^sub>R f (x, y))"
lp15@67974
   741
          unfolding set_integrable_def [symmetric]
lp15@67974
   742
         using x by (intro abs_summable_on_altdef') (auto simp: B'_def)
lp15@69710
   743
        also have "(\<lambda>y. indicator (B x) y *\<^sub>R f (x, y)) =
eberlm@66526
   744
                     (\<lambda>y. indicator (Sigma A B) (x, y) *\<^sub>R f (x, y))"
eberlm@66526
   745
          using x by (auto simp: indicator_def)
eberlm@66526
   746
        finally have "integrable (count_space B')
eberlm@66526
   747
                        (\<lambda>y. indicator (Sigma A B) (x, y) *\<^sub>R f (x, y))" .
eberlm@66526
   748
      }
eberlm@66526
   749
      thus ?case by (auto simp: AE_count_space)
eberlm@66526
   750
    qed (insert **, auto simp: pair_measure_countable)
lp15@67974
   751
    moreover have "count_space A \<Otimes>\<^sub>M count_space B' = count_space (A \<times> B')"
eberlm@66526
   752
      by (simp add: pair_measure_countable)
lp15@67974
   753
    moreover have "set_integrable (count_space (A \<times> B')) (Sigma A B) f \<longleftrightarrow>
eberlm@66526
   754
                 f abs_summable_on Sigma A B"
eberlm@66526
   755
      by (rule abs_summable_on_altdef' [symmetric]) (auto simp: B'_def)
lp15@67974
   756
    ultimately show "f abs_summable_on Sigma A B"
lp15@67974
   757
      by (simp add: set_integrable_def)
eberlm@66526
   758
  }
eberlm@66526
   759
qed
eberlm@66526
   760
eberlm@66526
   761
lemma abs_summable_on_Sigma_project1:
eberlm@66526
   762
  assumes "(\<lambda>(x,y). f x y) abs_summable_on Sigma A B"
eberlm@66526
   763
  assumes [simp]: "countable A" and "\<And>x. x \<in> A \<Longrightarrow> countable (B x)"
eberlm@66526
   764
  shows   "(\<lambda>x. infsetsum (\<lambda>y. norm (f x y)) (B x)) abs_summable_on A"
eberlm@66526
   765
  using assms by (subst (asm) abs_summable_on_Sigma_iff) auto
eberlm@66526
   766
eberlm@66526
   767
lemma abs_summable_on_Sigma_project1':
eberlm@66526
   768
  assumes "(\<lambda>(x,y). f x y) abs_summable_on Sigma A B"
eberlm@66526
   769
  assumes [simp]: "countable A" and "\<And>x. x \<in> A \<Longrightarrow> countable (B x)"
eberlm@66526
   770
  shows   "(\<lambda>x. infsetsum (\<lambda>y. f x y) (B x)) abs_summable_on A"
eberlm@66526
   771
  by (intro abs_summable_on_comparison_test' [OF abs_summable_on_Sigma_project1[OF assms]]
eberlm@66526
   772
        norm_infsetsum_bound)
eberlm@66526
   773
eberlm@68651
   774
theorem infsetsum_prod_PiE:
eberlm@66480
   775
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c :: {real_normed_field,banach,second_countable_topology}"
eberlm@66480
   776
  assumes finite: "finite A" and countable: "\<And>x. x \<in> A \<Longrightarrow> countable (B x)"
eberlm@66480
   777
  assumes summable: "\<And>x. x \<in> A \<Longrightarrow> f x abs_summable_on B x"
eberlm@66480
   778
  shows   "infsetsum (\<lambda>g. \<Prod>x\<in>A. f x (g x)) (PiE A B) = (\<Prod>x\<in>A. infsetsum (f x) (B x))"
eberlm@66480
   779
proof -
eberlm@66480
   780
  define B' where "B' = (\<lambda>x. if x \<in> A then B x else {})"
eberlm@66480
   781
  from assms have [simp]: "countable (B' x)" for x
eberlm@66480
   782
    by (auto simp: B'_def)
eberlm@66480
   783
  then interpret product_sigma_finite "count_space \<circ> B'"
eberlm@66480
   784
    unfolding o_def by (intro product_sigma_finite.intro sigma_finite_measure_count_space_countable)
eberlm@66480
   785
  have "infsetsum (\<lambda>g. \<Prod>x\<in>A. f x (g x)) (PiE A B) =
eberlm@66480
   786
          (\<integral>g. (\<Prod>x\<in>A. f x (g x)) \<partial>count_space (PiE A B))"
eberlm@66480
   787
    by (simp add: infsetsum_def)
eberlm@66480
   788
  also have "PiE A B = PiE A B'"
eberlm@66480
   789
    by (intro PiE_cong) (simp_all add: B'_def)
eberlm@66480
   790
  hence "count_space (PiE A B) = count_space (PiE A B')"
eberlm@66480
   791
    by simp
eberlm@66480
   792
  also have "\<dots> = PiM A (count_space \<circ> B')"
eberlm@66480
   793
    unfolding o_def using finite by (intro count_space_PiM_finite [symmetric]) simp_all
eberlm@66480
   794
  also have "(\<integral>g. (\<Prod>x\<in>A. f x (g x)) \<partial>\<dots>) = (\<Prod>x\<in>A. infsetsum (f x) (B' x))"
lp15@69710
   795
    by (subst product_integral_prod)
eberlm@66480
   796
       (insert summable finite, simp_all add: infsetsum_def B'_def abs_summable_on_def)
eberlm@66480
   797
  also have "\<dots> = (\<Prod>x\<in>A. infsetsum (f x) (B x))"
eberlm@66480
   798
    by (intro prod.cong refl) (simp_all add: B'_def)
eberlm@66480
   799
  finally show ?thesis .
eberlm@66480
   800
qed
eberlm@66480
   801
eberlm@66480
   802
lemma infsetsum_uminus: "infsetsum (\<lambda>x. -f x) A = -infsetsum f A"
lp15@69710
   803
  unfolding infsetsum_def abs_summable_on_def
eberlm@66480
   804
  by (rule Bochner_Integration.integral_minus)
eberlm@66480
   805
eberlm@66480
   806
lemma infsetsum_add:
eberlm@66480
   807
  assumes "f abs_summable_on A" and "g abs_summable_on A"
eberlm@66480
   808
  shows   "infsetsum (\<lambda>x. f x + g x) A = infsetsum f A + infsetsum g A"
lp15@69710
   809
  using assms unfolding infsetsum_def abs_summable_on_def
eberlm@66480
   810
  by (rule Bochner_Integration.integral_add)
eberlm@66480
   811
eberlm@66480
   812
lemma infsetsum_diff:
eberlm@66480
   813
  assumes "f abs_summable_on A" and "g abs_summable_on A"
eberlm@66480
   814
  shows   "infsetsum (\<lambda>x. f x - g x) A = infsetsum f A - infsetsum g A"
lp15@69710
   815
  using assms unfolding infsetsum_def abs_summable_on_def
eberlm@66480
   816
  by (rule Bochner_Integration.integral_diff)
eberlm@66480
   817
eberlm@66480
   818
lemma infsetsum_scaleR_left:
eberlm@66480
   819
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
eberlm@66480
   820
  shows   "infsetsum (\<lambda>x. f x *\<^sub>R c) A = infsetsum f A *\<^sub>R c"
lp15@69710
   821
  using assms unfolding infsetsum_def abs_summable_on_def
eberlm@66480
   822
  by (rule Bochner_Integration.integral_scaleR_left)
eberlm@66480
   823
eberlm@66480
   824
lemma infsetsum_scaleR_right:
eberlm@66480
   825
  "infsetsum (\<lambda>x. c *\<^sub>R f x) A = c *\<^sub>R infsetsum f A"
lp15@69710
   826
  unfolding infsetsum_def abs_summable_on_def
eberlm@66480
   827
  by (subst Bochner_Integration.integral_scaleR_right) auto
eberlm@66480
   828
eberlm@66480
   829
lemma infsetsum_cmult_left:
eberlm@66480
   830
  fixes f :: "'a \<Rightarrow> 'b :: {banach, real_normed_algebra, second_countable_topology}"
eberlm@66480
   831
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
eberlm@66480
   832
  shows   "infsetsum (\<lambda>x. f x * c) A = infsetsum f A * c"
lp15@69710
   833
  using assms unfolding infsetsum_def abs_summable_on_def
eberlm@66480
   834
  by (rule Bochner_Integration.integral_mult_left)
eberlm@66480
   835
eberlm@66480
   836
lemma infsetsum_cmult_right:
eberlm@66480
   837
  fixes f :: "'a \<Rightarrow> 'b :: {banach, real_normed_algebra, second_countable_topology}"
eberlm@66480
   838
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
eberlm@66480
   839
  shows   "infsetsum (\<lambda>x. c * f x) A = c * infsetsum f A"
lp15@69710
   840
  using assms unfolding infsetsum_def abs_summable_on_def
eberlm@66480
   841
  by (rule Bochner_Integration.integral_mult_right)
eberlm@66480
   842
eberlm@66526
   843
lemma infsetsum_cdiv:
eberlm@66526
   844
  fixes f :: "'a \<Rightarrow> 'b :: {banach, real_normed_field, second_countable_topology}"
eberlm@66526
   845
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
eberlm@66526
   846
  shows   "infsetsum (\<lambda>x. f x / c) A = infsetsum f A / c"
eberlm@66526
   847
  using assms unfolding infsetsum_def abs_summable_on_def by auto
eberlm@66526
   848
eberlm@66526
   849
eberlm@66480
   850
(* TODO Generalise with bounded_linear *)
eberlm@66480
   851
eberlm@66526
   852
lemma
eberlm@66526
   853
  fixes f :: "'a \<Rightarrow> 'c :: {banach, real_normed_field, second_countable_topology}"
eberlm@66526
   854
  assumes [simp]: "countable A" and [simp]: "countable B"
eberlm@66526
   855
  assumes "f abs_summable_on A" and "g abs_summable_on B"
eberlm@66526
   856
  shows   abs_summable_on_product: "(\<lambda>(x,y). f x * g y) abs_summable_on A \<times> B"
eberlm@66526
   857
    and   infsetsum_product: "infsetsum (\<lambda>(x,y). f x * g y) (A \<times> B) =
eberlm@66526
   858
                                infsetsum f A * infsetsum g B"
eberlm@66526
   859
proof -
eberlm@66526
   860
  from assms show "(\<lambda>(x,y). f x * g y) abs_summable_on A \<times> B"
eberlm@66526
   861
    by (subst abs_summable_on_Sigma_iff)
eberlm@66526
   862
       (auto intro!: abs_summable_on_cmult_right simp: norm_mult infsetsum_cmult_right)
eberlm@66526
   863
  with assms show "infsetsum (\<lambda>(x,y). f x * g y) (A \<times> B) = infsetsum f A * infsetsum g B"
eberlm@66526
   864
    by (subst infsetsum_Sigma)
eberlm@66526
   865
       (auto simp: infsetsum_cmult_left infsetsum_cmult_right)
eberlm@66526
   866
qed
eberlm@66526
   867
eberlm@66480
   868
end