557 { fix x :: int and X :: "int set" assume "X \<noteq> {}" "\<And>y. y \<in> X \<Longrightarrow> x \<le> y" then show "x \<le> Inf X" |
557 { fix x :: int and X :: "int set" assume "X \<noteq> {}" "\<And>y. y \<in> X \<Longrightarrow> x \<le> y" then show "x \<le> Inf X" |
558 using Sup_le[of "uminus ` X" "-x"] by (force simp: Inf_int_def) } |
558 using Sup_le[of "uminus ` X" "-x"] by (force simp: Inf_int_def) } |
559 qed |
559 qed |
560 end |
560 end |
561 |
561 |
562 end |
562 lemma interval_cases: |
|
563 fixes S :: "'a :: conditionally_complete_linorder set" |
|
564 assumes ivl: "\<And>a b x. a \<in> S \<Longrightarrow> b \<in> S \<Longrightarrow> a \<le> x \<Longrightarrow> x \<le> b \<Longrightarrow> x \<in> S" |
|
565 shows "\<exists>a b. S = {} \<or> |
|
566 S = UNIV \<or> |
|
567 S = {..<b} \<or> |
|
568 S = {..b} \<or> |
|
569 S = {a<..} \<or> |
|
570 S = {a..} \<or> |
|
571 S = {a<..<b} \<or> |
|
572 S = {a<..b} \<or> |
|
573 S = {a..<b} \<or> |
|
574 S = {a..b}" |
|
575 proof - |
|
576 def lower \<equiv> "{x. \<exists>s\<in>S. s \<le> x}" and upper \<equiv> "{x. \<exists>s\<in>S. x \<le> s}" |
|
577 with ivl have "S = lower \<inter> upper" |
|
578 by auto |
|
579 moreover |
|
580 have "\<exists>a. upper = UNIV \<or> upper = {} \<or> upper = {.. a} \<or> upper = {..< a}" |
|
581 proof cases |
|
582 assume *: "bdd_above S \<and> S \<noteq> {}" |
|
583 from * have "upper \<subseteq> {.. Sup S}" |
|
584 by (auto simp: upper_def intro: cSup_upper2) |
|
585 moreover from * have "{..< Sup S} \<subseteq> upper" |
|
586 by (force simp add: less_cSup_iff upper_def subset_eq Ball_def) |
|
587 ultimately have "upper = {.. Sup S} \<or> upper = {..< Sup S}" |
|
588 unfolding ivl_disj_un(2)[symmetric] by auto |
|
589 then show ?thesis by auto |
|
590 next |
|
591 assume "\<not> (bdd_above S \<and> S \<noteq> {})" |
|
592 then have "upper = UNIV \<or> upper = {}" |
|
593 by (auto simp: upper_def bdd_above_def not_le dest: less_imp_le) |
|
594 then show ?thesis |
|
595 by auto |
|
596 qed |
|
597 moreover |
|
598 have "\<exists>b. lower = UNIV \<or> lower = {} \<or> lower = {b ..} \<or> lower = {b <..}" |
|
599 proof cases |
|
600 assume *: "bdd_below S \<and> S \<noteq> {}" |
|
601 from * have "lower \<subseteq> {Inf S ..}" |
|
602 by (auto simp: lower_def intro: cInf_lower2) |
|
603 moreover from * have "{Inf S <..} \<subseteq> lower" |
|
604 by (force simp add: cInf_less_iff lower_def subset_eq Ball_def) |
|
605 ultimately have "lower = {Inf S ..} \<or> lower = {Inf S <..}" |
|
606 unfolding ivl_disj_un(1)[symmetric] by auto |
|
607 then show ?thesis by auto |
|
608 next |
|
609 assume "\<not> (bdd_below S \<and> S \<noteq> {})" |
|
610 then have "lower = UNIV \<or> lower = {}" |
|
611 by (auto simp: lower_def bdd_below_def not_le dest: less_imp_le) |
|
612 then show ?thesis |
|
613 by auto |
|
614 qed |
|
615 ultimately show ?thesis |
|
616 unfolding greaterThanAtMost_def greaterThanLessThan_def atLeastAtMost_def atLeastLessThan_def |
|
617 by (elim exE disjE) auto |
|
618 qed |
|
619 |
|
620 end |