src/HOL/ex/Dedekind_Real.thy
changeset 59814 2d9cf954a829
parent 57514 bdc2c6b40bf2
child 59815 cce82e360c2f
equal deleted inserted replaced
59813:6320064f22bb 59814:2d9cf954a829
    42     by (simp add: cut_def pos nonempty,
    42     by (simp add: cut_def pos nonempty,
    43         blast dest: dense intro: order_less_trans)
    43         blast dest: dense intro: order_less_trans)
    44 qed
    44 qed
    45 
    45 
    46 
    46 
    47 definition "preal = {A. cut A}"
    47 typedef preal = "Collect cut"
    48 
    48   by (blast intro: cut_of_rat [OF zero_less_one])
    49 typedef preal = preal
    49 
    50   unfolding preal_def by (blast intro: cut_of_rat [OF zero_less_one])
    50 lemma Abs_preal_induct [induct type: preal]:
       
    51   "(\<And>x. cut x \<Longrightarrow> P (Abs_preal x)) \<Longrightarrow> P x"
       
    52   using Abs_preal_induct [of P x] by simp
       
    53 
       
    54 lemma Rep_preal:
       
    55   "cut (Rep_preal x)"
       
    56   using Rep_preal [of x] by simp
    51 
    57 
    52 definition
    58 definition
    53   psup :: "preal set => preal" where
    59   psup :: "preal set => preal" where
    54   "psup P = Abs_preal (\<Union>X \<in> P. Rep_preal X)"
    60   "psup P = Abs_preal (\<Union>X \<in> P. Rep_preal X)"
    55 
    61 
   109 
   115 
   110 text{*Reduces equality on abstractions to equality on representatives*}
   116 text{*Reduces equality on abstractions to equality on representatives*}
   111 declare Abs_preal_inject [simp]
   117 declare Abs_preal_inject [simp]
   112 declare Abs_preal_inverse [simp]
   118 declare Abs_preal_inverse [simp]
   113 
   119 
   114 lemma rat_mem_preal: "0 < q ==> {r::rat. 0 < r & r < q} \<in> preal"
   120 lemma rat_mem_preal: "0 < q ==> cut {r::rat. 0 < r & r < q}"
   115 by (simp add: preal_def cut_of_rat)
   121 by (simp add: cut_of_rat)
   116 
   122 
   117 lemma preal_nonempty: "A \<in> preal ==> \<exists>x\<in>A. 0 < x"
   123 lemma preal_nonempty: "cut A ==> \<exists>x\<in>A. 0 < x"
   118   unfolding preal_def cut_def [abs_def] by blast
   124   unfolding cut_def [abs_def] by blast
   119 
   125 
   120 lemma preal_Ex_mem: "A \<in> preal \<Longrightarrow> \<exists>x. x \<in> A"
   126 lemma preal_Ex_mem: "cut A \<Longrightarrow> \<exists>x. x \<in> A"
   121   apply (drule preal_nonempty)
   127   apply (drule preal_nonempty)
   122   apply fast
   128   apply fast
   123   done
   129   done
   124 
   130 
   125 lemma preal_imp_psubset_positives: "A \<in> preal ==> A < {r. 0 < r}"
   131 lemma preal_imp_psubset_positives: "cut A ==> A < {r. 0 < r}"
   126   by (force simp add: preal_def cut_def)
   132   by (force simp add: cut_def)
   127 
   133 
   128 lemma preal_exists_bound: "A \<in> preal ==> \<exists>x. 0 < x & x \<notin> A"
   134 lemma preal_exists_bound: "cut A ==> \<exists>x. 0 < x & x \<notin> A"
   129   apply (drule preal_imp_psubset_positives)
   135   apply (drule preal_imp_psubset_positives)
   130   apply auto
   136   apply auto
   131   done
   137   done
   132 
   138 
   133 lemma preal_exists_greater: "[| A \<in> preal; y \<in> A |] ==> \<exists>u \<in> A. y < u"
   139 lemma preal_exists_greater: "[| cut A; y \<in> A |] ==> \<exists>u \<in> A. y < u"
   134   unfolding preal_def cut_def [abs_def] by blast
   140   unfolding cut_def [abs_def] by blast
   135 
   141 
   136 lemma preal_downwards_closed: "[| A \<in> preal; y \<in> A; 0 < z; z < y |] ==> z \<in> A"
   142 lemma preal_downwards_closed: "[| cut A; y \<in> A; 0 < z; z < y |] ==> z \<in> A"
   137   unfolding preal_def cut_def [abs_def] by blast
   143   unfolding cut_def [abs_def] by blast
   138 
   144 
   139 text{*Relaxing the final premise*}
   145 text{*Relaxing the final premise*}
   140 lemma preal_downwards_closed':
   146 lemma preal_downwards_closed':
   141      "[| A \<in> preal; y \<in> A; 0 < z; z \<le> y |] ==> z \<in> A"
   147      "[| cut A; y \<in> A; 0 < z; z \<le> y |] ==> z \<in> A"
   142 apply (simp add: order_le_less)
   148 apply (simp add: order_le_less)
   143 apply (blast intro: preal_downwards_closed)
   149 apply (blast intro: preal_downwards_closed)
   144 done
   150 done
   145 
   151 
   146 text{*A positive fraction not in a positive real is an upper bound.
   152 text{*A positive fraction not in a positive real is an upper bound.
   147  Gleason p. 122 - Remark (1)*}
   153  Gleason p. 122 - Remark (1)*}
   148 
   154 
   149 lemma not_in_preal_ub:
   155 lemma not_in_preal_ub:
   150   assumes A: "A \<in> preal"
   156   assumes A: "cut A"
   151     and notx: "x \<notin> A"
   157     and notx: "x \<notin> A"
   152     and y: "y \<in> A"
   158     and y: "y \<in> A"
   153     and pos: "0 < x"
   159     and pos: "0 < x"
   154   shows "y < x"
   160   shows "y < x"
   155 proof (cases rule: linorder_cases)
   161 proof (cases rule: linorder_cases)
   165 qed
   171 qed
   166 
   172 
   167 text {* preal lemmas instantiated to @{term "Rep_preal X"} *}
   173 text {* preal lemmas instantiated to @{term "Rep_preal X"} *}
   168 
   174 
   169 lemma mem_Rep_preal_Ex: "\<exists>x. x \<in> Rep_preal X"
   175 lemma mem_Rep_preal_Ex: "\<exists>x. x \<in> Rep_preal X"
       
   176 thm preal_Ex_mem
   170 by (rule preal_Ex_mem [OF Rep_preal])
   177 by (rule preal_Ex_mem [OF Rep_preal])
   171 
   178 
   172 lemma Rep_preal_exists_bound: "\<exists>x>0. x \<notin> Rep_preal X"
   179 lemma Rep_preal_exists_bound: "\<exists>x>0. x \<notin> Rep_preal X"
   173 by (rule preal_exists_bound [OF Rep_preal])
   180 by (rule preal_exists_bound [OF Rep_preal])
   174 
   181 
   193   fix z w :: preal
   200   fix z w :: preal
   194   show "z < w \<longleftrightarrow> z \<le> w \<and> \<not> w \<le> z"
   201   show "z < w \<longleftrightarrow> z \<le> w \<and> \<not> w \<le> z"
   195   by (auto simp add: preal_le_def preal_less_def Rep_preal_inject)
   202   by (auto simp add: preal_le_def preal_less_def Rep_preal_inject)
   196 qed  
   203 qed  
   197 
   204 
   198 lemma preal_imp_pos: "[|A \<in> preal; r \<in> A|] ==> 0 < r"
   205 lemma preal_imp_pos: "[|cut A; r \<in> A|] ==> 0 < r"
   199 by (insert preal_imp_psubset_positives, blast)
   206 by (insert preal_imp_psubset_positives, blast)
   200 
   207 
   201 instance preal :: linorder
   208 instance preal :: linorder
   202 proof
   209 proof
   203   fix x y :: preal
   210   fix x y :: preal
   235 text{*Lemmas for proving that addition of two positive reals gives
   242 text{*Lemmas for proving that addition of two positive reals gives
   236  a positive real*}
   243  a positive real*}
   237 
   244 
   238 text{*Part 1 of Dedekind sections definition*}
   245 text{*Part 1 of Dedekind sections definition*}
   239 lemma add_set_not_empty:
   246 lemma add_set_not_empty:
   240      "[|A \<in> preal; B \<in> preal|] ==> {} \<subset> add_set A B"
   247      "[|cut A; cut B|] ==> {} \<subset> add_set A B"
   241 apply (drule preal_nonempty)+
   248 apply (drule preal_nonempty)+
   242 apply (auto simp add: add_set_def)
   249 apply (auto simp add: add_set_def)
   243 done
   250 done
   244 
   251 
   245 text{*Part 2 of Dedekind sections definition.  A structured version of
   252 text{*Part 2 of Dedekind sections definition.  A structured version of
   246 this proof is @{text preal_not_mem_mult_set_Ex} below.*}
   253 this proof is @{text preal_not_mem_mult_set_Ex} below.*}
   247 lemma preal_not_mem_add_set_Ex:
   254 lemma preal_not_mem_add_set_Ex:
   248      "[|A \<in> preal; B \<in> preal|] ==> \<exists>q>0. q \<notin> add_set A B"
   255      "[|cut A; cut B|] ==> \<exists>q>0. q \<notin> add_set A B"
   249 apply (insert preal_exists_bound [of A] preal_exists_bound [of B], auto) 
   256 apply (insert preal_exists_bound [of A] preal_exists_bound [of B], auto) 
   250 apply (rule_tac x = "x+xa" in exI)
   257 apply (rule_tac x = "x+xa" in exI)
   251 apply (simp add: add_set_def, clarify)
   258 apply (simp add: add_set_def, clarify)
   252 apply (drule (3) not_in_preal_ub)+
   259 apply (drule (3) not_in_preal_ub)+
   253 apply (force dest: add_strict_mono)
   260 apply (force dest: add_strict_mono)
   254 done
   261 done
   255 
   262 
   256 lemma add_set_not_rat_set:
   263 lemma add_set_not_rat_set:
   257    assumes A: "A \<in> preal" 
   264    assumes A: "cut A" 
   258        and B: "B \<in> preal"
   265        and B: "cut B"
   259      shows "add_set A B < {r. 0 < r}"
   266      shows "add_set A B < {r. 0 < r}"
   260 proof
   267 proof
   261   from preal_imp_pos [OF A] preal_imp_pos [OF B]
   268   from preal_imp_pos [OF A] preal_imp_pos [OF B]
   262   show "add_set A B \<subseteq> {r. 0 < r}" by (force simp add: add_set_def) 
   269   show "add_set A B \<subseteq> {r. 0 < r}" by (force simp add: add_set_def) 
   263 next
   270 next
   265     by (insert preal_not_mem_add_set_Ex [OF A B], blast) 
   272     by (insert preal_not_mem_add_set_Ex [OF A B], blast) 
   266 qed
   273 qed
   267 
   274 
   268 text{*Part 3 of Dedekind sections definition*}
   275 text{*Part 3 of Dedekind sections definition*}
   269 lemma add_set_lemma3:
   276 lemma add_set_lemma3:
   270      "[|A \<in> preal; B \<in> preal; u \<in> add_set A B; 0 < z; z < u|] 
   277      "[|cut A; cut B; u \<in> add_set A B; 0 < z; z < u|] 
   271       ==> z \<in> add_set A B"
   278       ==> z \<in> add_set A B"
   272 proof (unfold add_set_def, clarify)
   279 proof (unfold add_set_def, clarify)
   273   fix x::rat and y::rat
   280   fix x::rat and y::rat
   274   assume A: "A \<in> preal" 
   281   assume A: "cut A" 
   275     and B: "B \<in> preal"
   282     and B: "cut B"
   276     and [simp]: "0 < z"
   283     and [simp]: "0 < z"
   277     and zless: "z < x + y"
   284     and zless: "z < x + y"
   278     and x:  "x \<in> A"
   285     and x:  "x \<in> A"
   279     and y:  "y \<in> B"
   286     and y:  "y \<in> B"
   280   have xpos [simp]: "0<x" by (rule preal_imp_pos [OF A x])
   287   have xpos [simp]: "0<x" by (rule preal_imp_pos [OF A x])
   308   qed
   315   qed
   309 qed
   316 qed
   310 
   317 
   311 text{*Part 4 of Dedekind sections definition*}
   318 text{*Part 4 of Dedekind sections definition*}
   312 lemma add_set_lemma4:
   319 lemma add_set_lemma4:
   313      "[|A \<in> preal; B \<in> preal; y \<in> add_set A B|] ==> \<exists>u \<in> add_set A B. y < u"
   320      "[|cut A; cut B; y \<in> add_set A B|] ==> \<exists>u \<in> add_set A B. y < u"
   314 apply (auto simp add: add_set_def)
   321 apply (auto simp add: add_set_def)
   315 apply (frule preal_exists_greater [of A], auto) 
   322 apply (frule preal_exists_greater [of A], auto) 
   316 apply (rule_tac x="u + ya" in exI)
   323 apply (rule_tac x="u + ya" in exI)
   317 apply (auto intro: add_strict_left_mono)
   324 apply (auto intro: add_strict_left_mono)
   318 done
   325 done
   319 
   326 
   320 lemma mem_add_set:
   327 lemma mem_add_set:
   321      "[|A \<in> preal; B \<in> preal|] ==> add_set A B \<in> preal"
   328      "[|cut A; cut B|] ==> cut (add_set A B)"
   322 apply (simp (no_asm_simp) add: preal_def cut_def)
   329 apply (simp (no_asm_simp) add: cut_def)
   323 apply (blast intro!: add_set_not_empty add_set_not_rat_set
   330 apply (blast intro!: add_set_not_empty add_set_not_rat_set
   324                      add_set_lemma3 add_set_lemma4)
   331                      add_set_lemma3 add_set_lemma4)
   325 done
   332 done
   326 
   333 
   327 lemma preal_add_assoc: "((x::preal) + y) + z = x + (y + z)"
   334 lemma preal_add_assoc: "((x::preal) + y) + z = x + (y + z)"
   351 
   358 
   352 text{*Lemmas for proving positive reals multiplication set in @{typ preal}*}
   359 text{*Lemmas for proving positive reals multiplication set in @{typ preal}*}
   353 
   360 
   354 text{*Part 1 of Dedekind sections definition*}
   361 text{*Part 1 of Dedekind sections definition*}
   355 lemma mult_set_not_empty:
   362 lemma mult_set_not_empty:
   356      "[|A \<in> preal; B \<in> preal|] ==> {} \<subset> mult_set A B"
   363      "[|cut A; cut B|] ==> {} \<subset> mult_set A B"
   357 apply (insert preal_nonempty [of A] preal_nonempty [of B]) 
   364 apply (insert preal_nonempty [of A] preal_nonempty [of B]) 
   358 apply (auto simp add: mult_set_def)
   365 apply (auto simp add: mult_set_def)
   359 done
   366 done
   360 
   367 
   361 text{*Part 2 of Dedekind sections definition*}
   368 text{*Part 2 of Dedekind sections definition*}
   362 lemma preal_not_mem_mult_set_Ex:
   369 lemma preal_not_mem_mult_set_Ex:
   363   assumes A: "A \<in> preal" 
   370   assumes A: "cut A" 
   364     and B: "B \<in> preal"
   371     and B: "cut B"
   365   shows "\<exists>q. 0 < q & q \<notin> mult_set A B"
   372   shows "\<exists>q. 0 < q & q \<notin> mult_set A B"
   366 proof -
   373 proof -
   367   from preal_exists_bound [OF A] obtain x where 1 [simp]: "0 < x" "x \<notin> A" by blast
   374   from preal_exists_bound [OF A] obtain x where 1 [simp]: "0 < x" "x \<notin> A" by blast
   368   from preal_exists_bound [OF B] obtain y where 2 [simp]: "0 < y" "y \<notin> B" by blast
   375   from preal_exists_bound [OF B] obtain y where 2 [simp]: "0 < y" "y \<notin> B" by blast
   369   show ?thesis
   376   show ?thesis
   387     qed
   394     qed
   388   qed
   395   qed
   389 qed
   396 qed
   390 
   397 
   391 lemma mult_set_not_rat_set:
   398 lemma mult_set_not_rat_set:
   392   assumes A: "A \<in> preal" 
   399   assumes A: "cut A" 
   393     and B: "B \<in> preal"
   400     and B: "cut B"
   394   shows "mult_set A B < {r. 0 < r}"
   401   shows "mult_set A B < {r. 0 < r}"
   395 proof
   402 proof
   396   show "mult_set A B \<subseteq> {r. 0 < r}"
   403   show "mult_set A B \<subseteq> {r. 0 < r}"
   397     by (force simp add: mult_set_def
   404     by (force simp add: mult_set_def
   398       intro: preal_imp_pos [OF A] preal_imp_pos [OF B] mult_pos_pos)
   405       intro: preal_imp_pos [OF A] preal_imp_pos [OF B] mult_pos_pos)
   402 
   409 
   403 
   410 
   404 
   411 
   405 text{*Part 3 of Dedekind sections definition*}
   412 text{*Part 3 of Dedekind sections definition*}
   406 lemma mult_set_lemma3:
   413 lemma mult_set_lemma3:
   407      "[|A \<in> preal; B \<in> preal; u \<in> mult_set A B; 0 < z; z < u|] 
   414      "[|cut A; cut B; u \<in> mult_set A B; 0 < z; z < u|] 
   408       ==> z \<in> mult_set A B"
   415       ==> z \<in> mult_set A B"
   409 proof (unfold mult_set_def, clarify)
   416 proof (unfold mult_set_def, clarify)
   410   fix x::rat and y::rat
   417   fix x::rat and y::rat
   411   assume A: "A \<in> preal" 
   418   assume A: "cut A" 
   412     and B: "B \<in> preal"
   419     and B: "cut B"
   413     and [simp]: "0 < z"
   420     and [simp]: "0 < z"
   414     and zless: "z < x * y"
   421     and zless: "z < x * y"
   415     and x:  "x \<in> A"
   422     and x:  "x \<in> A"
   416     and y:  "y \<in> B"
   423     and y:  "y \<in> B"
   417   have [simp]: "0<y" by (rule preal_imp_pos [OF B y])
   424   have [simp]: "0<y" by (rule preal_imp_pos [OF B y])
   434   qed
   441   qed
   435 qed
   442 qed
   436 
   443 
   437 text{*Part 4 of Dedekind sections definition*}
   444 text{*Part 4 of Dedekind sections definition*}
   438 lemma mult_set_lemma4:
   445 lemma mult_set_lemma4:
   439      "[|A \<in> preal; B \<in> preal; y \<in> mult_set A B|] ==> \<exists>u \<in> mult_set A B. y < u"
   446      "[|cut A; cut B; y \<in> mult_set A B|] ==> \<exists>u \<in> mult_set A B. y < u"
   440 apply (auto simp add: mult_set_def)
   447 apply (auto simp add: mult_set_def)
   441 apply (frule preal_exists_greater [of A], auto) 
   448 apply (frule preal_exists_greater [of A], auto) 
   442 apply (rule_tac x="u * ya" in exI)
   449 apply (rule_tac x="u * ya" in exI)
   443 apply (auto intro: preal_imp_pos [of A] preal_imp_pos [of B] 
   450 apply (auto intro: preal_imp_pos [of A] preal_imp_pos [of B] 
   444                    mult_strict_right_mono)
   451                    mult_strict_right_mono)
   445 done
   452 done
   446 
   453 
   447 
   454 
   448 lemma mem_mult_set:
   455 lemma mem_mult_set:
   449      "[|A \<in> preal; B \<in> preal|] ==> mult_set A B \<in> preal"
   456      "[|cut A; cut B|] ==> cut (mult_set A B)"
   450 apply (simp (no_asm_simp) add: preal_def cut_def)
   457 apply (simp (no_asm_simp) add: cut_def)
   451 apply (blast intro!: mult_set_not_empty mult_set_not_rat_set
   458 apply (blast intro!: mult_set_not_empty mult_set_not_rat_set
   452                      mult_set_lemma3 mult_set_lemma4)
   459                      mult_set_lemma3 mult_set_lemma4)
   453 done
   460 done
   454 
   461 
   455 lemma preal_mult_assoc: "((x::preal) * y) * z = x * (y * z)"
   462 lemma preal_mult_assoc: "((x::preal) * y) * z = x * (y * z)"
   468 text{* Positive real 1 is the multiplicative identity element *}
   475 text{* Positive real 1 is the multiplicative identity element *}
   469 
   476 
   470 lemma preal_mult_1: "(1::preal) * z = z"
   477 lemma preal_mult_1: "(1::preal) * z = z"
   471 proof (induct z)
   478 proof (induct z)
   472   fix A :: "rat set"
   479   fix A :: "rat set"
   473   assume A: "A \<in> preal"
   480   assume A: "cut A"
   474   have "{w. \<exists>u. 0 < u \<and> u < 1 & (\<exists>v \<in> A. w = u * v)} = A" (is "?lhs = A")
   481   have "{w. \<exists>u. 0 < u \<and> u < 1 & (\<exists>v \<in> A. w = u * v)} = A" (is "?lhs = A")
   475   proof
   482   proof
   476     show "?lhs \<subseteq> A"
   483     show "?lhs \<subseteq> A"
   477     proof clarify
   484     proof clarify
   478       fix x::rat and u::rat and v::rat
   485       fix x::rat and u::rat and v::rat
   586 
   593 
   587 
   594 
   588 subsection{*Existence of Inverse, a Positive Real*}
   595 subsection{*Existence of Inverse, a Positive Real*}
   589 
   596 
   590 lemma mem_inv_set_ex:
   597 lemma mem_inv_set_ex:
   591   assumes A: "A \<in> preal" shows "\<exists>x y. 0 < x & x < y & inverse y \<notin> A"
   598   assumes A: "cut A" shows "\<exists>x y. 0 < x & x < y & inverse y \<notin> A"
   592 proof -
   599 proof -
   593   from preal_exists_bound [OF A]
   600   from preal_exists_bound [OF A]
   594   obtain x where [simp]: "0<x" "x \<notin> A" by blast
   601   obtain x where [simp]: "0<x" "x \<notin> A" by blast
   595   show ?thesis
   602   show ?thesis
   596   proof (intro exI conjI)
   603   proof (intro exI conjI)
   603   qed
   610   qed
   604 qed
   611 qed
   605 
   612 
   606 text{*Part 1 of Dedekind sections definition*}
   613 text{*Part 1 of Dedekind sections definition*}
   607 lemma inverse_set_not_empty:
   614 lemma inverse_set_not_empty:
   608      "A \<in> preal ==> {} \<subset> inverse_set A"
   615      "cut A ==> {} \<subset> inverse_set A"
   609 apply (insert mem_inv_set_ex [of A])
   616 apply (insert mem_inv_set_ex [of A])
   610 apply (auto simp add: inverse_set_def)
   617 apply (auto simp add: inverse_set_def)
   611 done
   618 done
   612 
   619 
   613 text{*Part 2 of Dedekind sections definition*}
   620 text{*Part 2 of Dedekind sections definition*}
   614 
   621 
   615 lemma preal_not_mem_inverse_set_Ex:
   622 lemma preal_not_mem_inverse_set_Ex:
   616    assumes A: "A \<in> preal"  shows "\<exists>q. 0 < q & q \<notin> inverse_set A"
   623    assumes A: "cut A"  shows "\<exists>q. 0 < q & q \<notin> inverse_set A"
   617 proof -
   624 proof -
   618   from preal_nonempty [OF A]
   625   from preal_nonempty [OF A]
   619   obtain x where x: "x \<in> A" and  xpos [simp]: "0<x" ..
   626   obtain x where x: "x \<in> A" and  xpos [simp]: "0<x" ..
   620   show ?thesis
   627   show ?thesis
   621   proof (intro exI conjI)
   628   proof (intro exI conjI)
   633     qed
   640     qed
   634   qed
   641   qed
   635 qed
   642 qed
   636 
   643 
   637 lemma inverse_set_not_rat_set:
   644 lemma inverse_set_not_rat_set:
   638    assumes A: "A \<in> preal"  shows "inverse_set A < {r. 0 < r}"
   645    assumes A: "cut A"  shows "inverse_set A < {r. 0 < r}"
   639 proof
   646 proof
   640   show "inverse_set A \<subseteq> {r. 0 < r}"  by (force simp add: inverse_set_def)
   647   show "inverse_set A \<subseteq> {r. 0 < r}"  by (force simp add: inverse_set_def)
   641 next
   648 next
   642   show "inverse_set A \<noteq> {r. 0 < r}"
   649   show "inverse_set A \<noteq> {r. 0 < r}"
   643     by (insert preal_not_mem_inverse_set_Ex [OF A], blast)
   650     by (insert preal_not_mem_inverse_set_Ex [OF A], blast)
   644 qed
   651 qed
   645 
   652 
   646 text{*Part 3 of Dedekind sections definition*}
   653 text{*Part 3 of Dedekind sections definition*}
   647 lemma inverse_set_lemma3:
   654 lemma inverse_set_lemma3:
   648      "[|A \<in> preal; u \<in> inverse_set A; 0 < z; z < u|] 
   655      "[|cut A; u \<in> inverse_set A; 0 < z; z < u|] 
   649       ==> z \<in> inverse_set A"
   656       ==> z \<in> inverse_set A"
   650 apply (auto simp add: inverse_set_def)
   657 apply (auto simp add: inverse_set_def)
   651 apply (auto intro: order_less_trans)
   658 apply (auto intro: order_less_trans)
   652 done
   659 done
   653 
   660 
   654 text{*Part 4 of Dedekind sections definition*}
   661 text{*Part 4 of Dedekind sections definition*}
   655 lemma inverse_set_lemma4:
   662 lemma inverse_set_lemma4:
   656      "[|A \<in> preal; y \<in> inverse_set A|] ==> \<exists>u \<in> inverse_set A. y < u"
   663      "[|cut A; y \<in> inverse_set A|] ==> \<exists>u \<in> inverse_set A. y < u"
   657 apply (auto simp add: inverse_set_def)
   664 apply (auto simp add: inverse_set_def)
   658 apply (drule dense [of y]) 
   665 apply (drule dense [of y]) 
   659 apply (blast intro: order_less_trans)
   666 apply (blast intro: order_less_trans)
   660 done
   667 done
   661 
   668 
   662 
   669 
   663 lemma mem_inverse_set:
   670 lemma mem_inverse_set:
   664      "A \<in> preal ==> inverse_set A \<in> preal"
   671      "cut A ==> cut (inverse_set A)"
   665 apply (simp (no_asm_simp) add: preal_def cut_def)
   672 apply (simp (no_asm_simp) add: cut_def)
   666 apply (blast intro!: inverse_set_not_empty inverse_set_not_rat_set
   673 apply (blast intro!: inverse_set_not_empty inverse_set_not_rat_set
   667                      inverse_set_lemma3 inverse_set_lemma4)
   674                      inverse_set_lemma3 inverse_set_lemma4)
   668 done
   675 done
   669 
   676 
   670 
   677 
   671 subsection{*Gleason's Lemma 9-3.4, page 122*}
   678 subsection{*Gleason's Lemma 9-3.4, page 122*}
   672 
   679 
   673 lemma Gleason9_34_exists:
   680 lemma Gleason9_34_exists:
   674   assumes A: "A \<in> preal"
   681   assumes A: "cut A"
   675     and "\<forall>x\<in>A. x + u \<in> A"
   682     and "\<forall>x\<in>A. x + u \<in> A"
   676     and "0 \<le> z"
   683     and "0 \<le> z"
   677   shows "\<exists>b\<in>A. b + (of_int z) * u \<in> A"
   684   shows "\<exists>b\<in>A. b + (of_int z) * u \<in> A"
   678 proof (cases z rule: int_cases)
   685 proof (cases z rule: int_cases)
   679   case (nonneg n)
   686   case (nonneg n)
   692   case (neg n)
   699   case (neg n)
   693   with assms show ?thesis by simp
   700   with assms show ?thesis by simp
   694 qed
   701 qed
   695 
   702 
   696 lemma Gleason9_34_contra:
   703 lemma Gleason9_34_contra:
   697   assumes A: "A \<in> preal"
   704   assumes A: "cut A"
   698     shows "[|\<forall>x\<in>A. x + u \<in> A; 0 < u; 0 < y; y \<notin> A|] ==> False"
   705     shows "[|\<forall>x\<in>A. x + u \<in> A; 0 < u; 0 < y; y \<notin> A|] ==> False"
   699 proof (induct u, induct y)
   706 proof (induct u, induct y)
   700   fix a::int and b::int
   707   fix a::int and b::int
   701   fix c::int and d::int
   708   fix c::int and d::int
   702   assume bpos [simp]: "0 < b"
   709   assume bpos [simp]: "0 < b"
   732   with frle and less show False by (simp add: Fract_of_int_eq) 
   739   with frle and less show False by (simp add: Fract_of_int_eq) 
   733 qed
   740 qed
   734 
   741 
   735 
   742 
   736 lemma Gleason9_34:
   743 lemma Gleason9_34:
   737   assumes A: "A \<in> preal"
   744   assumes A: "cut A"
   738     and upos: "0 < u"
   745     and upos: "0 < u"
   739   shows "\<exists>r \<in> A. r + u \<notin> A"
   746   shows "\<exists>r \<in> A. r + u \<notin> A"
   740 proof (rule ccontr, simp)
   747 proof (rule ccontr, simp)
   741   assume closed: "\<forall>r\<in>A. r + u \<in> A"
   748   assume closed: "\<forall>r\<in>A. r + u \<in> A"
   742   from preal_exists_bound [OF A]
   749   from preal_exists_bound [OF A]
   748 
   755 
   749 
   756 
   750 subsection{*Gleason's Lemma 9-3.6*}
   757 subsection{*Gleason's Lemma 9-3.6*}
   751 
   758 
   752 lemma lemma_gleason9_36:
   759 lemma lemma_gleason9_36:
   753   assumes A: "A \<in> preal"
   760   assumes A: "cut A"
   754     and x: "1 < x"
   761     and x: "1 < x"
   755   shows "\<exists>r \<in> A. r*x \<notin> A"
   762   shows "\<exists>r \<in> A. r*x \<notin> A"
   756 proof -
   763 proof -
   757   from preal_nonempty [OF A]
   764   from preal_nonempty [OF A]
   758   obtain y where y: "y \<in> A" and  ypos: "0<y" ..
   765   obtain y where y: "y \<in> A" and  ypos: "0<y" ..
   963 apply (rule_tac x="y+xa" in exI) 
   970 apply (rule_tac x="y+xa" in exI) 
   964 apply (auto simp add: ac_simps)
   971 apply (auto simp add: ac_simps)
   965 done
   972 done
   966 
   973 
   967 lemma mem_diff_set:
   974 lemma mem_diff_set:
   968      "R < S ==> diff_set (Rep_preal S) (Rep_preal R) \<in> preal"
   975      "R < S ==> cut (diff_set (Rep_preal S) (Rep_preal R))"
   969 apply (unfold preal_def cut_def [abs_def])
   976 apply (unfold cut_def)
   970 apply (blast intro!: diff_set_not_empty diff_set_not_rat_set
   977 apply (blast intro!: diff_set_not_empty diff_set_not_rat_set
   971                      diff_set_lemma3 diff_set_lemma4)
   978                      diff_set_lemma3 diff_set_lemma4)
   972 done
   979 done
   973 
   980 
   974 lemma mem_Rep_preal_diff_iff:
   981 lemma mem_Rep_preal_diff_iff:
  1132      "[|P \<noteq> {}; \<forall>X \<in> P. X \<le> Y; y \<in> (\<Union>X \<in> P. Rep_preal(X)) |]
  1139      "[|P \<noteq> {}; \<forall>X \<in> P. X \<le> Y; y \<in> (\<Union>X \<in> P. Rep_preal(X)) |]
  1133           ==> \<exists>u \<in> (\<Union>X \<in> P. Rep_preal(X)). y < u"
  1140           ==> \<exists>u \<in> (\<Union>X \<in> P. Rep_preal(X)). y < u"
  1134 by (blast dest: Rep_preal [THEN preal_exists_greater])
  1141 by (blast dest: Rep_preal [THEN preal_exists_greater])
  1135 
  1142 
  1136 lemma preal_sup:
  1143 lemma preal_sup:
  1137      "[|P \<noteq> {}; \<forall>X \<in> P. X \<le> Y|] ==> (\<Union>X \<in> P. Rep_preal(X)) \<in> preal"
  1144      "[|P \<noteq> {}; \<forall>X \<in> P. X \<le> Y|] ==> cut (\<Union>X \<in> P. Rep_preal(X))"
  1138 apply (unfold preal_def cut_def [abs_def])
  1145 apply (unfold cut_def)
  1139 apply (blast intro!: preal_sup_set_not_empty preal_sup_set_not_rat_set
  1146 apply (blast intro!: preal_sup_set_not_empty preal_sup_set_not_rat_set
  1140                      preal_sup_set_lemma3 preal_sup_set_lemma4)
  1147                      preal_sup_set_lemma3 preal_sup_set_lemma4)
  1141 done
  1148 done
  1142 
  1149 
  1143 lemma preal_psup_le:
  1150 lemma preal_psup_le: