src/HOL/Library/Extended_Nonnegative_Real.thy
changeset 74325 8d0c2d74ad63
parent 73933 fa92bc604c59
child 74475 409ca22dee4c
equal deleted inserted replaced
74324:308e74afab83 74325:8d0c2d74ad63
  1148       by (intro SUP_upper Max_in)
  1148       by (intro SUP_upper Max_in)
  1149   next
  1149   next
  1150     assume "infinite X" "X \<noteq> {}"
  1150     assume "infinite X" "X \<noteq> {}"
  1151     have "\<exists>y\<in>X. r < ennreal_of_enat y" if r: "r < top" for r
  1151     have "\<exists>y\<in>X. r < ennreal_of_enat y" if r: "r < top" for r
  1152     proof -
  1152     proof -
  1153       from ennreal_Ex_less_of_nat[OF r] guess n .. note n = this
  1153       obtain n where n: "r < of_nat n"
       
  1154         using ennreal_Ex_less_of_nat[OF r] ..
  1154       have "\<not> (X \<subseteq> enat ` {.. n})"
  1155       have "\<not> (X \<subseteq> enat ` {.. n})"
  1155         using \<open>infinite X\<close> by (auto dest: finite_subset)
  1156         using \<open>infinite X\<close> by (auto dest: finite_subset)
  1156       then obtain x where x: "x \<in> X" "x \<notin> enat ` {..n}"
  1157       then obtain x where x: "x \<in> X" "x \<notin> enat ` {..n}"
  1157         by blast
  1158         by blast
  1158       then have "of_nat n \<le> x"
  1159       then have "of_nat n \<le> x"
  1196 proof
  1197 proof
  1197   show "\<exists>a b::ennreal. a \<noteq> b"
  1198   show "\<exists>a b::ennreal. a \<noteq> b"
  1198     using zero_neq_one by (intro exI)
  1199     using zero_neq_one by (intro exI)
  1199   show "\<And>x y::ennreal. x < y \<Longrightarrow> \<exists>z>x. z < y"
  1200   show "\<And>x y::ennreal. x < y \<Longrightarrow> \<exists>z>x. z < y"
  1200   proof transfer
  1201   proof transfer
  1201     fix x y :: ereal assume "0 \<le> x" and *: "x < y"
  1202     fix x y :: ereal
  1202     moreover from dense[OF *] guess z ..
  1203     assume *: "0 \<le> x"
  1203     ultimately show "\<exists>z\<in>Collect ((\<le>) 0). x < z \<and> z < y"
  1204     assume "x < y"
       
  1205     from dense[OF this] obtain z where "x < z \<and> z < y" ..
       
  1206     with * show "\<exists>z\<in>Collect ((\<le>) 0). x < z \<and> z < y"
  1204       by (intro bexI[of _ z]) auto
  1207       by (intro bexI[of _ z]) auto
  1205   qed
  1208   qed
  1206 qed (rule open_ennreal_def)
  1209 qed (rule open_ennreal_def)
  1207 
  1210 
  1208 end
  1211 end
  1691   shows "x = (SUP i \<in> A. f i)"
  1694   shows "x = (SUP i \<in> A. f i)"
  1692 proof (rule antisym)
  1695 proof (rule antisym)
  1693   show "x \<le> (SUP i\<in>A. f i)"
  1696   show "x \<le> (SUP i\<in>A. f i)"
  1694   proof (rule ennreal_le_epsilon)
  1697   proof (rule ennreal_le_epsilon)
  1695     fix e :: real assume "0 < e"
  1698     fix e :: real assume "0 < e"
  1696     from approx[OF this] guess i ..
  1699     from approx[OF this] obtain i where "i \<in> A" and *: "x \<le> f i + ennreal e"
  1697     then have "x \<le> f i + e"
  1700       by blast
       
  1701     from * have "x \<le> f i + e"
  1698       by simp
  1702       by simp
  1699     also have "\<dots> \<le> (SUP i\<in>A. f i) + e"
  1703     also have "\<dots> \<le> (SUP i\<in>A. f i) + e"
  1700       by (intro add_mono \<open>i \<in> A\<close> SUP_upper order_refl)
  1704       by (intro add_mono \<open>i \<in> A\<close> SUP_upper order_refl)
  1701     finally show "x \<le> (SUP i\<in>A. f i) + e" .
  1705     finally show "x \<le> (SUP i\<in>A. f i) + e" .
  1702   qed
  1706   qed
  1709   shows "x = (INF i \<in> A. f i)"
  1713   shows "x = (INF i \<in> A. f i)"
  1710 proof (rule antisym)
  1714 proof (rule antisym)
  1711   show "(INF i\<in>A. f i) \<le> x"
  1715   show "(INF i\<in>A. f i) \<le> x"
  1712   proof (rule ennreal_le_epsilon)
  1716   proof (rule ennreal_le_epsilon)
  1713     fix e :: real assume "0 < e"
  1717     fix e :: real assume "0 < e"
  1714     from approx[OF this] guess i .. note i = this
  1718     from approx[OF this] obtain i where "i\<in>A" "f i \<le> x + ennreal e"
       
  1719       by blast
  1715     then have "(INF i\<in>A. f i) \<le> f i"
  1720     then have "(INF i\<in>A. f i) \<le> f i"
  1716       by (intro INF_lower)
  1721       by (intro INF_lower)
  1717     also have "\<dots> \<le> x + e"
  1722     also have "\<dots> \<le> x + e"
  1718       by fact
  1723       by fact
  1719     finally show "(INF i\<in>A. f i) \<le> x + e" .
  1724     finally show "(INF i\<in>A. f i) \<le> x + e" .