20 (auto simp: SUP_upper less_SUP_iff incseq_def eventually_sequentially intro: less_le_trans) |
27 (auto simp: SUP_upper less_SUP_iff incseq_def eventually_sequentially intro: less_le_trans) |
21 |
28 |
22 lemma eventually_const: "\<not> trivial_limit net \<Longrightarrow> eventually (\<lambda>x. P) net \<longleftrightarrow> P" |
29 lemma eventually_const: "\<not> trivial_limit net \<Longrightarrow> eventually (\<lambda>x. P) net \<longleftrightarrow> P" |
23 by (cases P) (simp_all add: eventually_False) |
30 by (cases P) (simp_all add: eventually_False) |
24 |
31 |
25 lemma (in complete_lattice) Inf_le_Sup: |
32 lemma (in complete_lattice) Inf_le_Sup: "A \<noteq> {} \<Longrightarrow> Inf A \<le> Sup A" |
26 assumes "A \<noteq> {}" shows "Inf A \<le> Sup A" |
33 by (metis Sup_upper2 Inf_lower ex_in_conv) |
27 proof - |
34 |
28 from `A \<noteq> {}` obtain x where "x \<in> A" by auto |
35 lemma (in complete_lattice) INF_le_SUP: "A \<noteq> {} \<Longrightarrow> INFI A f \<le> SUPR A f" |
29 then show ?thesis |
|
30 by (metis Sup_upper2 Inf_lower) |
|
31 qed |
|
32 |
|
33 lemma (in complete_lattice) INF_le_SUP: |
|
34 "A \<noteq> {} \<Longrightarrow> INFI A f \<le> SUPR A f" |
|
35 unfolding INF_def SUP_def by (rule Inf_le_Sup) auto |
36 unfolding INF_def SUP_def by (rule Inf_le_Sup) auto |
36 |
37 |
37 text {* |
38 lemma (in complete_linorder) le_Sup_iff: |
38 |
39 "x \<le> Sup A \<longleftrightarrow> (\<forall>y<x. \<exists>a\<in>A. y < a)" |
39 For more lemmas about the extended real numbers go to |
40 proof safe |
40 @{file "~~/src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy"} |
41 fix y assume "x \<le> Sup A" "y < x" |
41 |
42 then have "y < Sup A" by auto |
42 *} |
43 then show "\<exists>a\<in>A. y < a" |
|
44 unfolding less_Sup_iff . |
|
45 qed (auto elim!: allE[of _ "Sup A"] simp add: not_le[symmetric] Sup_upper) |
|
46 |
|
47 lemma (in complete_linorder) le_SUP_iff: |
|
48 "x \<le> SUPR A f \<longleftrightarrow> (\<forall>y<x. \<exists>i\<in>A. y < f i)" |
|
49 unfolding le_Sup_iff SUP_def by simp |
|
50 |
|
51 lemma (in complete_linorder) Inf_le_iff: |
|
52 "Inf A \<le> x \<longleftrightarrow> (\<forall>y>x. \<exists>a\<in>A. y > a)" |
|
53 proof safe |
|
54 fix y assume "x \<ge> Inf A" "y > x" |
|
55 then have "y > Inf A" by auto |
|
56 then show "\<exists>a\<in>A. y > a" |
|
57 unfolding Inf_less_iff . |
|
58 qed (auto elim!: allE[of _ "Inf A"] simp add: not_le[symmetric] Inf_lower) |
|
59 |
|
60 lemma (in complete_linorder) le_INF_iff: |
|
61 "INFI A f \<le> x \<longleftrightarrow> (\<forall>y>x. \<exists>i\<in>A. y > f i)" |
|
62 unfolding Inf_le_iff INF_def by simp |
43 |
63 |
44 lemma (in complete_lattice) Sup_eqI: |
64 lemma (in complete_lattice) Sup_eqI: |
45 assumes "\<And>y. y \<in> A \<Longrightarrow> y \<le> x" |
65 assumes "\<And>y. y \<in> A \<Longrightarrow> y \<le> x" |
46 assumes "\<And>y. (\<And>z. z \<in> A \<Longrightarrow> z \<le> y) \<Longrightarrow> x \<le> y" |
66 assumes "\<And>y. (\<And>z. z \<in> A \<Longrightarrow> z \<le> y) \<Longrightarrow> x \<le> y" |
47 shows "Sup A = x" |
67 shows "Sup A = x" |
2401 assumes ntriv: "\<not> trivial_limit F" |
2414 assumes ntriv: "\<not> trivial_limit F" |
2402 assumes le: "eventually (\<lambda>n. X n \<le> C) F" |
2415 assumes le: "eventually (\<lambda>n. X n \<le> C) F" |
2403 shows "Limsup F X \<le> C" |
2416 shows "Limsup F X \<le> C" |
2404 using Limsup_mono[OF le] Limsup_const[OF ntriv, of C] by simp |
2417 using Limsup_mono[OF le] Limsup_const[OF ntriv, of C] by simp |
2405 |
2418 |
|
2419 lemma le_Liminf_iff: |
|
2420 fixes X :: "_ \<Rightarrow> _ :: complete_linorder" |
|
2421 shows "C \<le> Liminf F X \<longleftrightarrow> (\<forall>y<C. eventually (\<lambda>x. y < X x) F)" |
|
2422 proof - |
|
2423 { fix y P assume "eventually P F" "y < INFI (Collect P) X" |
|
2424 then have "eventually (\<lambda>x. y < X x) F" |
|
2425 by (auto elim!: eventually_elim1 dest: less_INF_D) } |
|
2426 moreover |
|
2427 { fix y P assume "y < C" and y: "\<forall>y<C. eventually (\<lambda>x. y < X x) F" |
|
2428 have "\<exists>P. eventually P F \<and> y < INFI (Collect P) X" |
|
2429 proof cases |
|
2430 assume "\<exists>z. y < z \<and> z < C" |
|
2431 then guess z .. |
|
2432 moreover then have "z \<le> INFI {x. z < X x} X" |
|
2433 by (auto intro!: INF_greatest) |
|
2434 ultimately show ?thesis |
|
2435 using y by (intro exI[of _ "\<lambda>x. z < X x"]) auto |
|
2436 next |
|
2437 assume "\<not> (\<exists>z. y < z \<and> z < C)" |
|
2438 then have "C \<le> INFI {x. y < X x} X" |
|
2439 by (intro INF_greatest) auto |
|
2440 with `y < C` show ?thesis |
|
2441 using y by (intro exI[of _ "\<lambda>x. y < X x"]) auto |
|
2442 qed } |
|
2443 ultimately show ?thesis |
|
2444 unfolding Liminf_def le_SUP_iff by auto |
|
2445 qed |
|
2446 |
|
2447 lemma lim_imp_Liminf: |
|
2448 fixes f :: "'a \<Rightarrow> _ :: {complete_linorder, linorder_topology}" |
|
2449 assumes ntriv: "\<not> trivial_limit F" |
|
2450 assumes lim: "(f ---> f0) F" |
|
2451 shows "Liminf F f = f0" |
|
2452 proof (intro Liminf_eqI) |
|
2453 fix P assume P: "eventually P F" |
|
2454 then have "eventually (\<lambda>x. INFI (Collect P) f \<le> f x) F" |
|
2455 by eventually_elim (auto intro!: INF_lower) |
|
2456 then show "INFI (Collect P) f \<le> f0" |
|
2457 by (rule tendsto_le[OF ntriv lim tendsto_const]) |
|
2458 next |
|
2459 fix y assume upper: "\<And>P. eventually P F \<Longrightarrow> INFI (Collect P) f \<le> y" |
|
2460 show "f0 \<le> y" |
|
2461 proof cases |
|
2462 assume "\<exists>z. y < z \<and> z < f0" |
|
2463 then guess z .. |
|
2464 moreover have "z \<le> INFI {x. z < f x} f" |
|
2465 by (rule INF_greatest) simp |
|
2466 ultimately show ?thesis |
|
2467 using lim[THEN topological_tendstoD, THEN upper, of "{z <..}"] by auto |
|
2468 next |
|
2469 assume discrete: "\<not> (\<exists>z. y < z \<and> z < f0)" |
|
2470 show ?thesis |
|
2471 proof (rule classical) |
|
2472 assume "\<not> f0 \<le> y" |
|
2473 then have "eventually (\<lambda>x. y < f x) F" |
|
2474 using lim[THEN topological_tendstoD, of "{y <..}"] by auto |
|
2475 then have "eventually (\<lambda>x. f0 \<le> f x) F" |
|
2476 using discrete by (auto elim!: eventually_elim1) |
|
2477 then have "INFI {x. f0 \<le> f x} f \<le> y" |
|
2478 by (rule upper) |
|
2479 moreover have "f0 \<le> INFI {x. f0 \<le> f x} f" |
|
2480 by (intro INF_greatest) simp |
|
2481 ultimately show "f0 \<le> y" by simp |
|
2482 qed |
|
2483 qed |
|
2484 qed |
|
2485 |
|
2486 lemma lim_imp_Limsup: |
|
2487 fixes f :: "'a \<Rightarrow> _ :: {complete_linorder, linorder_topology}" |
|
2488 assumes ntriv: "\<not> trivial_limit F" |
|
2489 assumes lim: "(f ---> f0) F" |
|
2490 shows "Limsup F f = f0" |
|
2491 proof (intro Limsup_eqI) |
|
2492 fix P assume P: "eventually P F" |
|
2493 then have "eventually (\<lambda>x. f x \<le> SUPR (Collect P) f) F" |
|
2494 by eventually_elim (auto intro!: SUP_upper) |
|
2495 then show "f0 \<le> SUPR (Collect P) f" |
|
2496 by (rule tendsto_le[OF ntriv tendsto_const lim]) |
|
2497 next |
|
2498 fix y assume lower: "\<And>P. eventually P F \<Longrightarrow> y \<le> SUPR (Collect P) f" |
|
2499 show "y \<le> f0" |
|
2500 proof cases |
|
2501 assume "\<exists>z. f0 < z \<and> z < y" |
|
2502 then guess z .. |
|
2503 moreover have "SUPR {x. f x < z} f \<le> z" |
|
2504 by (rule SUP_least) simp |
|
2505 ultimately show ?thesis |
|
2506 using lim[THEN topological_tendstoD, THEN lower, of "{..< z}"] by auto |
|
2507 next |
|
2508 assume discrete: "\<not> (\<exists>z. f0 < z \<and> z < y)" |
|
2509 show ?thesis |
|
2510 proof (rule classical) |
|
2511 assume "\<not> y \<le> f0" |
|
2512 then have "eventually (\<lambda>x. f x < y) F" |
|
2513 using lim[THEN topological_tendstoD, of "{..< y}"] by auto |
|
2514 then have "eventually (\<lambda>x. f x \<le> f0) F" |
|
2515 using discrete by (auto elim!: eventually_elim1 simp: not_less) |
|
2516 then have "y \<le> SUPR {x. f x \<le> f0} f" |
|
2517 by (rule lower) |
|
2518 moreover have "SUPR {x. f x \<le> f0} f \<le> f0" |
|
2519 by (intro SUP_least) simp |
|
2520 ultimately show "y \<le> f0" by simp |
|
2521 qed |
|
2522 qed |
|
2523 qed |
|
2524 |
|
2525 lemma Liminf_eq_Limsup: |
|
2526 fixes f0 :: "'a :: {complete_linorder, linorder_topology}" |
|
2527 assumes ntriv: "\<not> trivial_limit F" |
|
2528 and lim: "Liminf F f = f0" "Limsup F f = f0" |
|
2529 shows "(f ---> f0) F" |
|
2530 proof (rule order_tendstoI) |
|
2531 fix a assume "f0 < a" |
|
2532 with assms have "Limsup F f < a" by simp |
|
2533 then obtain P where "eventually P F" "SUPR (Collect P) f < a" |
|
2534 unfolding Limsup_def INF_less_iff by auto |
|
2535 then show "eventually (\<lambda>x. f x < a) F" |
|
2536 by (auto elim!: eventually_elim1 dest: SUP_lessD) |
|
2537 next |
|
2538 fix a assume "a < f0" |
|
2539 with assms have "a < Liminf F f" by simp |
|
2540 then obtain P where "eventually P F" "a < INFI (Collect P) f" |
|
2541 unfolding Liminf_def less_SUP_iff by auto |
|
2542 then show "eventually (\<lambda>x. a < f x) F" |
|
2543 by (auto elim!: eventually_elim1 dest: less_INF_D) |
|
2544 qed |
|
2545 |
|
2546 lemma tendsto_iff_Liminf_eq_Limsup: |
|
2547 fixes f0 :: "'a :: {complete_linorder, linorder_topology}" |
|
2548 shows "\<not> trivial_limit F \<Longrightarrow> (f ---> f0) F \<longleftrightarrow> (Liminf F f = f0 \<and> Limsup F f = f0)" |
|
2549 by (metis Liminf_eq_Limsup lim_imp_Limsup lim_imp_Liminf) |
|
2550 |
2406 lemma liminf_bounded_iff: |
2551 lemma liminf_bounded_iff: |
2407 fixes x :: "nat \<Rightarrow> ereal" |
2552 fixes x :: "nat \<Rightarrow> ereal" |
2408 shows "C \<le> liminf x \<longleftrightarrow> (\<forall>B<C. \<exists>N. \<forall>n\<ge>N. B < x n)" (is "?lhs <-> ?rhs") |
2553 shows "C \<le> liminf x \<longleftrightarrow> (\<forall>B<C. \<exists>N. \<forall>n\<ge>N. B < x n)" (is "?lhs <-> ?rhs") |
2409 proof safe |
2554 unfolding le_Liminf_iff eventually_sequentially .. |
2410 fix B assume "B < C" "C \<le> liminf x" |
|
2411 then have "B < liminf x" by auto |
|
2412 then obtain N where "B < (INF m:{N..}. x m)" |
|
2413 unfolding liminf_SUPR_INFI SUP_def less_Sup_iff by auto |
|
2414 from less_INF_D[OF this] show "\<exists>N. \<forall>n\<ge>N. B < x n" by auto |
|
2415 next |
|
2416 assume *: "\<forall>B<C. \<exists>N. \<forall>n\<ge>N. B < x n" |
|
2417 { fix B assume "B<C" |
|
2418 then obtain N where "\<forall>n\<ge>N. B < x n" using `?rhs` by auto |
|
2419 hence "B \<le> (INF m:{N..}. x m)" by (intro INF_greatest) auto |
|
2420 also have "... \<le> liminf x" unfolding liminf_SUPR_INFI by (intro SUP_upper) simp |
|
2421 finally have "B \<le> liminf x" . |
|
2422 } then show "?lhs" |
|
2423 by (metis * leD Liminf_bounded[OF sequentially_bot] linorder_le_less_linear eventually_sequentially) |
|
2424 qed |
|
2425 |
2555 |
2426 lemma liminf_subseq_mono: |
2556 lemma liminf_subseq_mono: |
2427 fixes X :: "nat \<Rightarrow> 'a :: complete_linorder" |
2557 fixes X :: "nat \<Rightarrow> 'a :: complete_linorder" |
2428 assumes "subseq r" |
2558 assumes "subseq r" |
2429 shows "liminf X \<le> liminf (X \<circ> r) " |
2559 shows "liminf X \<le> liminf (X \<circ> r) " |
2445 proof (safe intro!: SUP_mono) |
2575 proof (safe intro!: SUP_mono) |
2446 fix n m :: nat assume "n \<le> m" then show "\<exists>ma\<in>{n..}. (X \<circ> r) m \<le> X ma" |
2576 fix n m :: nat assume "n \<le> m" then show "\<exists>ma\<in>{n..}. (X \<circ> r) m \<le> X ma" |
2447 using seq_suble[OF `subseq r`, of m] by (intro bexI[of _ "r m"]) auto |
2577 using seq_suble[OF `subseq r`, of m] by (intro bexI[of _ "r m"]) auto |
2448 qed |
2578 qed |
2449 then show ?thesis by (auto intro!: INF_mono simp: limsup_INFI_SUPR comp_def) |
2579 then show ?thesis by (auto intro!: INF_mono simp: limsup_INFI_SUPR comp_def) |
2450 qed |
|
2451 |
|
2452 lemma lim_imp_Liminf: |
|
2453 fixes f :: "'a \<Rightarrow> ereal" (* generalize to inner dense, complete_linorder, order_topology *) |
|
2454 assumes ntriv: "\<not> trivial_limit F" |
|
2455 assumes lim: "(f ---> f0) F" |
|
2456 shows "Liminf F f = f0" |
|
2457 proof (rule Liminf_eqI) |
|
2458 fix y assume *: "\<And>P. eventually P F \<Longrightarrow> INFI (Collect P) f \<le> y" |
|
2459 show "f0 \<le> y" |
|
2460 proof (rule ereal_le_ereal) |
|
2461 fix B |
|
2462 assume "B < f0" |
|
2463 have "B \<le> INFI {x. B < f x} f" |
|
2464 by (rule INF_greatest) simp |
|
2465 also have "INFI {x. B < f x} f \<le> y" |
|
2466 using lim[THEN topological_tendstoD, of "{B <..}"] `B < f0` * by auto |
|
2467 finally show "B \<le> y" . |
|
2468 qed |
|
2469 next |
|
2470 fix P assume P: "eventually P F" |
|
2471 then have "eventually (\<lambda>x. INFI (Collect P) f \<le> f x) F" |
|
2472 by eventually_elim (auto intro!: INF_lower) |
|
2473 then show "INFI (Collect P) f \<le> f0" |
|
2474 by (rule tendsto_le[OF ntriv lim tendsto_const]) |
|
2475 qed |
|
2476 |
|
2477 lemma lim_imp_Limsup: |
|
2478 fixes f :: "'a \<Rightarrow> ereal" (* generalize to inner dense, complete_linorder, order_topology *) |
|
2479 assumes ntriv: "\<not> trivial_limit F" |
|
2480 assumes lim: "(f ---> f0) F" |
|
2481 shows "Limsup F f = f0" |
|
2482 proof (rule Limsup_eqI) |
|
2483 fix y assume *: "\<And>P. eventually P F \<Longrightarrow> y \<le> SUPR (Collect P) f" |
|
2484 show "y \<le> f0" |
|
2485 proof (rule ereal_ge_ereal, safe) |
|
2486 fix B |
|
2487 assume "f0 < B" |
|
2488 have "y \<le> SUPR {x. f x < B} f" |
|
2489 using lim[THEN topological_tendstoD, of "{..< B}"] `f0 < B` * by auto |
|
2490 also have "SUPR {x. f x < B} f \<le> B" |
|
2491 by (rule SUP_least) simp |
|
2492 finally show "y \<le> B" . |
|
2493 qed |
|
2494 next |
|
2495 fix P assume P: "eventually P F" |
|
2496 then have "eventually (\<lambda>x. f x \<le> SUPR (Collect P) f) F" |
|
2497 by eventually_elim (auto intro!: SUP_upper) |
|
2498 then show "f0 \<le> SUPR (Collect P) f" |
|
2499 by (rule tendsto_le[OF ntriv tendsto_const lim]) |
|
2500 qed |
2580 qed |
2501 |
2581 |
2502 definition (in order) mono_set: |
2582 definition (in order) mono_set: |
2503 "mono_set S \<longleftrightarrow> (\<forall>x y. x \<le> y \<longrightarrow> x \<in> S \<longrightarrow> y \<in> S)" |
2583 "mono_set S \<longleftrightarrow> (\<forall>x y. x \<le> y \<longrightarrow> x \<in> S \<longrightarrow> y \<in> S)" |
2504 |
2584 |