2427 fixes f :: \<open>'a \<Rightarrow> complex\<close> |
2393 fixes f :: \<open>'a \<Rightarrow> complex\<close> |
2428 assumes \<open>f summable_on A\<close> |
2394 assumes \<open>f summable_on A\<close> |
2429 shows \<open>countable {x\<in>A. f x \<noteq> 0}\<close> |
2395 shows \<open>countable {x\<in>A. f x \<noteq> 0}\<close> |
2430 using abs_summable_countable assms summable_on_iff_abs_summable_on_complex by blast |
2396 using abs_summable_countable assms summable_on_iff_abs_summable_on_complex by blast |
2431 |
2397 |
|
2398 abbreviation has_sum' (infixr "has'_sum" 46) where |
|
2399 "(f has_sum S) A \<equiv> Infinite_Sum.has_sum f A S" |
|
2400 |
|
2401 |
|
2402 |
|
2403 (* TODO: figure all this out *) |
|
2404 inductive (in topological_space) convergent_filter :: "'a filter \<Rightarrow> bool" where |
|
2405 "F \<le> nhds x \<Longrightarrow> convergent_filter F" |
|
2406 |
|
2407 lemma (in topological_space) convergent_filter_iff: "convergent_filter F \<longleftrightarrow> (\<exists>x. F \<le> nhds x)" |
|
2408 by (auto simp: convergent_filter.simps) |
|
2409 |
|
2410 lemma (in uniform_space) cauchy_filter_mono: |
|
2411 "cauchy_filter F \<Longrightarrow> F' \<le> F \<Longrightarrow> cauchy_filter F'" |
|
2412 unfolding cauchy_filter_def by (meson dual_order.trans prod_filter_mono) |
|
2413 |
|
2414 lemma (in uniform_space) convergent_filter_cauchy: |
|
2415 assumes "convergent_filter F" |
|
2416 shows "cauchy_filter F" |
|
2417 using assms cauchy_filter_mono nhds_imp_cauchy_filter[OF order.refl] |
|
2418 by (auto simp: convergent_filter_iff) |
|
2419 |
|
2420 lemma (in topological_space) convergent_filter_bot [simp, intro]: "convergent_filter bot" |
|
2421 by (simp add: convergent_filter_iff) |
|
2422 |
|
2423 |
|
2424 |
|
2425 class complete_uniform_space = uniform_space + |
|
2426 assumes cauchy_filter_convergent': "cauchy_filter (F :: 'a filter) \<Longrightarrow> F \<noteq> bot \<Longrightarrow> convergent_filter F" |
|
2427 |
|
2428 lemma (in complete_uniform_space) |
|
2429 cauchy_filter_convergent: "cauchy_filter (F :: 'a filter) \<Longrightarrow> convergent_filter F" |
|
2430 using cauchy_filter_convergent'[of F] by (cases "F = bot") auto |
|
2431 |
|
2432 lemma (in complete_uniform_space) convergent_filter_iff_cauchy: |
|
2433 "convergent_filter F \<longleftrightarrow> cauchy_filter F" |
|
2434 using convergent_filter_cauchy cauchy_filter_convergent by blast |
|
2435 |
|
2436 definition countably_generated_filter :: "'a filter \<Rightarrow> bool" where |
|
2437 "countably_generated_filter F \<longleftrightarrow> (\<exists>U :: nat \<Rightarrow> 'a set. F = (INF (n::nat). principal (U n)))" |
|
2438 |
|
2439 lemma countably_generated_filter_has_antimono_basis: |
|
2440 assumes "countably_generated_filter F" |
|
2441 obtains B :: "nat \<Rightarrow> 'a set" |
|
2442 where "antimono B" and "F = (INF n. principal (B n))" and |
|
2443 "\<And>P. eventually P F \<longleftrightarrow> (\<exists>i. \<forall>x\<in>B i. P x)" |
|
2444 proof - |
|
2445 from assms obtain B where B: "F = (INF (n::nat). principal (B n))" |
|
2446 unfolding countably_generated_filter_def by blast |
|
2447 |
|
2448 define B' where "B' = (\<lambda>n. \<Inter>k\<le>n. B k)" |
|
2449 have "antimono B'" |
|
2450 unfolding decseq_def B'_def by force |
|
2451 |
|
2452 have "(INF n. principal (B' n)) = (INF n. INF k\<in>{..n}. principal (B k))" |
|
2453 unfolding B'_def by (intro INF_cong refl INF_principal_finite [symmetric]) auto |
|
2454 also have "\<dots> = (INF (n::nat). principal (B n))" |
|
2455 apply (intro antisym) |
|
2456 apply (meson INF_lower INF_mono atMost_iff order_refl) |
|
2457 apply (meson INF_greatest INF_lower UNIV_I) |
|
2458 done |
|
2459 also have "\<dots> = F" |
|
2460 by (simp add: B) |
|
2461 finally have F: "F = (INF n. principal (B' n))" .. |
|
2462 |
|
2463 moreover have "eventually P F \<longleftrightarrow> (\<exists>i. eventually P (principal (B' i)))" for P |
|
2464 unfolding F using \<open>antimono B'\<close> |
|
2465 apply (subst eventually_INF_base) |
|
2466 apply (auto simp: decseq_def) |
|
2467 by (meson nat_le_linear) |
|
2468 ultimately show ?thesis |
|
2469 using \<open>antimono B'\<close> that[of B'] unfolding eventually_principal by blast |
|
2470 qed |
|
2471 |
|
2472 lemma (in uniform_space) cauchy_filter_iff: |
|
2473 "cauchy_filter F \<longleftrightarrow> (\<forall>P. eventually P uniformity \<longrightarrow> (\<exists>X. eventually (\<lambda>x. x \<in> X) F \<and> (\<forall>z\<in>X\<times>X. P z)))" |
|
2474 unfolding cauchy_filter_def le_filter_def |
|
2475 apply auto |
|
2476 apply (smt (z3) eventually_mono eventually_prod_same mem_Collect_eq) |
|
2477 using eventually_prod_same by blast |
|
2478 |
|
2479 lemma (in uniform_space) controlled_sequences_convergent_imp_complete_aux_sequence: |
|
2480 fixes U :: "nat \<Rightarrow> ('a \<times> 'a) set" |
|
2481 fixes F :: "'a filter" |
|
2482 assumes "cauchy_filter F" "F \<noteq> bot" |
|
2483 assumes "\<And>n. eventually (\<lambda>z. z \<in> U n) uniformity" |
|
2484 obtains g G where |
|
2485 "antimono G" "\<And>n. g n \<in> G n" |
|
2486 "\<And>n. eventually (\<lambda>x. x \<in> G n) F" "\<And>n. G n \<times> G n \<subseteq> U n" |
|
2487 proof - |
|
2488 have "\<exists>C. eventually (\<lambda>x. x \<in> C) F \<and> C \<times> C \<subseteq> U n" for n |
|
2489 using assms(1) assms(3)[of n] unfolding cauchy_filter_iff by blast |
|
2490 then obtain G where G: "\<And>n. eventually (\<lambda>x. x \<in> G n) F" "\<And>n. G n \<times> G n \<subseteq> U n" |
|
2491 by metis |
|
2492 define G' where "G' = (\<lambda>n. \<Inter>k\<le>n. G k)" |
|
2493 have 1: "eventually (\<lambda>x. x \<in> G' n) F" for n |
|
2494 using G by (auto simp: G'_def intro: eventually_ball_finite) |
|
2495 have 2: "G' n \<times> G' n \<subseteq> U n" for n |
|
2496 using G unfolding G'_def by fast |
|
2497 have 3: "antimono G'" |
|
2498 unfolding G'_def decseq_def by force |
|
2499 |
|
2500 have "\<exists>g. g \<in> G' n" for n |
|
2501 using 1 assms(2) eventually_happens' by auto |
|
2502 then obtain g where g: "\<And>n. g n \<in> G' n" |
|
2503 by metis |
|
2504 from g 1 2 3 that[of G' g] show ?thesis |
|
2505 by metis |
|
2506 qed |
|
2507 |
|
2508 definition lift_filter :: "('a set \<Rightarrow> 'b filter) \<Rightarrow> 'a filter \<Rightarrow> 'b filter" where |
|
2509 "lift_filter f F = (INF X\<in>{X. eventually (\<lambda>x. x \<in> X) F}. f X)" |
|
2510 |
|
2511 lemma lift_filter_top [simp]: "lift_filter g top = g UNIV" |
|
2512 proof - |
|
2513 have "{X. \<forall>x::'b. x \<in> X} = {UNIV}" |
|
2514 by auto |
|
2515 thus ?thesis |
|
2516 by (simp add: lift_filter_def) |
|
2517 qed |
|
2518 |
|
2519 lemma eventually_lift_filter_iff: |
|
2520 assumes "mono g" |
|
2521 shows "eventually P (lift_filter g F) \<longleftrightarrow> (\<exists>X. eventually (\<lambda>x. x \<in> X) F \<and> eventually P (g X))" |
|
2522 unfolding lift_filter_def |
|
2523 proof (subst eventually_INF_base, goal_cases) |
|
2524 case 1 |
|
2525 thus ?case by (auto intro: exI[of _ UNIV]) |
|
2526 next |
|
2527 case (2 X Y) |
|
2528 thus ?case |
|
2529 by (auto intro!: exI[of _ "X \<inter> Y"] eventually_conj monoD[OF assms]) |
|
2530 qed auto |
|
2531 |
|
2532 lemma lift_filter_le: |
|
2533 assumes "eventually (\<lambda>x. x \<in> X) F" "g X \<le> F'" |
|
2534 shows "lift_filter g F \<le> F'" |
|
2535 unfolding lift_filter_def |
|
2536 by (rule INF_lower2[of X _ g F', OF _ assms(2)]) (use assms(1) in auto) |
|
2537 |
|
2538 definition lift_filter' :: "('a set \<Rightarrow> 'b set) \<Rightarrow> 'a filter \<Rightarrow> 'b filter" where |
|
2539 "lift_filter' f F = lift_filter (principal \<circ> f) F" |
|
2540 |
|
2541 lemma lift_filter'_top [simp]: "lift_filter' g top = principal (g UNIV)" |
|
2542 by (simp add: lift_filter'_def) |
|
2543 |
|
2544 lemma eventually_lift_filter'_iff: |
|
2545 assumes "mono g" |
|
2546 shows "eventually P (lift_filter' g F) \<longleftrightarrow> (\<exists>X. eventually (\<lambda>x. x \<in> X) F \<and> (\<forall>x\<in>g X. P x))" |
|
2547 unfolding lift_filter'_def using assms |
|
2548 by (subst eventually_lift_filter_iff) (auto simp: mono_def eventually_principal) |
|
2549 |
|
2550 lemma lift_filter'_le: |
|
2551 assumes "eventually (\<lambda>x. x \<in> X) F" "principal (g X) \<le> F'" |
|
2552 shows "lift_filter' g F \<le> F'" |
|
2553 unfolding lift_filter'_def using assms |
|
2554 by (intro lift_filter_le[where X = X]) auto |
|
2555 |
|
2556 |
|
2557 lemma (in uniform_space) comp_uniformity_le_uniformity: |
|
2558 "lift_filter' (\<lambda>X. X O X) uniformity \<le> uniformity" |
|
2559 unfolding le_filter_def |
|
2560 proof safe |
|
2561 fix P assume P: "eventually P uniformity" |
|
2562 have [simp]: "mono (\<lambda>X::('a \<times> 'a) set. X O X)" |
|
2563 by (intro monoI) auto |
|
2564 from P obtain P' where P': "eventually P' uniformity " "(\<And>x y z. P' (x, y) \<Longrightarrow> P' (y, z) \<Longrightarrow> P (x, z))" |
|
2565 using uniformity_transE by blast |
|
2566 show "eventually P (lift_filter' (\<lambda>X. X O X) uniformity)" |
|
2567 by (auto simp: eventually_lift_filter'_iff intro!: exI[of _ "{x. P' x}"] P') |
|
2568 qed |
|
2569 |
|
2570 lemma (in uniform_space) comp_mem_uniformity_sets: |
|
2571 assumes "eventually (\<lambda>z. z \<in> X) uniformity" |
|
2572 obtains Y where "eventually (\<lambda>z. z \<in> Y) uniformity" "Y O Y \<subseteq> X" |
|
2573 proof - |
|
2574 have [simp]: "mono (\<lambda>X::('a \<times> 'a) set. X O X)" |
|
2575 by (intro monoI) auto |
|
2576 have "eventually (\<lambda>z. z \<in> X) (lift_filter' (\<lambda>X. X O X) uniformity)" |
|
2577 using assms comp_uniformity_le_uniformity using filter_leD by blast |
|
2578 thus ?thesis using that |
|
2579 by (auto simp: eventually_lift_filter'_iff) |
|
2580 qed |
|
2581 |
|
2582 lemma (in uniform_space) le_nhds_of_cauchy_adhp_aux: |
|
2583 assumes "\<And>P. eventually P uniformity \<Longrightarrow> (\<exists>X. eventually (\<lambda>y. y \<in> X) F \<and> (\<forall>z\<in>X \<times> X. P z) \<and> (\<exists>y. P (x, y) \<and> y \<in> X))" |
|
2584 shows "F \<le> nhds x" |
|
2585 unfolding le_filter_def |
|
2586 proof safe |
|
2587 fix P assume "eventually P (nhds x)" |
|
2588 hence "\<forall>\<^sub>F z in uniformity. z \<in> {z. fst z = x \<longrightarrow> P (snd z)}" |
|
2589 by (simp add: eventually_nhds_uniformity case_prod_unfold) |
|
2590 then obtain Y where Y: "\<forall>\<^sub>F z in uniformity. z \<in> Y" "Y O Y \<subseteq> {z. fst z = x \<longrightarrow> P (snd z)}" |
|
2591 using comp_mem_uniformity_sets by blast |
|
2592 obtain X y where Xy: "eventually (\<lambda>y. y \<in> X) F" "X\<times>X \<subseteq> Y" "(x, y) \<in> Y" "y \<in> X" |
|
2593 using assms[OF Y(1)] by blast |
|
2594 have *: "P x" if "x \<in> X" for x |
|
2595 using Y(2) Xy(2-4) that unfolding relcomp_unfold by force |
|
2596 show "eventually P F" |
|
2597 by (rule eventually_mono[OF Xy(1)]) (use * in auto) |
|
2598 qed |
|
2599 |
|
2600 lemma (in uniform_space) eventually_uniformity_imp_nhds: |
|
2601 assumes "eventually P uniformity" |
|
2602 shows "eventually (\<lambda>y. P (x, y)) (nhds x)" |
|
2603 using assms unfolding eventually_nhds_uniformity by (elim eventually_mono) auto |
|
2604 |
|
2605 lemma (in uniform_space) controlled_sequences_convergent_imp_complete_aux: |
|
2606 fixes U :: "nat \<Rightarrow> ('a \<times> 'a) set" |
|
2607 assumes gen: "countably_generated_filter (uniformity :: ('a \<times> 'a) filter)" |
|
2608 assumes U: "\<And>n. eventually (\<lambda>z. z \<in> U n) uniformity" |
|
2609 assumes conv: "\<And>(u :: nat \<Rightarrow> 'a). (\<And>N m n. N \<le> m \<Longrightarrow> N \<le> n \<Longrightarrow> (u m, u n) \<in> U N) \<Longrightarrow> convergent u" |
|
2610 assumes "cauchy_filter F" |
|
2611 shows "convergent_filter F" |
|
2612 proof (cases "F = bot") |
|
2613 case False |
|
2614 note F = \<open>cauchy_filter F\<close> \<open>F \<noteq> bot\<close> |
|
2615 from gen obtain B :: "nat \<Rightarrow> ('a \<times> 'a) set" where B: |
|
2616 "antimono B" "uniformity = (INF n. principal (B n))" |
|
2617 "\<And>P. eventually P uniformity \<longleftrightarrow> (\<exists>i. \<forall>x\<in>B i. P x)" |
|
2618 using countably_generated_filter_has_antimono_basis by blast |
|
2619 |
|
2620 have ev_B: "eventually (\<lambda>z. z \<in> B n) uniformity" for n |
|
2621 by (subst B(3)) auto |
|
2622 hence ev_B': "eventually (\<lambda>z. z \<in> B n \<inter> U n) uniformity" for n |
|
2623 using U by (auto intro: eventually_conj) |
|
2624 |
|
2625 obtain g G where gG: "antimono G" "\<And>n. g n \<in> G n" |
|
2626 "\<And>n. eventually (\<lambda>x. x \<in> G n) F" "\<And>n. G n \<times> G n \<subseteq> B n \<inter> U n" |
|
2627 using controlled_sequences_convergent_imp_complete_aux_sequence[of F "\<lambda>n. B n \<inter> U n", OF F ev_B'] |
|
2628 by metis |
|
2629 |
|
2630 have "convergent g" |
|
2631 proof (rule conv) |
|
2632 fix N m n :: nat |
|
2633 assume mn: "N \<le> m" "N \<le> n" |
|
2634 have "(g m, g n) \<in> G m \<times> G n" |
|
2635 using gG by auto |
|
2636 also from mn have "\<dots> \<subseteq> G N \<times> G N" |
|
2637 by (intro Sigma_mono gG antimonoD[OF gG(1)]) |
|
2638 also have "\<dots> \<subseteq> U N" |
|
2639 using gG by blast |
|
2640 finally show "(g m, g n) \<in> U N" . |
|
2641 qed |
|
2642 then obtain L where G: "g \<longlonglongrightarrow> L" |
|
2643 unfolding convergent_def by blast |
|
2644 |
|
2645 have "F \<le> nhds L" |
|
2646 proof (rule le_nhds_of_cauchy_adhp_aux) |
|
2647 fix P :: "'a \<times> 'a \<Rightarrow> bool" |
|
2648 assume P: "eventually P uniformity" |
|
2649 hence "eventually (\<lambda>n. \<forall>x\<in>B n. P x) sequentially" |
|
2650 using \<open>antimono B\<close> unfolding B(3) eventually_sequentially decseq_def by blast |
|
2651 moreover have "eventually (\<lambda>n. P (L, g n)) sequentially" |
|
2652 using P eventually_compose_filterlim eventually_uniformity_imp_nhds G by blast |
|
2653 ultimately have "eventually (\<lambda>n. (\<forall>x\<in>B n. P x) \<and> P (L, g n)) sequentially" |
|
2654 by eventually_elim auto |
|
2655 then obtain n where n: "\<forall>x\<in>B n. P x" "P (L, g n)" |
|
2656 unfolding eventually_at_top_linorder by blast |
|
2657 |
|
2658 have "eventually (\<lambda>y. y \<in> G n) F" "\<forall>z\<in>G n \<times> G n. P z" "g n \<in> G n" "P (L, g n)" |
|
2659 using n gG by blast+ |
|
2660 thus "\<exists>X. (\<forall>\<^sub>F y in F. y \<in> X) \<and> (\<forall>z\<in>X \<times> X. P z) \<and> (\<exists>y. P (L, y) \<and> y \<in> X)" |
|
2661 by blast |
|
2662 qed |
|
2663 thus "convergent_filter F" |
|
2664 by (auto simp: convergent_filter_iff) |
|
2665 qed auto |
|
2666 |
|
2667 theorem (in uniform_space) controlled_sequences_convergent_imp_complete: |
|
2668 fixes U :: "nat \<Rightarrow> ('a \<times> 'a) set" |
|
2669 assumes gen: "countably_generated_filter (uniformity :: ('a \<times> 'a) filter)" |
|
2670 assumes U: "\<And>n. eventually (\<lambda>z. z \<in> U n) uniformity" |
|
2671 assumes conv: "\<And>(u :: nat \<Rightarrow> 'a). (\<And>N m n. N \<le> m \<Longrightarrow> N \<le> n \<Longrightarrow> (u m, u n) \<in> U N) \<Longrightarrow> convergent u" |
|
2672 shows "class.complete_uniform_space open uniformity" |
|
2673 by unfold_locales (use assms controlled_sequences_convergent_imp_complete_aux in blast) |
|
2674 |
|
2675 lemma filtermap_prod_filter: "filtermap (map_prod f g) (F \<times>\<^sub>F G) = filtermap f F \<times>\<^sub>F filtermap g G" |
|
2676 proof (intro antisym) |
|
2677 show "filtermap (map_prod f g) (F \<times>\<^sub>F G) \<le> filtermap f F \<times>\<^sub>F filtermap g G" |
|
2678 by (auto simp: le_filter_def eventually_filtermap eventually_prod_filter) |
|
2679 next |
|
2680 show "filtermap f F \<times>\<^sub>F filtermap g G \<le> filtermap (map_prod f g) (F \<times>\<^sub>F G)" |
|
2681 unfolding le_filter_def |
|
2682 proof safe |
|
2683 fix P assume P: "eventually P (filtermap (map_prod f g) (F \<times>\<^sub>F G))" |
|
2684 then obtain Pf Pg where *: "eventually Pf F" "eventually Pg G" "\<forall>x. Pf x \<longrightarrow> (\<forall>y. Pg y \<longrightarrow> P (f x, g y))" |
|
2685 by (auto simp: eventually_filtermap eventually_prod_filter) |
|
2686 |
|
2687 define Pf' where "Pf' = (\<lambda>x. \<exists>y. x = f y \<and> Pf y)" |
|
2688 define Pg' where "Pg' = (\<lambda>x. \<exists>y. x = g y \<and> Pg y)" |
|
2689 |
|
2690 from *(1) have "\<forall>\<^sub>F x in F. Pf' (f x)" |
|
2691 by eventually_elim (auto simp: Pf'_def) |
|
2692 moreover from *(2) have "\<forall>\<^sub>F x in G. Pg' (g x)" |
|
2693 by eventually_elim (auto simp: Pg'_def) |
|
2694 moreover have "(\<forall>x y. Pf' x \<longrightarrow> Pg' y \<longrightarrow> P (x, y))" |
|
2695 using *(3) by (auto simp: Pf'_def Pg'_def) |
|
2696 ultimately show "eventually P (filtermap f F \<times>\<^sub>F filtermap g G)" |
|
2697 unfolding eventually_prod_filter eventually_filtermap |
|
2698 by blast |
|
2699 qed |
|
2700 qed |
|
2701 |
|
2702 |
|
2703 lemma (in uniform_space) Cauchy_seq_iff_tendsto: |
|
2704 "Cauchy f \<longleftrightarrow> filterlim (map_prod f f) uniformity (at_top \<times>\<^sub>F at_top)" |
|
2705 unfolding Cauchy_uniform cauchy_filter_def filterlim_def filtermap_prod_filter .. |
|
2706 |
|
2707 theorem (in uniform_space) controlled_seq_imp_Cauchy_seq: |
|
2708 fixes U :: "nat \<Rightarrow> ('a \<times> 'a) set" |
|
2709 assumes U: "\<And>P. eventually P uniformity \<Longrightarrow> (\<exists>n. \<forall>x\<in>U n. P x)" |
|
2710 assumes controlled: "\<And>N m n. N \<le> m \<Longrightarrow> N \<le> n \<Longrightarrow> (f m, f n) \<in> U N" |
|
2711 shows "Cauchy f" |
|
2712 unfolding Cauchy_seq_iff_tendsto |
|
2713 proof - |
|
2714 show "filterlim (map_prod f f) uniformity (sequentially \<times>\<^sub>F sequentially)" |
|
2715 unfolding filterlim_def le_filter_def |
|
2716 proof safe |
|
2717 fix P :: "'a \<times> 'a \<Rightarrow> bool" |
|
2718 assume P: "eventually P uniformity" |
|
2719 from U[OF this] obtain N where N: "\<forall>x\<in>U N. P x" |
|
2720 by blast |
|
2721 |
|
2722 show "eventually P (filtermap (map_prod f f) (sequentially \<times>\<^sub>F sequentially))" |
|
2723 unfolding eventually_filtermap eventually_prod_sequentially |
|
2724 by (rule exI[of _ N]) (use controlled N in \<open>auto simp: map_prod_def\<close>) |
|
2725 qed |
|
2726 qed |
|
2727 |
|
2728 lemma (in uniform_space) Cauchy_seq_convergent_imp_complete_aux: |
|
2729 fixes U :: "nat \<Rightarrow> ('a \<times> 'a) set" |
|
2730 assumes gen: "countably_generated_filter (uniformity :: ('a \<times> 'a) filter)" |
|
2731 assumes conv: "\<And>(u :: nat \<Rightarrow> 'a). Cauchy u \<Longrightarrow> convergent u" |
|
2732 assumes "cauchy_filter F" |
|
2733 shows "convergent_filter F" |
|
2734 proof - |
|
2735 from gen obtain B :: "nat \<Rightarrow> ('a \<times> 'a) set" where B: |
|
2736 "antimono B" "uniformity = (INF n. principal (B n))" |
|
2737 "\<And>P. eventually P uniformity \<longleftrightarrow> (\<exists>i. \<forall>x\<in>B i. P x)" |
|
2738 using countably_generated_filter_has_antimono_basis by blast |
|
2739 |
|
2740 show ?thesis |
|
2741 proof (rule controlled_sequences_convergent_imp_complete_aux[where U = B]) |
|
2742 show "\<forall>\<^sub>F z in uniformity. z \<in> B n" for n |
|
2743 unfolding B(3) by blast |
|
2744 next |
|
2745 fix f :: "nat \<Rightarrow> 'a" |
|
2746 assume f: "\<And>N m n. N \<le> m \<Longrightarrow> N \<le> n \<Longrightarrow> (f m, f n) \<in> B N" |
|
2747 have "Cauchy f" using f B |
|
2748 by (intro controlled_seq_imp_Cauchy_seq[where U = B]) auto |
|
2749 with conv show "convergent f" |
|
2750 by simp |
|
2751 qed fact+ |
|
2752 qed |
|
2753 |
|
2754 theorem (in uniform_space) Cauchy_seq_convergent_imp_complete: |
|
2755 fixes U :: "nat \<Rightarrow> ('a \<times> 'a) set" |
|
2756 assumes gen: "countably_generated_filter (uniformity :: ('a \<times> 'a) filter)" |
|
2757 assumes conv: "\<And>(u :: nat \<Rightarrow> 'a). Cauchy u \<Longrightarrow> convergent u" |
|
2758 shows "class.complete_uniform_space open uniformity" |
|
2759 by unfold_locales (use assms Cauchy_seq_convergent_imp_complete_aux in blast) |
|
2760 |
|
2761 lemma (in metric_space) countably_generated_uniformity: |
|
2762 "countably_generated_filter uniformity" |
|
2763 proof - |
|
2764 have "(INF e\<in>{0<..}. principal {(x, y). dist (x::'a) y < e}) = |
|
2765 (INF n\<in>UNIV. principal {(x, y). dist x y < 1 / real (Suc n)})" (is "?F = ?G") |
|
2766 unfolding uniformity_dist |
|
2767 proof (intro antisym) |
|
2768 have "?G = (INF e\<in>(\<lambda>n. 1 / real (Suc n)) ` UNIV. principal {(x, y). dist x y < e})" |
|
2769 by (simp add: image_image) |
|
2770 also have "\<dots> \<ge> ?F" |
|
2771 by (intro INF_superset_mono) auto |
|
2772 finally show "?F \<le> ?G" . |
|
2773 next |
|
2774 show "?G \<le> ?F" |
|
2775 unfolding le_filter_def |
|
2776 proof safe |
|
2777 fix P assume "eventually P ?F" |
|
2778 then obtain \<epsilon> where \<epsilon>: "\<epsilon> > 0" "eventually P (principal {(x, y). dist x y < \<epsilon>})" |
|
2779 proof (subst (asm) eventually_INF_base, goal_cases) |
|
2780 case (2 \<epsilon>1 \<epsilon>2) |
|
2781 thus ?case |
|
2782 by (intro bexI[of _ "min \<epsilon>1 \<epsilon>2"]) auto |
|
2783 qed auto |
|
2784 from \<open>\<epsilon> > 0\<close> obtain n where n: "1 / real (Suc n) < \<epsilon>" |
|
2785 using nat_approx_posE by blast |
|
2786 have "eventually P (principal {(x, y). dist x y < 1 / real (Suc n)})" |
|
2787 using \<epsilon>(2) n by (auto simp: eventually_principal) |
|
2788 thus "eventually P ?G" |
|
2789 by (intro eventually_INF1) auto |
|
2790 qed |
|
2791 qed |
|
2792 thus "countably_generated_filter uniformity" |
|
2793 unfolding countably_generated_filter_def uniformity_dist by fast |
|
2794 qed |
|
2795 |
|
2796 subclass (in complete_space) complete_uniform_space |
|
2797 proof (rule Cauchy_seq_convergent_imp_complete) |
|
2798 show "convergent f" if "Cauchy f" for f |
|
2799 using Cauchy_convergent that by blast |
|
2800 qed (fact countably_generated_uniformity) |
|
2801 |
|
2802 lemma (in complete_uniform_space) complete_UNIV_cuspace [intro]: "complete UNIV" |
|
2803 unfolding complete_uniform using cauchy_filter_convergent |
|
2804 by (auto simp: convergent_filter.simps) |
|
2805 |
|
2806 |
|
2807 |
|
2808 lemma norm_infsum_le: |
|
2809 assumes "(f has_sum S) X" |
|
2810 assumes "(g has_sum T) X" |
|
2811 assumes "\<And>x. x \<in> X \<Longrightarrow> norm (f x) \<le> g x" |
|
2812 shows "norm S \<le> T" |
|
2813 proof (rule tendsto_le) |
|
2814 show "((\<lambda>Y. norm (\<Sum>x\<in>Y. f x)) \<longlongrightarrow> norm S) (finite_subsets_at_top X)" |
|
2815 using assms(1) unfolding has_sum_def by (intro tendsto_norm) |
|
2816 show "((\<lambda>Y. \<Sum>x\<in>Y. g x) \<longlongrightarrow> T) (finite_subsets_at_top X)" |
|
2817 using assms(2) unfolding has_sum_def . |
|
2818 show "\<forall>\<^sub>F x in finite_subsets_at_top X. norm (sum f x) \<le> (\<Sum>x\<in>x. g x)" |
|
2819 by (rule eventually_finite_subsets_at_top_weakI) (auto intro!: sum_norm_le assms) |
|
2820 qed auto |
|
2821 |
|
2822 (* |
|
2823 lemma summable_on_Sigma: |
|
2824 fixes A :: "'a set" and B :: "'a \<Rightarrow> 'b set" |
|
2825 and f :: \<open>'a \<Rightarrow> 'b \<Rightarrow> 'c::{comm_monoid_add, t2_space, uniform_space}\<close> |
|
2826 assumes plus_cont: \<open>uniformly_continuous_on UNIV (\<lambda>(x::'c,y). x+y)\<close> |
|
2827 assumes summableAB: "(\<lambda>(x,y). f x y) summable_on (Sigma A B)" |
|
2828 assumes summableB: \<open>\<And>x. x\<in>A \<Longrightarrow> (f x) summable_on (B x)\<close> |
|
2829 shows \<open>(\<lambda>x. infsum (f x) (B x)) summable_on A\<close> |
|
2830 *) |
|
2831 |
|
2832 lemma has_sum_imp_summable: "(f has_sum S) A \<Longrightarrow> f summable_on A" |
|
2833 by (auto simp: summable_on_def) |
|
2834 |
|
2835 lemma has_sum_reindex_bij_betw: |
|
2836 assumes "bij_betw g A B" |
|
2837 shows "((\<lambda>x. f (g x)) has_sum S) A = (f has_sum S) B" |
|
2838 proof - |
|
2839 have "((\<lambda>x. f (g x)) has_sum S) A \<longleftrightarrow> (f has_sum S) (g ` A)" |
|
2840 by (subst has_sum_reindex) (use assms in \<open>auto dest: bij_betw_imp_inj_on simp: o_def\<close>) |
|
2841 also have "g ` A = B" |
|
2842 using assms bij_betw_imp_surj_on by blast |
|
2843 finally show ?thesis . |
|
2844 qed |
|
2845 |
|
2846 lemma has_sum_reindex_bij_witness: |
|
2847 assumes "\<And>a. a \<in> S \<Longrightarrow> i (j a) = a" |
|
2848 assumes "\<And>a. a \<in> S \<Longrightarrow> j a \<in> T" |
|
2849 assumes "\<And>b. b \<in> T \<Longrightarrow> j (i b) = b" |
|
2850 assumes "\<And>b. b \<in> T \<Longrightarrow> i b \<in> S" |
|
2851 assumes "\<And>a. a \<in> S \<Longrightarrow> h (j a) = g a" |
|
2852 assumes "s = s'" |
|
2853 shows "(g has_sum s) S = (h has_sum s') T" |
|
2854 proof - |
|
2855 have bij:"bij_betw j S T" |
|
2856 using assms by (intro bij_betwI[of _ _ _ i]) auto |
|
2857 have "(h has_sum s') T \<longleftrightarrow> ((\<lambda>a. h (j a)) has_sum s) S" |
|
2858 using has_sum_reindex_bij_betw[OF bij, of h] assms by simp |
|
2859 also have "\<dots> \<longleftrightarrow> (g has_sum s) S" |
|
2860 by (intro has_sum_cong) (use assms in auto) |
|
2861 finally show ?thesis .. |
|
2862 qed |
|
2863 |
|
2864 |
|
2865 |
|
2866 lemma has_sum_homomorphism: |
|
2867 assumes "(f has_sum S) A" "h 0 = 0" "\<And>a b. h (a + b) = h a + h b" "continuous_on UNIV h" |
|
2868 shows "((\<lambda>x. h (f x)) has_sum (h S)) A" |
|
2869 proof - |
|
2870 have "sum (h \<circ> f) X = h (sum f X)" for X |
|
2871 by (induction X rule: infinite_finite_induct) (simp_all add: assms) |
|
2872 hence sum_h: "sum (h \<circ> f) = h \<circ> sum f" |
|
2873 by (intro ext) auto |
|
2874 have "((h \<circ> f) has_sum h S) A" |
|
2875 unfolding has_sum_def sum_h unfolding o_def |
|
2876 by (rule continuous_on_tendsto_compose[OF assms(4)]) |
|
2877 (use assms in \<open>auto simp: has_sum_def\<close>) |
|
2878 thus ?thesis |
|
2879 by (simp add: o_def) |
|
2880 qed |
|
2881 |
|
2882 lemma summable_on_homomorphism: |
|
2883 assumes "f summable_on A" "h 0 = 0" "\<And>a b. h (a + b) = h a + h b" "continuous_on UNIV h" |
|
2884 shows "(\<lambda>x. h (f x)) summable_on A" |
|
2885 proof - |
|
2886 from assms(1) obtain S where "(f has_sum S) A" |
|
2887 by (auto simp: summable_on_def) |
|
2888 hence "((\<lambda>x. h (f x)) has_sum h S) A" |
|
2889 by (rule has_sum_homomorphism) (use assms in auto) |
|
2890 thus ?thesis |
|
2891 by (auto simp: summable_on_def) |
|
2892 qed |
|
2893 |
|
2894 lemma infsum_homomorphism_strong: |
|
2895 fixes h :: "'a :: {t2_space, topological_comm_monoid_add} \<Rightarrow> |
|
2896 'b :: {t2_space, topological_comm_monoid_add}" |
|
2897 assumes "(\<lambda>x. h (f x)) summable_on A \<longleftrightarrow> f summable_on A" |
|
2898 assumes "h 0 = 0" "\<And>a b. h (a + b) = h a + h b" "continuous_on UNIV h" |
|
2899 assumes "\<And>S. (f has_sum S) A \<Longrightarrow> ((\<lambda>x. h (f x)) has_sum (h S)) A" |
|
2900 shows "infsum (\<lambda>x. h (f x)) A = h (infsum f A)" |
|
2901 proof (cases "f summable_on A") |
|
2902 case False |
|
2903 thus ?thesis by (simp add: infsum_def assms) |
|
2904 next |
|
2905 case True |
|
2906 then obtain S where "(f has_sum S) A" by (auto simp: summable_on_def) |
|
2907 moreover from this have "((\<lambda>x. h (f x)) has_sum (h S)) A" by (rule assms) |
|
2908 ultimately show ?thesis by (simp add: infsumI) |
|
2909 qed |
|
2910 |
|
2911 lemma has_sum_bounded_linear: |
|
2912 assumes "bounded_linear h" and "(f has_sum S) A" |
|
2913 shows "((\<lambda>x. h (f x)) has_sum h S) A" |
|
2914 proof - |
|
2915 interpret bounded_linear h by fact |
|
2916 from assms(2) show ?thesis |
|
2917 by (rule has_sum_homomorphism) (auto simp: add intro!: continuous_on) |
|
2918 qed |
|
2919 |
|
2920 lemma summable_on_bounded_linear: |
|
2921 assumes "bounded_linear h" and "f summable_on A" |
|
2922 shows "(\<lambda>x. h (f x)) summable_on A" |
|
2923 proof - |
|
2924 interpret bounded_linear h by fact |
|
2925 from assms(2) show ?thesis |
|
2926 by (rule summable_on_homomorphism) (auto simp: add intro!: continuous_on) |
|
2927 qed |
|
2928 |
|
2929 lemma summable_on_bounded_linear_iff: |
|
2930 assumes "bounded_linear h" and "bounded_linear h'" and "\<And>x. h' (h x) = x" |
|
2931 shows "(\<lambda>x. h (f x)) summable_on A \<longleftrightarrow> f summable_on A" |
|
2932 by (auto dest: assms(1,2)[THEN summable_on_bounded_linear] simp: assms(3)) |
|
2933 |
|
2934 lemma infsum_bounded_linear_strong: |
|
2935 fixes h :: "'a :: real_normed_vector \<Rightarrow> 'b :: real_normed_vector" |
|
2936 assumes "(\<lambda>x. h (f x)) summable_on A \<longleftrightarrow> f summable_on A" |
|
2937 assumes "bounded_linear h" |
|
2938 shows "infsum (\<lambda>x. h (f x)) A = h (infsum f A)" |
|
2939 proof - |
|
2940 interpret bounded_linear h by fact |
|
2941 show ?thesis |
|
2942 by (rule infsum_homomorphism_strong) |
|
2943 (insert assms, auto intro: add continuous_on has_sum_bounded_linear) |
|
2944 qed |
|
2945 |
|
2946 lemma infsum_bounded_linear_strong': |
|
2947 fixes mult :: "'c :: zero \<Rightarrow> 'a :: real_normed_vector \<Rightarrow> 'b :: real_normed_vector" |
|
2948 assumes "c \<noteq> 0 \<Longrightarrow> (\<lambda>x. mult c (f x)) summable_on A \<longleftrightarrow> f summable_on A" |
|
2949 assumes "bounded_linear (mult c)" |
|
2950 assumes [simp]: "\<And>x. mult 0 x = 0" |
|
2951 shows "infsum (\<lambda>x. mult c (f x)) A = mult c (infsum f A)" |
|
2952 using assms(1,2) by (cases "c = 0") (auto intro: infsum_bounded_linear_strong) |
|
2953 |
|
2954 lemma has_sum_of_nat: "(f has_sum S) A \<Longrightarrow> ((\<lambda>x. of_nat (f x)) has_sum of_nat S) A" |
|
2955 by (erule has_sum_homomorphism) (auto intro!: continuous_intros) |
|
2956 |
|
2957 lemma has_sum_of_int: "(f has_sum S) A \<Longrightarrow> ((\<lambda>x. of_int (f x)) has_sum of_int S) A" |
|
2958 by (erule has_sum_homomorphism) (auto intro!: continuous_intros) |
|
2959 |
|
2960 lemma summable_on_of_nat: "f summable_on A \<Longrightarrow> (\<lambda>x. of_nat (f x)) summable_on A" |
|
2961 by (erule summable_on_homomorphism) (auto intro!: continuous_intros) |
|
2962 |
|
2963 lemma summable_on_of_int: "f summable_on A \<Longrightarrow> (\<lambda>x. of_int (f x)) summable_on A" |
|
2964 by (erule summable_on_homomorphism) (auto intro!: continuous_intros) |
|
2965 |
|
2966 lemma summable_on_discrete_iff: |
|
2967 fixes f :: "'a \<Rightarrow> 'b :: {discrete_topology, topological_comm_monoid_add, cancel_comm_monoid_add}" |
|
2968 shows "f summable_on A \<longleftrightarrow> finite {x\<in>A. f x \<noteq> 0}" |
|
2969 proof |
|
2970 assume *: "finite {x\<in>A. f x \<noteq> 0}" |
|
2971 hence "f summable_on {x\<in>A. f x \<noteq> 0}" |
|
2972 by (rule summable_on_finite) |
|
2973 also have "?this \<longleftrightarrow> f summable_on A" |
|
2974 by (intro summable_on_cong_neutral) auto |
|
2975 finally show "f summable_on A" . |
|
2976 next |
|
2977 assume "f summable_on A" |
|
2978 then obtain S where "(f has_sum S) A" |
|
2979 by (auto simp: summable_on_def) |
|
2980 hence "\<forall>\<^sub>F x in finite_subsets_at_top A. sum f x = S" |
|
2981 unfolding has_sum_def tendsto_discrete . |
|
2982 then obtain X where X: "finite X" "X \<subseteq> A" "\<And>Y. finite Y \<Longrightarrow> X \<subseteq> Y \<Longrightarrow> Y \<subseteq> A \<Longrightarrow> sum f Y = S" |
|
2983 unfolding eventually_finite_subsets_at_top by metis |
|
2984 have "{x\<in>A. f x \<noteq> 0} \<subseteq> X" |
|
2985 proof |
|
2986 fix x assume x: "x \<in> {x\<in>A. f x \<noteq> 0}" |
|
2987 show "x \<in> X" |
|
2988 proof (rule ccontr) |
|
2989 assume [simp]: "x \<notin> X" |
|
2990 have "sum f (insert x X) = S" |
|
2991 using X(1,2) x by (intro X) auto |
|
2992 also have "sum f (insert x X) = f x + sum f X" |
|
2993 using X(1) by (subst sum.insert) auto |
|
2994 also have "sum f X = S" |
|
2995 by (intro X order.refl) |
|
2996 finally have "f x = 0" |
|
2997 by simp |
|
2998 with x show False |
|
2999 by auto |
|
3000 qed |
|
3001 qed |
|
3002 thus "finite {x\<in>A. f x \<noteq> 0}" |
|
3003 using X(1) finite_subset by blast |
|
3004 qed |
|
3005 |
|
3006 lemma has_sum_imp_sums: "(f has_sum S) (UNIV :: nat set) \<Longrightarrow> f sums S" |
|
3007 unfolding sums_def has_sum_def by (rule filterlim_compose[OF _ filterlim_lessThan_at_top]) |
|
3008 |
|
3009 lemma summable_on_imp_summable: "f summable_on (UNIV :: nat set) \<Longrightarrow> summable f" |
|
3010 unfolding summable_on_def summable_def by (auto dest: has_sum_imp_sums) |
|
3011 |
|
3012 lemma summable_on_UNIV_nonneg_real_iff: |
|
3013 assumes "\<And>n. f n \<ge> (0 :: real)" |
|
3014 shows "f summable_on UNIV \<longleftrightarrow> summable f" |
|
3015 using assms by (auto intro: norm_summable_imp_summable_on summable_on_imp_summable) |
|
3016 |
|
3017 lemma summable_on_imp_bounded_partial_sums: |
|
3018 fixes f :: "_ \<Rightarrow> 'a :: {topological_comm_monoid_add, linorder_topology}" |
|
3019 assumes f: "f summable_on A" |
|
3020 shows "\<exists>C. eventually (\<lambda>X. sum f X \<le> C) (finite_subsets_at_top A)" |
|
3021 proof - |
|
3022 from assms obtain S where S: "(sum f \<longlongrightarrow> S) (finite_subsets_at_top A)" |
|
3023 unfolding summable_on_def has_sum_def by blast |
|
3024 show ?thesis |
|
3025 proof (cases "\<exists>C. C > S") |
|
3026 case True |
|
3027 then obtain C where C: "C > S" |
|
3028 by blast |
|
3029 have "\<forall>\<^sub>F X in finite_subsets_at_top A. sum f X < C" |
|
3030 using S C by (rule order_tendstoD(2)) |
|
3031 hence "\<forall>\<^sub>F X in finite_subsets_at_top A. sum f X \<le> C" |
|
3032 by (rule eventually_mono) auto |
|
3033 thus ?thesis by blast |
|
3034 next |
|
3035 case False |
|
3036 hence "\<forall>\<^sub>F X in finite_subsets_at_top A. sum f X \<le> S" |
|
3037 by (auto simp: not_less) |
|
3038 thus ?thesis by blast |
|
3039 qed |
|
3040 qed |
|
3041 |
|
3042 lemma has_sum_mono': |
|
3043 fixes S S' :: "'a :: {linorder_topology, ordered_comm_monoid_add, topological_comm_monoid_add}" |
|
3044 assumes "(f has_sum S) A" "(f has_sum S') B" "A \<subseteq> B" "\<And>x. x \<in> B - A \<Longrightarrow> f x \<ge> 0" |
|
3045 shows "S \<le> S'" |
|
3046 proof (rule has_sum_mono) |
|
3047 show "(f has_sum S') B" by fact |
|
3048 have "(f has_sum S) A \<longleftrightarrow> ((\<lambda>x. if x \<in> A then f x else 0) has_sum S) B" |
|
3049 by (rule has_sum_cong_neutral) (use assms in auto) |
|
3050 thus "((\<lambda>x. if x \<in> A then f x else 0) has_sum S) B" |
|
3051 using assms(1) by blast |
|
3052 qed (insert assms, auto) |
|
3053 |
|
3054 |
|
3055 context |
|
3056 assumes "SORT_CONSTRAINT('a :: {topological_comm_monoid_add, order_topology, |
|
3057 ordered_comm_monoid_add, conditionally_complete_linorder})" |
|
3058 begin |
|
3059 |
|
3060 text \<open> |
|
3061 Any family of non-negative numbers with bounded partial sums is summable, and the sum |
|
3062 is simply the supremum of the partial sums. |
|
3063 \<close> |
|
3064 lemma nonneg_bounded_partial_sums_imp_has_sum_SUP: |
|
3065 assumes nonneg: "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> (0::'a)" |
|
3066 and bound: "eventually (\<lambda>X. sum f X \<le> C) (finite_subsets_at_top A)" |
|
3067 shows "(f has_sum (SUP X\<in>{X. X \<subseteq> A \<and> finite X}. sum f X)) A" |
|
3068 proof - |
|
3069 from bound obtain X0 |
|
3070 where X0: "X0 \<subseteq> A" "finite X0" "\<And>X. X0 \<subseteq> X \<Longrightarrow> X \<subseteq> A \<Longrightarrow> finite X \<Longrightarrow> sum f X \<le> C" |
|
3071 by (force simp: eventually_finite_subsets_at_top) |
|
3072 have bound': "sum f X \<le> C" if "X \<subseteq> A" "finite X" for X |
|
3073 proof - |
|
3074 have "sum f X \<le> sum f (X \<union> X0)" |
|
3075 using that X0(1,2) assms(1) by (intro sum_mono2) auto |
|
3076 also have "\<dots> \<le> C" using X0(1,2) that by (intro X0) auto |
|
3077 finally show ?thesis . |
|
3078 qed |
|
3079 hence bdd: "bdd_above (sum f ` {X. X \<subseteq> A \<and> finite X})" |
|
3080 by (auto simp: bdd_above_def) |
|
3081 |
|
3082 show ?thesis unfolding has_sum_def |
|
3083 proof (rule increasing_tendsto) |
|
3084 show "\<forall>\<^sub>F X in finite_subsets_at_top A. sum f X \<le> Sup (sum f ` {X. X \<subseteq> A \<and> finite X})" |
|
3085 by (intro eventually_finite_subsets_at_top_weakI cSUP_upper[OF _ bdd]) auto |
|
3086 next |
|
3087 fix y assume "y < Sup (sum f ` {X. X \<subseteq> A \<and> finite X})" |
|
3088 then obtain X where X: "X \<subseteq> A" "finite X" "y < sum f X" |
|
3089 by (subst (asm) less_cSUP_iff[OF _ bdd]) auto |
|
3090 from X have "eventually (\<lambda>X'. X \<subseteq> X' \<and> X' \<subseteq> A \<and> finite X') (finite_subsets_at_top A)" |
|
3091 by (auto simp: eventually_finite_subsets_at_top) |
|
3092 thus "eventually (\<lambda>X'. y < sum f X') (finite_subsets_at_top A)" |
|
3093 proof eventually_elim |
|
3094 case (elim X') |
|
3095 note \<open>y < sum f X\<close> |
|
3096 also have "sum f X \<le> sum f X'" |
|
3097 using nonneg elim by (intro sum_mono2) auto |
|
3098 finally show ?case . |
|
3099 qed |
|
3100 qed |
|
3101 qed |
|
3102 |
|
3103 lemma nonneg_bounded_partial_sums_imp_summable_on: |
|
3104 assumes nonneg: "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> (0::'a)" |
|
3105 and bound: "eventually (\<lambda>X. sum f X \<le> C) (finite_subsets_at_top A)" |
|
3106 shows "f summable_on A" |
|
3107 using nonneg_bounded_partial_sums_imp_has_sum_SUP[OF assms] by (auto simp: summable_on_def) |
|
3108 |
2432 end |
3109 end |
2433 |
3110 |
|
3111 context |
|
3112 assumes "SORT_CONSTRAINT('a :: {topological_comm_monoid_add, linorder_topology, |
|
3113 ordered_comm_monoid_add, conditionally_complete_linorder})" |
|
3114 begin |
|
3115 |
|
3116 lemma summable_on_comparison_test: |
|
3117 assumes "f summable_on A" and "\<And>x. x \<in> A \<Longrightarrow> g x \<le> f x" and "\<And>x. x \<in> A \<Longrightarrow> (0::'a) \<le> g x" |
|
3118 shows "g summable_on A" |
|
3119 proof - |
|
3120 obtain C where C: "\<forall>\<^sub>F X in finite_subsets_at_top A. sum f X \<le> C" |
|
3121 using summable_on_imp_bounded_partial_sums [of f] |
|
3122 using assms(1) by presburger |
|
3123 show ?thesis |
|
3124 proof (rule nonneg_bounded_partial_sums_imp_summable_on) |
|
3125 show "\<forall>\<^sub>F X in finite_subsets_at_top A. sum g X \<le> C" |
|
3126 using C assms |
|
3127 unfolding eventually_finite_subsets_at_top |
|
3128 by (smt (verit, ccfv_SIG) order_trans subsetD sum_mono) |
|
3129 qed (use assms in auto) |
|
3130 qed |
|
3131 |
|
3132 end |
|
3133 |
|
3134 |
|
3135 |
|
3136 lemma summable_on_subset: |
|
3137 fixes f :: "_ \<Rightarrow> 'a :: {uniform_topological_group_add, topological_comm_monoid_add, ab_group_add, complete_uniform_space}" |
|
3138 assumes "f summable_on A" "B \<subseteq> A" |
|
3139 shows "f summable_on B" |
|
3140 by (rule summable_on_subset_aux[OF _ _ assms]) (auto simp: uniformly_continuous_add) |
|
3141 |
|
3142 lemma summable_on_union: |
|
3143 fixes f :: "_ \<Rightarrow> 'a :: {uniform_topological_group_add, topological_comm_monoid_add, ab_group_add, complete_uniform_space}" |
|
3144 assumes "f summable_on A" "f summable_on B" |
|
3145 shows "f summable_on (A \<union> B)" |
|
3146 proof - |
|
3147 have "f summable_on (A \<union> (B - A))" |
|
3148 by (intro summable_on_Un_disjoint[OF assms(1) summable_on_subset[OF assms(2)]]) auto |
|
3149 also have "A \<union> (B - A) = A \<union> B" |
|
3150 by blast |
|
3151 finally show ?thesis . |
|
3152 qed |
|
3153 |
|
3154 lemma summable_on_insert_iff: |
|
3155 fixes f :: "_ \<Rightarrow> 'a :: {uniform_topological_group_add, topological_comm_monoid_add, ab_group_add, complete_uniform_space}" |
|
3156 shows "f summable_on insert x A \<longleftrightarrow> f summable_on A" |
|
3157 using summable_on_union[of f A "{x}"] by (auto intro: summable_on_subset) |
|
3158 |
|
3159 lemma has_sum_finiteI: "finite A \<Longrightarrow> S = sum f A \<Longrightarrow> (f has_sum S) A" |
|
3160 using has_sum_finite by blast |
|
3161 |
|
3162 lemma has_sum_insert: |
|
3163 fixes f :: "'a \<Rightarrow> 'b :: topological_comm_monoid_add" |
|
3164 assumes "x \<notin> A" and "(f has_sum S) A" |
|
3165 shows "(f has_sum (f x + S)) (insert x A)" |
|
3166 proof - |
|
3167 have "(f has_sum (f x + S)) ({x} \<union> A)" |
|
3168 using assms by (intro has_sum_Un_disjoint) (auto intro: has_sum_finiteI) |
|
3169 thus ?thesis by simp |
|
3170 qed |
|
3171 |
|
3172 lemma infsum_insert: |
|
3173 fixes f :: "_ \<Rightarrow> 'a :: {topological_comm_monoid_add, t2_space}" |
|
3174 assumes "f summable_on A" "a \<notin> A" |
|
3175 shows "infsum f (insert a A) = f a + infsum f A" |
|
3176 by (meson assms has_sum_insert infsumI summable_iff_has_sum_infsum) |
|
3177 |
|
3178 lemma has_sum_SigmaD: |
|
3179 fixes f :: "'b \<times> 'c \<Rightarrow> 'a :: {topological_comm_monoid_add,t3_space}" |
|
3180 assumes sum1: "(f has_sum S) (Sigma A B)" |
|
3181 assumes sum2: "\<And>x. x \<in> A \<Longrightarrow> ((\<lambda>y. f (x, y)) has_sum g x) (B x)" |
|
3182 shows "(g has_sum S) A" |
|
3183 unfolding has_sum_def tendsto_def eventually_finite_subsets_at_top |
|
3184 proof (safe, goal_cases) |
|
3185 case (1 X) |
|
3186 with nhds_closed[of S X] obtain X' |
|
3187 where X': "S \<in> X'" "closed X'" "X' \<subseteq> X" "eventually (\<lambda>y. y \<in> X') (nhds S)" by blast |
|
3188 from X'(4) obtain X'' where X'': "S \<in> X''" "open X''" "X'' \<subseteq> X'" |
|
3189 by (auto simp: eventually_nhds) |
|
3190 with sum1 obtain Y :: "('b \<times> 'c) set" |
|
3191 where Y: "Y \<subseteq> Sigma A B" "finite Y" |
|
3192 "\<And>Z. Y \<subseteq> Z \<Longrightarrow> Z \<subseteq> Sigma A B \<Longrightarrow> finite Z \<Longrightarrow> sum f Z \<in> X''" |
|
3193 unfolding has_sum_def tendsto_def eventually_finite_subsets_at_top by force |
|
3194 define Y1 :: "'b set" where "Y1 = fst ` Y" |
|
3195 from Y have Y1: "Y1 \<subseteq> A" by (auto simp: Y1_def) |
|
3196 define Y2 :: "'b \<Rightarrow> 'c set" where "Y2 = (\<lambda>x. {y. (x, y) \<in> Y})" |
|
3197 have Y2: "finite (Y2 x)" "Y2 x \<subseteq> B x" if "x \<in> A" for x |
|
3198 using that Y(1,2) unfolding Y2_def |
|
3199 by (force simp: image_iff intro: finite_subset[of _ "snd ` Y"])+ |
|
3200 |
|
3201 show ?case |
|
3202 proof (rule exI[of _ Y1], safe, goal_cases) |
|
3203 case (3 Z) |
|
3204 define H where "H = (INF x\<in>Z. filtercomap (\<lambda>p. p x) (finite_subsets_at_top (B x)))" |
|
3205 |
|
3206 have "sum g Z \<in> X'" |
|
3207 proof (rule Lim_in_closed_set) |
|
3208 show "closed X'" by fact |
|
3209 next |
|
3210 show "((\<lambda>B'. sum (\<lambda>x. sum (\<lambda>y. f (x, y)) (B' x)) Z) \<longlongrightarrow> sum g Z) H" |
|
3211 unfolding H_def |
|
3212 proof (intro tendsto_sum filterlim_INF') |
|
3213 fix x assume x: "x \<in> Z" |
|
3214 with 3 have "x \<in> A" by auto |
|
3215 from sum2[OF this] have "(sum (\<lambda>y. f (x, y)) \<longlongrightarrow> g x) (finite_subsets_at_top (B x))" |
|
3216 by (simp add: has_sum_def) |
|
3217 thus "((\<lambda>B'. sum (\<lambda>y. f (x, y)) (B' x)) \<longlongrightarrow> g x) |
|
3218 (filtercomap (\<lambda>p. p x) (finite_subsets_at_top (B x)))" |
|
3219 by (rule filterlim_compose[OF _ filterlim_filtercomap]) |
|
3220 qed auto |
|
3221 next |
|
3222 show "\<forall>\<^sub>F h in H. sum (\<lambda>x. sum (\<lambda>y. f (x, y)) (h x)) Z \<in> X'" |
|
3223 unfolding H_def |
|
3224 proof (subst eventually_INF_finite[OF \<open>finite Z\<close>], rule exI, safe) |
|
3225 fix x assume x: "x \<in> Z" |
|
3226 hence x': "x \<in> A" using 3 by auto |
|
3227 show "eventually (\<lambda>h. finite (h x) \<and> Y2 x \<subseteq> h x \<and> h x \<subseteq> B x) |
|
3228 (filtercomap (\<lambda>p. p x) (finite_subsets_at_top (B x)))" using 3 Y2[OF x'] |
|
3229 by (intro eventually_filtercomapI) |
|
3230 (auto simp: eventually_finite_subsets_at_top intro: exI[of _ "Y2 x"]) |
|
3231 next |
|
3232 fix h |
|
3233 assume *: "\<forall>x\<in>Z. finite (h x) \<and> Y2 x \<subseteq> h x \<and> h x \<subseteq> B x" |
|
3234 hence "sum (\<lambda>x. sum (\<lambda>y. f (x, y)) (h x)) Z = sum f (Sigma Z h)" |
|
3235 using \<open>finite Z\<close> by (subst sum.Sigma) auto |
|
3236 also have "\<dots> \<in> X''" |
|
3237 using * 3 Y(1,2) by (intro Y; force simp: Y1_def Y2_def) |
|
3238 also have "X'' \<subseteq> X'" by fact |
|
3239 finally show "sum (\<lambda>x. sum (\<lambda>y. f (x, y)) (h x)) Z \<in> X'" . |
|
3240 qed |
|
3241 next |
|
3242 have "H = (INF x\<in>SIGMA x:Z. {X. finite X \<and> X \<subseteq> B x}. |
|
3243 principal {y. finite (y (fst x)) \<and> snd x \<subseteq> y (fst x) \<and> y (fst x) \<subseteq> B (fst x)})" |
|
3244 unfolding H_def finite_subsets_at_top_def filtercomap_INF filtercomap_principal |
|
3245 by (simp add: INF_Sigma) |
|
3246 also have "\<dots> \<noteq> bot" |
|
3247 proof (rule INF_filter_not_bot, subst INF_principal_finite, goal_cases) |
|
3248 case (2 X) |
|
3249 define H' where |
|
3250 "H' = (\<Inter>x\<in>X. {y. finite (y (fst x)) \<and> snd x \<subseteq> y (fst x) \<and> y (fst x) \<subseteq> B (fst x)})" |
|
3251 from 2 have "(\<lambda>x. \<Union>(y,Y)\<in>X. if x = y then Y else {}) \<in> H'" |
|
3252 by (force split: if_splits simp: H'_def) |
|
3253 hence "H' \<noteq> {}" by blast |
|
3254 thus "principal H' \<noteq> bot" by (simp add: principal_eq_bot_iff) |
|
3255 qed |
|
3256 finally show "H \<noteq> bot" . |
|
3257 qed |
|
3258 also have "X' \<subseteq> X" by fact |
|
3259 finally show "sum g Z \<in> X" . |
|
3260 qed (insert Y(1,2), auto simp: Y1_def) |
|
3261 qed |
|
3262 |
|
3263 lemma has_sum_unique: |
|
3264 fixes f :: "_ \<Rightarrow> 'a :: {topological_comm_monoid_add, t2_space}" |
|
3265 assumes "(f has_sum x) A" "(f has_sum y) A" |
|
3266 shows "x = y" |
|
3267 using assms unfolding has_sum_def using tendsto_unique finite_subsets_at_top_neq_bot by blast |
|
3268 |
|
3269 lemma has_sum_SigmaI: |
|
3270 fixes f :: "_ \<Rightarrow> 'a :: {topological_comm_monoid_add, t3_space}" |
|
3271 assumes f: "\<And>x. x \<in> A \<Longrightarrow> ((\<lambda>y. f (x, y)) has_sum g x) (B x)" |
|
3272 assumes g: "(g has_sum S) A" |
|
3273 assumes summable: "f summable_on Sigma A B" |
|
3274 shows "(f has_sum S) (Sigma A B)" |
|
3275 proof - |
|
3276 from summable obtain S' where S': "(f has_sum S') (Sigma A B)" |
|
3277 using summable_on_def by blast |
|
3278 have "(g has_sum S') A" |
|
3279 by (rule has_sum_SigmaD[OF S' f]) |
|
3280 with g S' show ?thesis |
|
3281 using has_sum_unique by blast |
|
3282 qed |
|
3283 |
|
3284 lemma summable_on_SigmaD1: |
|
3285 fixes f :: "_ \<Rightarrow> _ \<Rightarrow> 'a :: {complete_uniform_space, uniform_topological_group_add, ab_group_add, topological_comm_monoid_add}" |
|
3286 assumes f: "(\<lambda>(x,y). f x y) summable_on Sigma A B" |
|
3287 assumes x: "x \<in> A" |
|
3288 shows "f x summable_on B x" |
|
3289 proof - |
|
3290 have "(\<lambda>(x,y). f x y) summable_on Sigma {x} B" |
|
3291 using f by (rule summable_on_subset) (use x in auto) |
|
3292 also have "?this \<longleftrightarrow> ((\<lambda>y. f x y) \<circ> snd) summable_on Sigma {x} B" |
|
3293 by (intro summable_on_cong) auto |
|
3294 also have "\<dots> \<longleftrightarrow> (\<lambda>y. f x y) summable_on snd ` Sigma {x} B" |
|
3295 by (intro summable_on_reindex [symmetric] inj_onI) auto |
|
3296 also have "snd ` Sigma {x} B = B x" |
|
3297 by (force simp: Sigma_def) |
|
3298 finally show ?thesis . |
|
3299 qed |
|
3300 |
|
3301 lemma has_sum_swap: |
|
3302 "(f has_sum S) (A \<times> B) \<longleftrightarrow> ((\<lambda>(x,y). f (y,x)) has_sum S) (B \<times> A)" |
|
3303 proof - |
|
3304 have "bij_betw (\<lambda>(x,y). (y,x)) (B \<times> A) (A \<times> B)" |
|
3305 by (rule bij_betwI[of _ _ _ "\<lambda>(x,y). (y,x)"]) auto |
|
3306 from has_sum_reindex_bij_betw[OF this, where f = f] show ?thesis |
|
3307 by (simp add: case_prod_unfold) |
|
3308 qed |
|
3309 |
|
3310 |
|
3311 lemma summable_on_swap: |
|
3312 "f summable_on (A \<times> B) \<longleftrightarrow> (\<lambda>(x,y). f (y,x)) summable_on (B \<times> A)" |
|
3313 proof - |
|
3314 have "bij_betw (\<lambda>(x,y). (y,x)) (B \<times> A) (A \<times> B)" |
|
3315 by (rule bij_betwI[of _ _ _ "\<lambda>(x,y). (y,x)"]) auto |
|
3316 from summable_on_reindex_bij_betw[OF this, where f = f] show ?thesis |
|
3317 by (simp add: case_prod_unfold) |
|
3318 qed |
|
3319 |
|
3320 lemma has_sum_cmult_right_iff: |
|
3321 fixes c :: "'a :: {topological_semigroup_mult, field}" |
|
3322 assumes "c \<noteq> 0" |
|
3323 shows "((\<lambda>x. c * f x) has_sum S) A \<longleftrightarrow> (f has_sum (S / c)) A" |
|
3324 using has_sum_cmult_right[of f A "S/c" c] |
|
3325 has_sum_cmult_right[of "\<lambda>x. c * f x" A S "inverse c"] assms |
|
3326 by (auto simp: field_simps) |
|
3327 |
|
3328 lemma has_sum_cmult_left_iff: |
|
3329 fixes c :: "'a :: {topological_semigroup_mult, field}" |
|
3330 assumes "c \<noteq> 0" |
|
3331 shows "((\<lambda>x. f x * c) has_sum S) A \<longleftrightarrow> (f has_sum (S / c)) A" |
|
3332 by (smt (verit, best) assms has_sum_cmult_right_iff has_sum_cong mult.commute) |
|
3333 |
|
3334 lemma finite_nonzero_values_imp_summable_on: |
|
3335 assumes "finite {x\<in>X. f x \<noteq> 0}" |
|
3336 shows "f summable_on X" |
|
3337 proof - |
|
3338 have "f summable_on {x\<in>X. f x \<noteq> 0}" |
|
3339 by (intro summable_on_finite assms) |
|
3340 also have "?this \<longleftrightarrow> f summable_on X" |
|
3341 by (intro summable_on_cong_neutral) auto |
|
3342 finally show ?thesis . |
|
3343 qed |
|
3344 |
|
3345 lemma summable_on_of_int_iff: |
|
3346 "(\<lambda>x::'a. of_int (f x) :: 'b :: real_normed_algebra_1) summable_on A \<longleftrightarrow> f summable_on A" |
|
3347 proof |
|
3348 assume "f summable_on A" |
|
3349 thus "(\<lambda>x. of_int (f x)) summable_on A" |
|
3350 by (rule summable_on_homomorphism) auto |
|
3351 next |
|
3352 assume "(\<lambda>x. of_int (f x) :: 'b) summable_on A" |
|
3353 then obtain S where "((\<lambda>x. of_int (f x) :: 'b) has_sum S) A" |
|
3354 by (auto simp: summable_on_def) |
|
3355 hence "(sum (\<lambda>x. of_int (f x) :: 'b) \<longlongrightarrow> S) (finite_subsets_at_top A)" |
|
3356 unfolding has_sum_def . |
|
3357 moreover have "1 / 2 > (0 :: real)" |
|
3358 by auto |
|
3359 ultimately have "eventually (\<lambda>X. dist (sum (\<lambda>x. of_int (f x) :: 'b) X) S < 1/2) |
|
3360 (finite_subsets_at_top A)" |
|
3361 unfolding tendsto_iff by blast |
|
3362 then obtain X where X: "finite X" "X \<subseteq> A" |
|
3363 "\<And>Y. finite Y \<Longrightarrow> X \<subseteq> Y \<Longrightarrow> Y \<subseteq> A \<Longrightarrow> dist (sum (\<lambda>x. of_int (f x)) Y) S < 1/2" |
|
3364 unfolding eventually_finite_subsets_at_top by metis |
|
3365 |
|
3366 have X': "sum f Y = sum f X" if "finite Y" "X \<subseteq> Y" "Y \<subseteq> A" for Y |
|
3367 proof - |
|
3368 have "dist (sum (\<lambda>x. of_int (f x)) X) S < 1 / 2" |
|
3369 by (intro X) auto |
|
3370 moreover have "dist (sum (\<lambda>x. of_int (f x)) Y) S < 1 / 2" |
|
3371 by (intro X that) |
|
3372 ultimately have "dist (sum (\<lambda>x. of_int (f x)) X) (sum (\<lambda>x. of_int (f x) :: 'b) Y) < |
|
3373 1 / 2 + 1 / 2" |
|
3374 using dist_triangle_less_add by blast |
|
3375 thus ?thesis |
|
3376 by (simp add: dist_norm flip: of_int_sum of_int_diff) |
|
3377 qed |
|
3378 |
|
3379 have "{x\<in>A. f x \<noteq> 0} \<subseteq> X" |
|
3380 proof (rule ccontr) |
|
3381 assume "\<not>{x\<in>A. f x \<noteq> 0} \<subseteq> X" |
|
3382 then obtain x where x: "x \<in> A" "f x \<noteq> 0" "x \<notin> X" |
|
3383 by blast |
|
3384 have "sum f (insert x X) = sum f X" |
|
3385 using x X by (intro X') auto |
|
3386 also have "sum f (insert x X) = f x + sum f X" |
|
3387 using x X by auto |
|
3388 finally show False |
|
3389 using x by auto |
|
3390 qed |
|
3391 with \<open>finite X\<close> have "finite {x\<in>A. f x \<noteq> 0}" |
|
3392 using finite_subset by blast |
|
3393 thus "f summable_on A" |
|
3394 by (rule finite_nonzero_values_imp_summable_on) |
|
3395 qed |
|
3396 |
|
3397 lemma summable_on_of_nat_iff: |
|
3398 "(\<lambda>x::'a. of_nat (f x) :: 'b :: real_normed_algebra_1) summable_on A \<longleftrightarrow> f summable_on A" |
|
3399 proof |
|
3400 assume "f summable_on A" |
|
3401 thus "(\<lambda>x. of_nat (f x) :: 'b) summable_on A" |
|
3402 by (rule summable_on_homomorphism) auto |
|
3403 next |
|
3404 assume "(\<lambda>x. of_nat (f x) :: 'b) summable_on A" |
|
3405 hence "(\<lambda>x. of_int (int (f x)) :: 'b) summable_on A" |
|
3406 by simp |
|
3407 also have "?this \<longleftrightarrow> (\<lambda>x. int (f x)) summable_on A" |
|
3408 by (rule summable_on_of_int_iff) |
|
3409 also have "\<dots> \<longleftrightarrow> finite {x\<in>A. f x \<noteq> 0}" |
|
3410 by (simp add: summable_on_discrete_iff) |
|
3411 also have "\<dots> \<longleftrightarrow> f summable_on A" |
|
3412 by (simp add: summable_on_discrete_iff) |
|
3413 finally show "f summable_on A" . |
|
3414 qed |
|
3415 |
|
3416 lemma infsum_of_nat: |
|
3417 "infsum (\<lambda>x::'a. of_nat (f x) :: 'b :: {real_normed_algebra_1}) A = of_nat (infsum f A)" |
|
3418 by (rule infsum_homomorphism_strong) |
|
3419 (auto simp: summable_on_of_nat has_sum_of_nat summable_on_of_nat_iff) |
|
3420 |
|
3421 lemma infsum_of_int: |
|
3422 "infsum (\<lambda>x::'a. of_int (f x) :: 'b :: {real_normed_algebra_1}) A = of_int (infsum f A)" |
|
3423 by (rule infsum_homomorphism_strong) |
|
3424 (auto simp: summable_on_of_nat has_sum_of_int summable_on_of_int_iff) |
|
3425 |
|
3426 |
|
3427 lemma summable_on_SigmaI: |
|
3428 fixes f :: "_ \<Rightarrow> 'a :: {linorder_topology, ordered_comm_monoid_add, topological_comm_monoid_add, |
|
3429 conditionally_complete_linorder}" |
|
3430 assumes f: "\<And>x. x \<in> A \<Longrightarrow> ((\<lambda>y. f (x, y)) has_sum g x) (B x)" |
|
3431 assumes g: "g summable_on A" |
|
3432 assumes f_nonneg: "\<And>x y. x \<in> A \<Longrightarrow> y \<in> B x \<Longrightarrow> f (x, y) \<ge> (0 :: 'a)" |
|
3433 shows "f summable_on Sigma A B" |
|
3434 proof - |
|
3435 have g_nonneg: "g x \<ge> 0" if "x \<in> A" for x |
|
3436 using f by (rule has_sum_nonneg) (use f_nonneg that in auto) |
|
3437 obtain C where C: "eventually (\<lambda>X. sum g X \<le> C) (finite_subsets_at_top A)" |
|
3438 using summable_on_imp_bounded_partial_sums[OF g] by blast |
|
3439 |
|
3440 have sum_g_le: "sum g X \<le> C" if X: "finite X" "X \<subseteq> A" for X |
|
3441 proof - |
|
3442 from C obtain X' where X': |
|
3443 "finite X'" "X' \<subseteq> A" "\<And>Y. finite Y \<Longrightarrow> X' \<subseteq> Y \<Longrightarrow> Y \<subseteq> A \<Longrightarrow> sum g Y \<le> C" |
|
3444 unfolding eventually_finite_subsets_at_top by metis |
|
3445 have "sum g X \<le> sum g (X \<union> X')" |
|
3446 using X X'(1,2) by (intro sum_mono2 g_nonneg) auto |
|
3447 also have "\<dots> \<le> C" |
|
3448 using X X'(1,2) by (intro X'(3)) auto |
|
3449 finally show ?thesis . |
|
3450 qed |
|
3451 |
|
3452 have "sum f Y \<le> C" if Y: "finite Y" "Y \<subseteq> Sigma A B" for Y |
|
3453 proof - |
|
3454 define Y1 and Y2 where "Y1 = fst ` Y" and "Y2 = (\<lambda>x. snd ` {z\<in>Y. fst z = x})" |
|
3455 have Y12: "Y = Sigma Y1 Y2" |
|
3456 unfolding Y1_def Y2_def by force |
|
3457 have [intro]: "finite Y1" "\<And>x. x \<in> Y1 \<Longrightarrow> finite (Y2 x)" |
|
3458 using Y unfolding Y1_def Y2_def by auto |
|
3459 have Y12_subset: "Y1 \<subseteq> A" "\<And>x. Y2 x \<subseteq> B x" |
|
3460 using Y by (auto simp: Y1_def Y2_def) |
|
3461 |
|
3462 have "sum f Y = sum f (Sigma Y1 Y2)" |
|
3463 by (simp add: Y12) |
|
3464 also have "\<dots> = (\<Sum>x\<in>Y1. \<Sum>y\<in>Y2 x. f (x, y))" |
|
3465 by (subst sum.Sigma) auto |
|
3466 also have "\<dots> \<le> (\<Sum>x\<in>Y1. g x)" |
|
3467 proof (rule sum_mono) |
|
3468 fix x assume x: "x \<in> Y1" |
|
3469 show "(\<Sum>y\<in>Y2 x. f (x, y)) \<le> g x" |
|
3470 proof (rule has_sum_mono') |
|
3471 show "((\<lambda>y. f (x, y)) has_sum (\<Sum>y\<in>Y2 x. f (x, y))) (Y2 x)" |
|
3472 using x by (intro has_sum_finite) auto |
|
3473 show "((\<lambda>y. f (x, y)) has_sum g x) (B x)" |
|
3474 by (rule f) (use x Y12_subset in auto) |
|
3475 show "f (x, y) \<ge> 0" if "y \<in> B x - Y2 x" for y |
|
3476 using x that Y12_subset by (intro f_nonneg) auto |
|
3477 qed (use Y12_subset in auto) |
|
3478 qed |
|
3479 also have "\<dots> \<le> C" |
|
3480 using Y12_subset by (intro sum_g_le) auto |
|
3481 finally show ?thesis . |
|
3482 qed |
|
3483 |
|
3484 hence "\<forall>\<^sub>F X in finite_subsets_at_top (Sigma A B). sum f X \<le> C" |
|
3485 unfolding eventually_finite_subsets_at_top by auto |
|
3486 thus ?thesis |
|
3487 by (intro nonneg_bounded_partial_sums_imp_summable_on[where C = C]) |
|
3488 (use f_nonneg in auto) |
|
3489 qed |
|
3490 |
|
3491 lemma summable_on_UnionI: |
|
3492 fixes f :: "_ \<Rightarrow> 'a :: {linorder_topology, ordered_comm_monoid_add, topological_comm_monoid_add, |
|
3493 conditionally_complete_linorder}" |
|
3494 assumes f: "\<And>x. x \<in> A \<Longrightarrow> (f has_sum g x) (B x)" |
|
3495 assumes g: "g summable_on A" |
|
3496 assumes f_nonneg: "\<And>x y. x \<in> A \<Longrightarrow> y \<in> B x \<Longrightarrow> f y \<ge> (0 :: 'a)" |
|
3497 assumes disj: "disjoint_family_on B A" |
|
3498 shows "f summable_on (\<Union>x\<in>A. B x)" |
|
3499 proof - |
|
3500 have "f \<circ> snd summable_on Sigma A B" |
|
3501 using assms by (intro summable_on_SigmaI[where g = g]) auto |
|
3502 also have "?this \<longleftrightarrow> f summable_on (snd ` Sigma A B)" using assms |
|
3503 by (subst summable_on_reindex; force simp: disjoint_family_on_def inj_on_def) |
|
3504 also have "snd ` (Sigma A B) = (\<Union>x\<in>A. B x)" |
|
3505 by force |
|
3506 finally show ?thesis . |
|
3507 qed |
|
3508 |
|
3509 lemma summable_on_SigmaD: |
|
3510 fixes f :: "'a \<times> 'b \<Rightarrow> 'c :: {topological_comm_monoid_add,t3_space}" |
|
3511 assumes sum1: "f summable_on (Sigma A B)" |
|
3512 assumes sum2: "\<And>x. x \<in> A \<Longrightarrow> (\<lambda>y. f (x, y)) summable_on (B x)" |
|
3513 shows "(\<lambda>x. infsum (\<lambda>y. f (x, y)) (B x)) summable_on A" |
|
3514 proof - |
|
3515 from sum1 have 1: "(f has_sum infsum f (Sigma A B)) (Sigma A B)" |
|
3516 using has_sum_infsum by blast |
|
3517 have 2: "((\<lambda>y. f (x, y)) has_sum infsum (\<lambda>y. f (x, y)) (B x)) (B x)" |
|
3518 if "x \<in> A" for x using sum2[OF that] by simp |
|
3519 from has_sum_SigmaD[OF 1 2] show ?thesis |
|
3520 using has_sum_imp_summable by blast |
|
3521 qed |
|
3522 |
|
3523 lemma summable_on_UnionD: |
|
3524 fixes f :: "'a \<Rightarrow> 'c :: {topological_comm_monoid_add,t3_space}" |
|
3525 assumes sum1: "f summable_on (\<Union>x\<in>A. B x)" |
|
3526 assumes sum2: "\<And>x. x \<in> A \<Longrightarrow> f summable_on (B x)" |
|
3527 assumes disj: "disjoint_family_on B A" |
|
3528 shows "(\<lambda>x. infsum f (B x)) summable_on A" |
|
3529 proof - |
|
3530 have "(\<Union>x\<in>A. B x) = snd ` Sigma A B" |
|
3531 by (force simp: Sigma_def) |
|
3532 with sum1 have "f summable_on (snd ` Sigma A B)" |
|
3533 by simp |
|
3534 also have "?this \<longleftrightarrow> (f \<circ> snd) summable_on (Sigma A B)" |
|
3535 using disj by (intro summable_on_reindex inj_onI) (force simp: disjoint_family_on_def) |
|
3536 finally show "(\<lambda>x. infsum f (B x)) summable_on A" |
|
3537 using summable_on_SigmaD[of "f \<circ> snd" A B] sum2 by simp |
|
3538 qed |
|
3539 |
|
3540 lemma summable_on_Union_iff: |
|
3541 fixes f :: "_ \<Rightarrow> 'a :: {linorder_topology, ordered_comm_monoid_add, topological_comm_monoid_add, |
|
3542 conditionally_complete_linorder, t3_space}" |
|
3543 assumes f: "\<And>x. x \<in> A \<Longrightarrow> (f has_sum g x) (B x)" |
|
3544 assumes f_nonneg: "\<And>x y. x \<in> A \<Longrightarrow> y \<in> B x \<Longrightarrow> f y \<ge> 0" |
|
3545 assumes disj: "disjoint_family_on B A" |
|
3546 shows "f summable_on (\<Union>x\<in>A. B x) \<longleftrightarrow> g summable_on A" |
|
3547 proof |
|
3548 assume "g summable_on A" |
|
3549 thus "f summable_on (\<Union>x\<in>A. B x)" |
|
3550 using summable_on_UnionI[of A f B g] assms by auto |
|
3551 next |
|
3552 assume "f summable_on (\<Union>x\<in>A. B x)" |
|
3553 hence "(\<lambda>x. infsum f (B x)) summable_on A" |
|
3554 using assms by (intro summable_on_UnionD) (auto dest: has_sum_imp_summable) |
|
3555 also have "?this \<longleftrightarrow> g summable_on A" |
|
3556 using assms by (intro summable_on_cong) (auto simp: infsumI) |
|
3557 finally show "g summable_on A" . |
|
3558 qed |
|
3559 |
|
3560 lemma has_sum_Sigma': |
|
3561 fixes A :: "'a set" and B :: "'a \<Rightarrow> 'b set" |
|
3562 and f :: \<open>'a \<times> 'b \<Rightarrow> 'c::{comm_monoid_add,uniform_space,uniform_topological_group_add}\<close> |
|
3563 assumes summableAB: "(f has_sum a) (Sigma A B)" |
|
3564 assumes summableB: \<open>\<And>x. x\<in>A \<Longrightarrow> ((\<lambda>y. f (x, y)) has_sum (b x)) (B x)\<close> |
|
3565 shows "(b has_sum a) A" |
|
3566 by (intro has_sum_Sigma[OF _ assms] uniformly_continuous_add) |
|
3567 |
|
3568 lemma abs_summable_on_comparison_test': |
|
3569 assumes "g summable_on A" |
|
3570 assumes "\<And>x. x \<in> A \<Longrightarrow> norm (f x) \<le> g x" |
|
3571 shows "(\<lambda>x. norm (f x)) summable_on A" |
|
3572 proof (rule Infinite_Sum.abs_summable_on_comparison_test) |
|
3573 have "g summable_on A \<longleftrightarrow> (\<lambda>x. norm (g x)) summable_on A" |
|
3574 proof (rule summable_on_cong) |
|
3575 fix x assume "x \<in> A" |
|
3576 have "0 \<le> norm (f x)" |
|
3577 by simp |
|
3578 also have "\<dots> \<le> g x" |
|
3579 by (rule assms) fact |
|
3580 finally show "g x = norm (g x)" |
|
3581 by simp |
|
3582 qed |
|
3583 with assms show "(\<lambda>x. norm (g x)) summable_on A" by blast |
|
3584 next |
|
3585 fix x assume "x \<in> A" |
|
3586 have "norm (f x) \<le> g x" |
|
3587 by (intro assms) fact |
|
3588 also have "\<dots> \<le> norm (g x)" |
|
3589 by simp |
|
3590 finally show "norm (f x) \<le> norm (g x)" . |
|
3591 qed |
|
3592 |
|
3593 lemma has_sum_geometric_from_1: |
|
3594 fixes z :: "'a :: {real_normed_field, banach}" |
|
3595 assumes "norm z < 1" |
|
3596 shows "((\<lambda>n. z ^ n) has_sum (z / (1 - z))) {1..}" |
|
3597 proof - |
|
3598 have [simp]: "z \<noteq> 1" |
|
3599 using assms by auto |
|
3600 have "(\<lambda>n. z ^ Suc n) sums (1 / (1 - z) - 1)" |
|
3601 using geometric_sums[of z] assms by (subst sums_Suc_iff) auto |
|
3602 also have "1 / (1 - z) - 1 = z / (1 - z)" |
|
3603 by (auto simp: field_simps) |
|
3604 finally have "(\<lambda>n. z ^ Suc n) sums (z / (1 - z))" . |
|
3605 moreover have "summable (\<lambda>n. norm (z ^ Suc n))" |
|
3606 using assms |
|
3607 by (subst summable_Suc_iff) (auto simp: norm_power intro!: summable_geometric) |
|
3608 ultimately have "((\<lambda>n. z ^ Suc n) has_sum (z / (1 - z))) UNIV" |
|
3609 by (intro norm_summable_imp_has_sum) |
|
3610 also have "?this \<longleftrightarrow> ?thesis" |
|
3611 by (intro has_sum_reindex_bij_witness[of _ "\<lambda>n. n-1" "\<lambda>n. n+1"]) auto |
|
3612 finally show ?thesis . |
|
3613 qed |
|
3614 |
|
3615 lemma has_sum_divide_const: |
|
3616 fixes f :: "'a \<Rightarrow> 'b :: {topological_semigroup_mult, field, semiring_0}" |
|
3617 shows "(f has_sum S) A \<Longrightarrow> ((\<lambda>x. f x / c) has_sum (S / c)) A" |
|
3618 using has_sum_cmult_right[of f A S "inverse c"] by (simp add: field_simps) |
|
3619 |
|
3620 lemma has_sum_uminusI: |
|
3621 fixes f :: "'a \<Rightarrow> 'b :: {topological_semigroup_mult, ring_1}" |
|
3622 shows "(f has_sum S) A \<Longrightarrow> ((\<lambda>x. -f x) has_sum (-S)) A" |
|
3623 using has_sum_cmult_right[of f A S "-1"] by simp |
|
3624 |
|
3625 end |
|
3626 |