| author | huffman | 
| Wed, 06 Jun 2007 18:32:05 +0200 | |
| changeset 23278 | 375335bf619f | 
| parent 22710 | f44439cdce77 | 
| child 23285 | c95a4f6b3881 | 
| permissions | -rw-r--r-- | 
| 7219 | 1 | (* Title : PReal.thy | 
| 2 | ID : $Id$ | |
| 5078 | 3 | Author : Jacques D. Fleuriot | 
| 4 | Copyright : 1998 University of Cambridge | |
| 5 | Description : The positive reals as Dedekind sections of positive | |
| 14335 | 6 | rationals. Fundamentals of Abstract Analysis [Gleason- p. 121] | 
| 5078 | 7 | provides some of the definitions. | 
| 8 | *) | |
| 9 | ||
| 17428 | 10 | header {* Positive real numbers *}
 | 
| 11 | ||
| 15131 | 12 | theory PReal | 
| 15140 | 13 | imports Rational | 
| 15131 | 14 | begin | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 15 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 16 | text{*Could be generalized and moved to @{text Ring_and_Field}*}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 17 | lemma add_eq_exists: "\<exists>x. a+x = (b::rat)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 18 | by (rule_tac x="b-a" in exI, simp) | 
| 5078 | 19 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 20 | text{*As a special case, the sum of two positives is positive.  One of the
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 21 | premises could be weakened to the relation @{text "\<le>"}.*}
 | 
| 14738 | 22 | lemma pos_add_strict: "[|0<a; b<c|] ==> b < a + (c::'a::ordered_semidom)" | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 23 | by (insert add_strict_mono [of 0 a b c], simp) | 
| 14335 | 24 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 25 | lemma interval_empty_iff: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 26 |      "({y::'a::ordered_field. x < y & y < z} = {}) = (~(x < z))"
 | 
| 18215 | 27 | by (auto dest: dense) | 
| 14335 | 28 | |
| 5078 | 29 | |
| 19765 | 30 | definition | 
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 31 | cut :: "rat set => bool" where | 
| 19765 | 32 |   "cut A = ({} \<subset> A &
 | 
| 33 |             A < {r. 0 < r} &
 | |
| 34 | (\<forall>y \<in> A. ((\<forall>z. 0<z & z < y --> z \<in> A) & (\<exists>u \<in> A. y < u))))" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 35 | |
| 5078 | 36 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 37 | lemma cut_of_rat: | 
| 20495 | 38 |   assumes q: "0 < q" shows "cut {r::rat. 0 < r & r < q}" (is "cut ?A")
 | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 39 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 40 |   from q have pos: "?A < {r. 0 < r}" by force
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 41 |   have nonempty: "{} \<subset> ?A"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 42 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 43 |     show "{} \<subseteq> ?A" by simp
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 44 |     show "{} \<noteq> ?A"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 45 |       by (force simp only: q eq_commute [of "{}"] interval_empty_iff)
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 46 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 47 | show ?thesis | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 48 | by (simp add: cut_def pos nonempty, | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 49 | blast dest: dense intro: order_less_trans) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 50 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 51 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 52 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 53 | typedef preal = "{A. cut A}"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 54 | by (blast intro: cut_of_rat [OF zero_less_one]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 55 | |
| 14691 | 56 | instance preal :: "{ord, plus, minus, times, inverse}" ..
 | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 57 | |
| 19765 | 58 | definition | 
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 59 | preal_of_rat :: "rat => preal" where | 
| 20495 | 60 |   "preal_of_rat q = Abs_preal {x::rat. 0 < x & x < q}"
 | 
| 5078 | 61 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 62 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 63 | psup :: "preal set => preal" where | 
| 20495 | 64 | "psup P = Abs_preal (\<Union>X \<in> P. Rep_preal X)" | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 65 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 66 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 67 | add_set :: "[rat set,rat set] => rat set" where | 
| 19765 | 68 |   "add_set A B = {w. \<exists>x \<in> A. \<exists>y \<in> B. w = x + y}"
 | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 69 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 70 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 71 | diff_set :: "[rat set,rat set] => rat set" where | 
| 19765 | 72 |   "diff_set A B = {w. \<exists>x. 0 < w & 0 < x & x \<notin> B & x + w \<in> A}"
 | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 73 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 74 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 75 | mult_set :: "[rat set,rat set] => rat set" where | 
| 19765 | 76 |   "mult_set A B = {w. \<exists>x \<in> A. \<exists>y \<in> B. w = x * y}"
 | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 77 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 78 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20495diff
changeset | 79 | inverse_set :: "rat set => rat set" where | 
| 19765 | 80 |   "inverse_set A = {x. \<exists>y. 0 < x & x < y & inverse y \<notin> A}"
 | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 81 | |
| 5078 | 82 | |
| 14335 | 83 | defs (overloaded) | 
| 5078 | 84 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 85 | preal_less_def: | 
| 20495 | 86 | "R < S == Rep_preal R < Rep_preal S" | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 87 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 88 | preal_le_def: | 
| 20495 | 89 | "R \<le> S == Rep_preal R \<subseteq> Rep_preal S" | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 90 | |
| 14335 | 91 | preal_add_def: | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 92 | "R + S == Abs_preal (add_set (Rep_preal R) (Rep_preal S))" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 93 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 94 | preal_diff_def: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 95 | "R - S == Abs_preal (diff_set (Rep_preal R) (Rep_preal S))" | 
| 5078 | 96 | |
| 14335 | 97 | preal_mult_def: | 
| 20495 | 98 | "R * S == Abs_preal (mult_set (Rep_preal R) (Rep_preal S))" | 
| 5078 | 99 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 100 | preal_inverse_def: | 
| 20495 | 101 | "inverse R == Abs_preal (inverse_set (Rep_preal R))" | 
| 14335 | 102 | |
| 103 | ||
| 15413 | 104 | text{*Reduces equality on abstractions to equality on representatives*}
 | 
| 105 | declare Abs_preal_inject [simp] | |
| 20495 | 106 | declare Abs_preal_inverse [simp] | 
| 107 | ||
| 108 | lemma rat_mem_preal: "0 < q ==> {r::rat. 0 < r & r < q} \<in> preal"
 | |
| 109 | by (simp add: preal_def cut_of_rat) | |
| 14335 | 110 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 111 | lemma preal_nonempty: "A \<in> preal ==> \<exists>x\<in>A. 0 < x" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 112 | by (unfold preal_def cut_def, blast) | 
| 14335 | 113 | |
| 20495 | 114 | lemma preal_Ex_mem: "A \<in> preal \<Longrightarrow> \<exists>x. x \<in> A" | 
| 115 | by (drule preal_nonempty, fast) | |
| 116 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 117 | lemma preal_imp_psubset_positives: "A \<in> preal ==> A < {r. 0 < r}"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 118 | by (force simp add: preal_def cut_def) | 
| 14335 | 119 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 120 | lemma preal_exists_bound: "A \<in> preal ==> \<exists>x. 0 < x & x \<notin> A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 121 | by (drule preal_imp_psubset_positives, auto) | 
| 14335 | 122 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 123 | lemma preal_exists_greater: "[| A \<in> preal; y \<in> A |] ==> \<exists>u \<in> A. y < u" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 124 | by (unfold preal_def cut_def, blast) | 
| 14335 | 125 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 126 | lemma preal_downwards_closed: "[| A \<in> preal; y \<in> A; 0 < z; z < y |] ==> z \<in> A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 127 | by (unfold preal_def cut_def, blast) | 
| 14335 | 128 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 129 | text{*Relaxing the final premise*}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 130 | lemma preal_downwards_closed': | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 131 | "[| A \<in> preal; y \<in> A; 0 < z; z \<le> y |] ==> z \<in> A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 132 | apply (simp add: order_le_less) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 133 | apply (blast intro: preal_downwards_closed) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 134 | done | 
| 14335 | 135 | |
| 136 | text{*A positive fraction not in a positive real is an upper bound.
 | |
| 137 | Gleason p. 122 - Remark (1)*} | |
| 138 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 139 | lemma not_in_preal_ub: | 
| 19765 | 140 | assumes A: "A \<in> preal" | 
| 141 | and notx: "x \<notin> A" | |
| 142 | and y: "y \<in> A" | |
| 143 | and pos: "0 < x" | |
| 144 | shows "y < x" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 145 | proof (cases rule: linorder_cases) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 146 | assume "x<y" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 147 | with notx show ?thesis | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 148 | by (simp add: preal_downwards_closed [OF A y] pos) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 149 | next | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 150 | assume "x=y" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 151 | with notx and y show ?thesis by simp | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 152 | next | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 153 | assume "y<x" | 
| 20495 | 154 | thus ?thesis . | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 155 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 156 | |
| 20495 | 157 | text {* preal lemmas instantiated to @{term "Rep_preal X"} *}
 | 
| 158 | ||
| 159 | lemma mem_Rep_preal_Ex: "\<exists>x. x \<in> Rep_preal X" | |
| 160 | by (rule preal_Ex_mem [OF Rep_preal]) | |
| 161 | ||
| 162 | lemma Rep_preal_exists_bound: "\<exists>x>0. x \<notin> Rep_preal X" | |
| 163 | by (rule preal_exists_bound [OF Rep_preal]) | |
| 164 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 165 | lemmas not_in_Rep_preal_ub = not_in_preal_ub [OF Rep_preal] | 
| 14335 | 166 | |
| 167 | ||
| 20495 | 168 | |
| 169 | subsection{*@{term preal_of_prat}: the Injection from prat to preal*}
 | |
| 170 | ||
| 171 | lemma rat_less_set_mem_preal: "0 < y ==> {u::rat. 0 < u & u < y} \<in> preal"
 | |
| 172 | by (simp add: preal_def cut_of_rat) | |
| 173 | ||
| 174 | lemma rat_subset_imp_le: | |
| 175 |      "[|{u::rat. 0 < u & u < x} \<subseteq> {u. 0 < u & u < y}; 0<x|] ==> x \<le> y"
 | |
| 176 | apply (simp add: linorder_not_less [symmetric]) | |
| 177 | apply (blast dest: dense intro: order_less_trans) | |
| 178 | done | |
| 179 | ||
| 180 | lemma rat_set_eq_imp_eq: | |
| 181 |      "[|{u::rat. 0 < u & u < x} = {u. 0 < u & u < y};
 | |
| 182 | 0 < x; 0 < y|] ==> x = y" | |
| 183 | by (blast intro: rat_subset_imp_le order_antisym) | |
| 184 | ||
| 185 | ||
| 186 | ||
| 187 | subsection{*Properties of Ordering*}
 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 188 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 189 | lemma preal_le_refl: "w \<le> (w::preal)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 190 | by (simp add: preal_le_def) | 
| 14335 | 191 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 192 | lemma preal_le_trans: "[| i \<le> j; j \<le> k |] ==> i \<le> (k::preal)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 193 | by (force simp add: preal_le_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 194 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 195 | lemma preal_le_anti_sym: "[| z \<le> w; w \<le> z |] ==> z = (w::preal)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 196 | apply (simp add: preal_le_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 197 | apply (rule Rep_preal_inject [THEN iffD1], blast) | 
| 14335 | 198 | done | 
| 199 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 200 | (* Axiom 'order_less_le' of class 'order': *) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 201 | lemma preal_less_le: "((w::preal) < z) = (w \<le> z & w \<noteq> z)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 202 | by (simp add: preal_le_def preal_less_def Rep_preal_inject psubset_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 203 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 204 | instance preal :: order | 
| 14691 | 205 | by intro_classes | 
| 206 | (assumption | | |
| 207 | rule preal_le_refl preal_le_trans preal_le_anti_sym preal_less_le)+ | |
| 14335 | 208 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 209 | lemma preal_imp_pos: "[|A \<in> preal; r \<in> A|] ==> 0 < r" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 210 | by (insert preal_imp_psubset_positives, blast) | 
| 14335 | 211 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 212 | lemma preal_le_linear: "x <= y | y <= (x::preal)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 213 | apply (auto simp add: preal_le_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 214 | apply (rule ccontr) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 215 | apply (blast dest: not_in_Rep_preal_ub intro: preal_imp_pos [OF Rep_preal] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 216 | elim: order_less_asym) | 
| 14335 | 217 | done | 
| 218 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 219 | instance preal :: linorder | 
| 14691 | 220 | by intro_classes (rule preal_le_linear) | 
| 14335 | 221 | |
| 22483 | 222 | instance preal :: distrib_lattice | 
| 223 | "inf \<equiv> min" | |
| 224 | "sup \<equiv> max" | |
| 225 | by intro_classes | |
| 226 | (auto simp add: inf_preal_def sup_preal_def min_max.sup_inf_distrib1) | |
| 14335 | 227 | |
| 228 | ||
| 229 | subsection{*Properties of Addition*}
 | |
| 230 | ||
| 231 | lemma preal_add_commute: "(x::preal) + y = y + x" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 232 | apply (unfold preal_add_def add_set_def) | 
| 14335 | 233 | apply (rule_tac f = Abs_preal in arg_cong) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 234 | apply (force simp add: add_commute) | 
| 14335 | 235 | done | 
| 236 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 237 | text{*Lemmas for proving that addition of two positive reals gives
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 238 | a positive real*} | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 239 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 240 | lemma empty_psubset_nonempty: "a \<in> A ==> {} \<subset> A"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 241 | by blast | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 242 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 243 | text{*Part 1 of Dedekind sections definition*}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 244 | lemma add_set_not_empty: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 245 |      "[|A \<in> preal; B \<in> preal|] ==> {} \<subset> add_set A B"
 | 
| 20495 | 246 | apply (drule preal_nonempty)+ | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 247 | apply (auto simp add: add_set_def) | 
| 14335 | 248 | done | 
| 249 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 250 | text{*Part 2 of Dedekind sections definition.  A structured version of
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 251 | this proof is @{text preal_not_mem_mult_set_Ex} below.*}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 252 | lemma preal_not_mem_add_set_Ex: | 
| 20495 | 253 | "[|A \<in> preal; B \<in> preal|] ==> \<exists>q>0. q \<notin> add_set A B" | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 254 | apply (insert preal_exists_bound [of A] preal_exists_bound [of B], auto) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 255 | apply (rule_tac x = "x+xa" in exI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 256 | apply (simp add: add_set_def, clarify) | 
| 20495 | 257 | apply (drule (3) not_in_preal_ub)+ | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 258 | apply (force dest: add_strict_mono) | 
| 14335 | 259 | done | 
| 260 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 261 | lemma add_set_not_rat_set: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 262 | assumes A: "A \<in> preal" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 263 | and B: "B \<in> preal" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 264 |      shows "add_set A B < {r. 0 < r}"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 265 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 266 | from preal_imp_pos [OF A] preal_imp_pos [OF B] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 267 |   show "add_set A B \<subseteq> {r. 0 < r}" by (force simp add: add_set_def) 
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 268 | next | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 269 |   show "add_set A B \<noteq> {r. 0 < r}"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 270 | by (insert preal_not_mem_add_set_Ex [OF A B], blast) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 271 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 272 | |
| 14335 | 273 | text{*Part 3 of Dedekind sections definition*}
 | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 274 | lemma add_set_lemma3: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 275 | "[|A \<in> preal; B \<in> preal; u \<in> add_set A B; 0 < z; z < u|] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 276 | ==> z \<in> add_set A B" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 277 | proof (unfold add_set_def, clarify) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 278 | fix x::rat and y::rat | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 279 | assume A: "A \<in> preal" | 
| 19765 | 280 | and B: "B \<in> preal" | 
| 281 | and [simp]: "0 < z" | |
| 282 | and zless: "z < x + y" | |
| 283 | and x: "x \<in> A" | |
| 284 | and y: "y \<in> B" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 285 | have xpos [simp]: "0<x" by (rule preal_imp_pos [OF A x]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 286 | have ypos [simp]: "0<y" by (rule preal_imp_pos [OF B y]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 287 | have xypos [simp]: "0 < x+y" by (simp add: pos_add_strict) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 288 | let ?f = "z/(x+y)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 289 | have fless: "?f < 1" by (simp add: zless pos_divide_less_eq) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 290 | show "\<exists>x' \<in> A. \<exists>y'\<in>B. z = x' + y'" | 
| 20495 | 291 | proof (intro bexI) | 
| 292 | show "z = x*?f + y*?f" | |
| 293 | by (simp add: left_distrib [symmetric] divide_inverse mult_ac | |
| 294 | order_less_imp_not_eq2) | |
| 295 | next | |
| 296 | show "y * ?f \<in> B" | |
| 297 | proof (rule preal_downwards_closed [OF B y]) | |
| 298 | show "0 < y * ?f" | |
| 299 | by (simp add: divide_inverse zero_less_mult_iff) | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 300 | next | 
| 20495 | 301 | show "y * ?f < y" | 
| 302 | by (insert mult_strict_left_mono [OF fless ypos], simp) | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 303 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 304 | next | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 305 | show "x * ?f \<in> A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 306 | proof (rule preal_downwards_closed [OF A x]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 307 | show "0 < x * ?f" | 
| 14430 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 paulson parents: 
14387diff
changeset | 308 | by (simp add: divide_inverse zero_less_mult_iff) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 309 | next | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 310 | show "x * ?f < x" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 311 | by (insert mult_strict_left_mono [OF fless xpos], simp) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 312 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 313 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 314 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 315 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 316 | text{*Part 4 of Dedekind sections definition*}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 317 | lemma add_set_lemma4: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 318 | "[|A \<in> preal; B \<in> preal; y \<in> add_set A B|] ==> \<exists>u \<in> add_set A B. y < u" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 319 | apply (auto simp add: add_set_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 320 | apply (frule preal_exists_greater [of A], auto) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 321 | apply (rule_tac x="u + y" in exI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 322 | apply (auto intro: add_strict_left_mono) | 
| 14335 | 323 | done | 
| 324 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 325 | lemma mem_add_set: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 326 | "[|A \<in> preal; B \<in> preal|] ==> add_set A B \<in> preal" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 327 | apply (simp (no_asm_simp) add: preal_def cut_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 328 | apply (blast intro!: add_set_not_empty add_set_not_rat_set | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 329 | add_set_lemma3 add_set_lemma4) | 
| 14335 | 330 | done | 
| 331 | ||
| 332 | lemma preal_add_assoc: "((x::preal) + y) + z = x + (y + z)" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 333 | apply (simp add: preal_add_def mem_add_set Rep_preal) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 334 | apply (force simp add: add_set_def add_ac) | 
| 14335 | 335 | done | 
| 336 | ||
| 337 | lemma preal_add_left_commute: "x + (y + z) = y + ((x + z)::preal)" | |
| 338 | apply (rule mk_left_commute [of "op +"]) | |
| 339 | apply (rule preal_add_assoc) | |
| 340 | apply (rule preal_add_commute) | |
| 341 | done | |
| 342 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 343 | text{* Positive Real addition is an AC operator *}
 | 
| 14335 | 344 | lemmas preal_add_ac = preal_add_assoc preal_add_commute preal_add_left_commute | 
| 345 | ||
| 346 | ||
| 347 | subsection{*Properties of Multiplication*}
 | |
| 348 | ||
| 349 | text{*Proofs essentially same as for addition*}
 | |
| 350 | ||
| 351 | lemma preal_mult_commute: "(x::preal) * y = y * x" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 352 | apply (unfold preal_mult_def mult_set_def) | 
| 14335 | 353 | apply (rule_tac f = Abs_preal in arg_cong) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 354 | apply (force simp add: mult_commute) | 
| 14335 | 355 | done | 
| 356 | ||
| 15055 | 357 | text{*Multiplication of two positive reals gives a positive real.*}
 | 
| 14335 | 358 | |
| 359 | text{*Lemmas for proving positive reals multiplication set in @{typ preal}*}
 | |
| 360 | ||
| 361 | text{*Part 1 of Dedekind sections definition*}
 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 362 | lemma mult_set_not_empty: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 363 |      "[|A \<in> preal; B \<in> preal|] ==> {} \<subset> mult_set A B"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 364 | apply (insert preal_nonempty [of A] preal_nonempty [of B]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 365 | apply (auto simp add: mult_set_def) | 
| 14335 | 366 | done | 
| 367 | ||
| 368 | text{*Part 2 of Dedekind sections definition*}
 | |
| 369 | lemma preal_not_mem_mult_set_Ex: | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 370 | assumes A: "A \<in> preal" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 371 | and B: "B \<in> preal" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 372 | shows "\<exists>q. 0 < q & q \<notin> mult_set A B" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 373 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 374 | from preal_exists_bound [OF A] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 375 | obtain x where [simp]: "0 < x" "x \<notin> A" by blast | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 376 | from preal_exists_bound [OF B] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 377 | obtain y where [simp]: "0 < y" "y \<notin> B" by blast | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 378 | show ?thesis | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 379 | proof (intro exI conjI) | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
15413diff
changeset | 380 | show "0 < x*y" by (simp add: mult_pos_pos) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 381 | show "x * y \<notin> mult_set A B" | 
| 14377 | 382 | proof - | 
| 383 |       { fix u::rat and v::rat
 | |
| 14550 | 384 | assume "u \<in> A" and "v \<in> B" and "x*y = u*v" | 
| 385 | moreover | |
| 386 | with prems have "u<x" and "v<y" by (blast dest: not_in_preal_ub)+ | |
| 387 | moreover | |
| 388 | with prems have "0\<le>v" | |
| 389 | by (blast intro: preal_imp_pos [OF B] order_less_imp_le prems) | |
| 390 | moreover | |
| 391 | from calculation | |
| 392 | have "u*v < x*y" by (blast intro: mult_strict_mono prems) | |
| 393 | ultimately have False by force } | |
| 14377 | 394 | thus ?thesis by (auto simp add: mult_set_def) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 395 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 396 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 397 | qed | 
| 14335 | 398 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 399 | lemma mult_set_not_rat_set: | 
| 19765 | 400 | assumes A: "A \<in> preal" | 
| 401 | and B: "B \<in> preal" | |
| 402 |   shows "mult_set A B < {r. 0 < r}"
 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 403 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 404 |   show "mult_set A B \<subseteq> {r. 0 < r}"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 405 | by (force simp add: mult_set_def | 
| 19765 | 406 | intro: preal_imp_pos [OF A] preal_imp_pos [OF B] mult_pos_pos) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 407 |   show "mult_set A B \<noteq> {r. 0 < r}"
 | 
| 19765 | 408 | using preal_not_mem_mult_set_Ex [OF A B] by blast | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 409 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 410 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 411 | |
| 14335 | 412 | |
| 413 | text{*Part 3 of Dedekind sections definition*}
 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 414 | lemma mult_set_lemma3: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 415 | "[|A \<in> preal; B \<in> preal; u \<in> mult_set A B; 0 < z; z < u|] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 416 | ==> z \<in> mult_set A B" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 417 | proof (unfold mult_set_def, clarify) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 418 | fix x::rat and y::rat | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 419 | assume A: "A \<in> preal" | 
| 19765 | 420 | and B: "B \<in> preal" | 
| 421 | and [simp]: "0 < z" | |
| 422 | and zless: "z < x * y" | |
| 423 | and x: "x \<in> A" | |
| 424 | and y: "y \<in> B" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 425 | have [simp]: "0<y" by (rule preal_imp_pos [OF B y]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 426 | show "\<exists>x' \<in> A. \<exists>y' \<in> B. z = x' * y'" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 427 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 428 | show "\<exists>y'\<in>B. z = (z/y) * y'" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 429 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 430 | show "z = (z/y)*y" | 
| 14430 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 paulson parents: 
14387diff
changeset | 431 | by (simp add: divide_inverse mult_commute [of y] mult_assoc | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 432 | order_less_imp_not_eq2) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 433 | show "y \<in> B" . | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 434 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 435 | next | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 436 | show "z/y \<in> A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 437 | proof (rule preal_downwards_closed [OF A x]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 438 | show "0 < z/y" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 439 | by (simp add: zero_less_divide_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 440 | show "z/y < x" by (simp add: pos_divide_less_eq zless) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 441 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 442 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 443 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 444 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 445 | text{*Part 4 of Dedekind sections definition*}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 446 | lemma mult_set_lemma4: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 447 | "[|A \<in> preal; B \<in> preal; y \<in> mult_set A B|] ==> \<exists>u \<in> mult_set A B. y < u" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 448 | apply (auto simp add: mult_set_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 449 | apply (frule preal_exists_greater [of A], auto) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 450 | apply (rule_tac x="u * y" in exI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 451 | apply (auto intro: preal_imp_pos [of A] preal_imp_pos [of B] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 452 | mult_strict_right_mono) | 
| 14335 | 453 | done | 
| 454 | ||
| 455 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 456 | lemma mem_mult_set: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 457 | "[|A \<in> preal; B \<in> preal|] ==> mult_set A B \<in> preal" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 458 | apply (simp (no_asm_simp) add: preal_def cut_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 459 | apply (blast intro!: mult_set_not_empty mult_set_not_rat_set | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 460 | mult_set_lemma3 mult_set_lemma4) | 
| 14335 | 461 | done | 
| 462 | ||
| 463 | lemma preal_mult_assoc: "((x::preal) * y) * z = x * (y * z)" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 464 | apply (simp add: preal_mult_def mem_mult_set Rep_preal) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 465 | apply (force simp add: mult_set_def mult_ac) | 
| 14335 | 466 | done | 
| 467 | ||
| 468 | lemma preal_mult_left_commute: "x * (y * z) = y * ((x * z)::preal)" | |
| 469 | apply (rule mk_left_commute [of "op *"]) | |
| 470 | apply (rule preal_mult_assoc) | |
| 471 | apply (rule preal_mult_commute) | |
| 472 | done | |
| 473 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 474 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 475 | text{* Positive Real multiplication is an AC operator *}
 | 
| 14335 | 476 | lemmas preal_mult_ac = | 
| 477 | preal_mult_assoc preal_mult_commute preal_mult_left_commute | |
| 478 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 479 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 480 | text{* Positive real 1 is the multiplicative identity element *}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 481 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 482 | lemma preal_mult_1: "(preal_of_rat 1) * z = z" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 483 | proof (induct z) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 484 | fix A :: "rat set" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 485 | assume A: "A \<in> preal" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 486 |   have "{w. \<exists>u. 0 < u \<and> u < 1 & (\<exists>v \<in> A. w = u * v)} = A" (is "?lhs = A")
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 487 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 488 | show "?lhs \<subseteq> A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 489 | proof clarify | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 490 | fix x::rat and u::rat and v::rat | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 491 | assume upos: "0<u" and "u<1" and v: "v \<in> A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 492 | have vpos: "0<v" by (rule preal_imp_pos [OF A v]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 493 | hence "u*v < 1*v" by (simp only: mult_strict_right_mono prems) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 494 | thus "u * v \<in> A" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
15413diff
changeset | 495 | by (force intro: preal_downwards_closed [OF A v] mult_pos_pos | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
15413diff
changeset | 496 | upos vpos) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 497 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 498 | next | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 499 | show "A \<subseteq> ?lhs" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 500 | proof clarify | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 501 | fix x::rat | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 502 | assume x: "x \<in> A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 503 | have xpos: "0<x" by (rule preal_imp_pos [OF A x]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 504 | from preal_exists_greater [OF A x] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 505 | obtain v where v: "v \<in> A" and xlessv: "x < v" .. | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 506 | have vpos: "0<v" by (rule preal_imp_pos [OF A v]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 507 | show "\<exists>u. 0 < u \<and> u < 1 \<and> (\<exists>v\<in>A. x = u * v)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 508 | proof (intro exI conjI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 509 | show "0 < x/v" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 510 | by (simp add: zero_less_divide_iff xpos vpos) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 511 | show "x / v < 1" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 512 | by (simp add: pos_divide_less_eq vpos xlessv) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 513 | show "\<exists>v'\<in>A. x = (x / v) * v'" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 514 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 515 | show "x = (x/v)*v" | 
| 14430 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 paulson parents: 
14387diff
changeset | 516 | by (simp add: divide_inverse mult_assoc vpos | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 517 | order_less_imp_not_eq2) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 518 | show "v \<in> A" . | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 519 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 520 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 521 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 522 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 523 | thus "preal_of_rat 1 * Abs_preal A = Abs_preal A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 524 | by (simp add: preal_of_rat_def preal_mult_def mult_set_def | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 525 | rat_mem_preal A) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 526 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 527 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 528 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 529 | lemma preal_mult_1_right: "z * (preal_of_rat 1) = z" | 
| 14335 | 530 | apply (rule preal_mult_commute [THEN subst]) | 
| 531 | apply (rule preal_mult_1) | |
| 532 | done | |
| 533 | ||
| 534 | ||
| 535 | subsection{*Distribution of Multiplication across Addition*}
 | |
| 536 | ||
| 537 | lemma mem_Rep_preal_add_iff: | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 538 | "(z \<in> Rep_preal(R+S)) = (\<exists>x \<in> Rep_preal R. \<exists>y \<in> Rep_preal S. z = x + y)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 539 | apply (simp add: preal_add_def mem_add_set Rep_preal) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 540 | apply (simp add: add_set_def) | 
| 14335 | 541 | done | 
| 542 | ||
| 543 | lemma mem_Rep_preal_mult_iff: | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 544 | "(z \<in> Rep_preal(R*S)) = (\<exists>x \<in> Rep_preal R. \<exists>y \<in> Rep_preal S. z = x * y)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 545 | apply (simp add: preal_mult_def mem_mult_set Rep_preal) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 546 | apply (simp add: mult_set_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 547 | done | 
| 14335 | 548 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 549 | lemma distrib_subset1: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 550 | "Rep_preal (w * (x + y)) \<subseteq> Rep_preal (w * x + w * y)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 551 | apply (auto simp add: Bex_def mem_Rep_preal_add_iff mem_Rep_preal_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 552 | apply (force simp add: right_distrib) | 
| 14335 | 553 | done | 
| 554 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 555 | lemma preal_add_mult_distrib_mean: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 556 | assumes a: "a \<in> Rep_preal w" | 
| 19765 | 557 | and b: "b \<in> Rep_preal w" | 
| 558 | and d: "d \<in> Rep_preal x" | |
| 559 | and e: "e \<in> Rep_preal y" | |
| 560 | shows "\<exists>c \<in> Rep_preal w. a * d + b * e = c * (d + e)" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 561 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 562 | let ?c = "(a*d + b*e)/(d+e)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 563 | have [simp]: "0<a" "0<b" "0<d" "0<e" "0<d+e" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 564 | by (blast intro: preal_imp_pos [OF Rep_preal] a b d e pos_add_strict)+ | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 565 | have cpos: "0 < ?c" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 566 | by (simp add: zero_less_divide_iff zero_less_mult_iff pos_add_strict) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 567 | show "a * d + b * e = ?c * (d + e)" | 
| 14430 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 paulson parents: 
14387diff
changeset | 568 | by (simp add: divide_inverse mult_assoc order_less_imp_not_eq2) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 569 | show "?c \<in> Rep_preal w" | 
| 20495 | 570 | proof (cases rule: linorder_le_cases) | 
| 571 | assume "a \<le> b" | |
| 572 | hence "?c \<le> b" | |
| 573 | by (simp add: pos_divide_le_eq right_distrib mult_right_mono | |
| 574 | order_less_imp_le) | |
| 575 | thus ?thesis by (rule preal_downwards_closed' [OF Rep_preal b cpos]) | |
| 576 | next | |
| 577 | assume "b \<le> a" | |
| 578 | hence "?c \<le> a" | |
| 579 | by (simp add: pos_divide_le_eq right_distrib mult_right_mono | |
| 580 | order_less_imp_le) | |
| 581 | thus ?thesis by (rule preal_downwards_closed' [OF Rep_preal a cpos]) | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 582 | qed | 
| 20495 | 583 | qed | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 584 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 585 | lemma distrib_subset2: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 586 | "Rep_preal (w * x + w * y) \<subseteq> Rep_preal (w * (x + y))" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 587 | apply (auto simp add: Bex_def mem_Rep_preal_add_iff mem_Rep_preal_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 588 | apply (drule_tac w=w and x=x and y=y in preal_add_mult_distrib_mean, auto) | 
| 14335 | 589 | done | 
| 590 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 591 | lemma preal_add_mult_distrib2: "(w * ((x::preal) + y)) = (w * x) + (w * y)" | 
| 15413 | 592 | apply (rule Rep_preal_inject [THEN iffD1]) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 593 | apply (rule equalityI [OF distrib_subset1 distrib_subset2]) | 
| 14335 | 594 | done | 
| 595 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 596 | lemma preal_add_mult_distrib: "(((x::preal) + y) * w) = (x * w) + (y * w)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 597 | by (simp add: preal_mult_commute preal_add_mult_distrib2) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 598 | |
| 14335 | 599 | |
| 600 | subsection{*Existence of Inverse, a Positive Real*}
 | |
| 601 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 602 | lemma mem_inv_set_ex: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 603 | assumes A: "A \<in> preal" shows "\<exists>x y. 0 < x & x < y & inverse y \<notin> A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 604 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 605 | from preal_exists_bound [OF A] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 606 | obtain x where [simp]: "0<x" "x \<notin> A" by blast | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 607 | show ?thesis | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 608 | proof (intro exI conjI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 609 | show "0 < inverse (x+1)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 610 | by (simp add: order_less_trans [OF _ less_add_one]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 611 | show "inverse(x+1) < inverse x" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 612 | by (simp add: less_imp_inverse_less less_add_one) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 613 | show "inverse (inverse x) \<notin> A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 614 | by (simp add: order_less_imp_not_eq2) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 615 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 616 | qed | 
| 14335 | 617 | |
| 618 | text{*Part 1 of Dedekind sections definition*}
 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 619 | lemma inverse_set_not_empty: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 620 |      "A \<in> preal ==> {} \<subset> inverse_set A"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 621 | apply (insert mem_inv_set_ex [of A]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 622 | apply (auto simp add: inverse_set_def) | 
| 14335 | 623 | done | 
| 624 | ||
| 625 | text{*Part 2 of Dedekind sections definition*}
 | |
| 626 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 627 | lemma preal_not_mem_inverse_set_Ex: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 628 | assumes A: "A \<in> preal" shows "\<exists>q. 0 < q & q \<notin> inverse_set A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 629 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 630 | from preal_nonempty [OF A] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 631 | obtain x where x: "x \<in> A" and xpos [simp]: "0<x" .. | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 632 | show ?thesis | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 633 | proof (intro exI conjI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 634 | show "0 < inverse x" by simp | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 635 | show "inverse x \<notin> inverse_set A" | 
| 14377 | 636 | proof - | 
| 637 |       { fix y::rat 
 | |
| 638 | assume ygt: "inverse x < y" | |
| 639 | have [simp]: "0 < y" by (simp add: order_less_trans [OF _ ygt]) | |
| 640 | have iyless: "inverse y < x" | |
| 641 | by (simp add: inverse_less_imp_less [of x] ygt) | |
| 642 | have "inverse y \<in> A" | |
| 643 | by (simp add: preal_downwards_closed [OF A x] iyless)} | |
| 644 | thus ?thesis by (auto simp add: inverse_set_def) | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 645 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 646 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 647 | qed | 
| 14335 | 648 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 649 | lemma inverse_set_not_rat_set: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 650 |    assumes A: "A \<in> preal"  shows "inverse_set A < {r. 0 < r}"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 651 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 652 |   show "inverse_set A \<subseteq> {r. 0 < r}"  by (force simp add: inverse_set_def)
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 653 | next | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 654 |   show "inverse_set A \<noteq> {r. 0 < r}"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 655 | by (insert preal_not_mem_inverse_set_Ex [OF A], blast) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 656 | qed | 
| 14335 | 657 | |
| 658 | text{*Part 3 of Dedekind sections definition*}
 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 659 | lemma inverse_set_lemma3: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 660 | "[|A \<in> preal; u \<in> inverse_set A; 0 < z; z < u|] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 661 | ==> z \<in> inverse_set A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 662 | apply (auto simp add: inverse_set_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 663 | apply (auto intro: order_less_trans) | 
| 14335 | 664 | done | 
| 665 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 666 | text{*Part 4 of Dedekind sections definition*}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 667 | lemma inverse_set_lemma4: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 668 | "[|A \<in> preal; y \<in> inverse_set A|] ==> \<exists>u \<in> inverse_set A. y < u" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 669 | apply (auto simp add: inverse_set_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 670 | apply (drule dense [of y]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 671 | apply (blast intro: order_less_trans) | 
| 14335 | 672 | done | 
| 673 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 674 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 675 | lemma mem_inverse_set: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 676 | "A \<in> preal ==> inverse_set A \<in> preal" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 677 | apply (simp (no_asm_simp) add: preal_def cut_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 678 | apply (blast intro!: inverse_set_not_empty inverse_set_not_rat_set | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 679 | inverse_set_lemma3 inverse_set_lemma4) | 
| 14335 | 680 | done | 
| 681 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 682 | |
| 14335 | 683 | subsection{*Gleason's Lemma 9-3.4, page 122*}
 | 
| 684 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 685 | lemma Gleason9_34_exists: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 686 | assumes A: "A \<in> preal" | 
| 19765 | 687 | and "\<forall>x\<in>A. x + u \<in> A" | 
| 688 | and "0 \<le> z" | |
| 689 | shows "\<exists>b\<in>A. b + (of_int z) * u \<in> A" | |
| 14369 | 690 | proof (cases z rule: int_cases) | 
| 691 | case (nonneg n) | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 692 | show ?thesis | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 693 | proof (simp add: prems, induct n) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 694 | case 0 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 695 | from preal_nonempty [OF A] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 696 | show ?case by force | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 697 | case (Suc k) | 
| 15013 | 698 | from this obtain b where "b \<in> A" "b + of_nat k * u \<in> A" .. | 
| 14378 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14377diff
changeset | 699 | hence "b + of_int (int k)*u + u \<in> A" by (simp add: prems) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 700 | thus ?case by (force simp add: left_distrib add_ac prems) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 701 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 702 | next | 
| 14369 | 703 | case (neg n) | 
| 704 | with prems show ?thesis by simp | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 705 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 706 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 707 | lemma Gleason9_34_contra: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 708 | assumes A: "A \<in> preal" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 709 | shows "[|\<forall>x\<in>A. x + u \<in> A; 0 < u; 0 < y; y \<notin> A|] ==> False" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 710 | proof (induct u, induct y) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 711 | fix a::int and b::int | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 712 | fix c::int and d::int | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 713 | assume bpos [simp]: "0 < b" | 
| 19765 | 714 | and dpos [simp]: "0 < d" | 
| 715 | and closed: "\<forall>x\<in>A. x + (Fract c d) \<in> A" | |
| 716 | and upos: "0 < Fract c d" | |
| 717 | and ypos: "0 < Fract a b" | |
| 718 | and notin: "Fract a b \<notin> A" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 719 | have cpos [simp]: "0 < c" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 720 | by (simp add: zero_less_Fract_iff [OF dpos, symmetric] upos) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 721 | have apos [simp]: "0 < a" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 722 | by (simp add: zero_less_Fract_iff [OF bpos, symmetric] ypos) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 723 | let ?k = "a*d" | 
| 14378 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14377diff
changeset | 724 | have frle: "Fract a b \<le> Fract ?k 1 * (Fract c d)" | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 725 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 726 | have "?thesis = ((a * d * b * d) \<le> c * b * (a * d * b * d))" | 
| 14378 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14377diff
changeset | 727 | by (simp add: mult_rat le_rat order_less_imp_not_eq2 mult_ac) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 728 | moreover | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 729 | have "(1 * (a * d * b * d)) \<le> c * b * (a * d * b * d)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 730 | by (rule mult_mono, | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 731 | simp_all add: int_one_le_iff_zero_less zero_less_mult_iff | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 732 | order_less_imp_le) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 733 | ultimately | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 734 | show ?thesis by simp | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 735 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 736 | have k: "0 \<le> ?k" by (simp add: order_less_imp_le zero_less_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 737 | from Gleason9_34_exists [OF A closed k] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 738 | obtain z where z: "z \<in> A" | 
| 14378 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14377diff
changeset | 739 | and mem: "z + of_int ?k * Fract c d \<in> A" .. | 
| 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14377diff
changeset | 740 | have less: "z + of_int ?k * Fract c d < Fract a b" | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 741 | by (rule not_in_preal_ub [OF A notin mem ypos]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 742 | have "0<z" by (rule preal_imp_pos [OF A z]) | 
| 14378 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 paulson parents: 
14377diff
changeset | 743 | with frle and less show False by (simp add: Fract_of_int_eq) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 744 | qed | 
| 14335 | 745 | |
| 746 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 747 | lemma Gleason9_34: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 748 | assumes A: "A \<in> preal" | 
| 19765 | 749 | and upos: "0 < u" | 
| 750 | shows "\<exists>r \<in> A. r + u \<notin> A" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 751 | proof (rule ccontr, simp) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 752 | assume closed: "\<forall>r\<in>A. r + u \<in> A" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 753 | from preal_exists_bound [OF A] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 754 | obtain y where y: "y \<notin> A" and ypos: "0 < y" by blast | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 755 | show False | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 756 | by (rule Gleason9_34_contra [OF A closed upos ypos y]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 757 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 758 | |
| 14335 | 759 | |
| 760 | ||
| 761 | subsection{*Gleason's Lemma 9-3.6*}
 | |
| 762 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 763 | lemma lemma_gleason9_36: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 764 | assumes A: "A \<in> preal" | 
| 19765 | 765 | and x: "1 < x" | 
| 766 | shows "\<exists>r \<in> A. r*x \<notin> A" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 767 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 768 | from preal_nonempty [OF A] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 769 | obtain y where y: "y \<in> A" and ypos: "0<y" .. | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 770 | show ?thesis | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 771 | proof (rule classical) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 772 | assume "~(\<exists>r\<in>A. r * x \<notin> A)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 773 | with y have ymem: "y * x \<in> A" by blast | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 774 | from ypos mult_strict_left_mono [OF x] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 775 | have yless: "y < y*x" by simp | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 776 | let ?d = "y*x - y" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 777 | from yless have dpos: "0 < ?d" and eq: "y + ?d = y*x" by auto | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 778 | from Gleason9_34 [OF A dpos] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 779 | obtain r where r: "r\<in>A" and notin: "r + ?d \<notin> A" .. | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 780 | have rpos: "0<r" by (rule preal_imp_pos [OF A r]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 781 | with dpos have rdpos: "0 < r + ?d" by arith | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 782 | have "~ (r + ?d \<le> y + ?d)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 783 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 784 | assume le: "r + ?d \<le> y + ?d" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 785 | from ymem have yd: "y + ?d \<in> A" by (simp add: eq) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 786 | have "r + ?d \<in> A" by (rule preal_downwards_closed' [OF A yd rdpos le]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 787 | with notin show False by simp | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 788 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 789 | hence "y < r" by simp | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 790 | with ypos have dless: "?d < (r * ?d)/y" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 791 | by (simp add: pos_less_divide_eq mult_commute [of ?d] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 792 | mult_strict_right_mono dpos) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 793 | have "r + ?d < r*x" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 794 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 795 | have "r + ?d < r + (r * ?d)/y" by (simp add: dless) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 796 | also with ypos have "... = (r/y) * (y + ?d)" | 
| 14430 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 paulson parents: 
14387diff
changeset | 797 | by (simp only: right_distrib divide_inverse mult_ac, simp) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 798 | also have "... = r*x" using ypos | 
| 15234 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
 paulson parents: 
15140diff
changeset | 799 | by (simp add: times_divide_eq_left) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 800 | finally show "r + ?d < r*x" . | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 801 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 802 | with r notin rdpos | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 803 | show "\<exists>r\<in>A. r * x \<notin> A" by (blast dest: preal_downwards_closed [OF A]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 804 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 805 | qed | 
| 14335 | 806 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 807 | subsection{*Existence of Inverse: Part 2*}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 808 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 809 | lemma mem_Rep_preal_inverse_iff: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 810 | "(z \<in> Rep_preal(inverse R)) = | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 811 | (0 < z \<and> (\<exists>y. z < y \<and> inverse y \<notin> Rep_preal R))" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 812 | apply (simp add: preal_inverse_def mem_inverse_set Rep_preal) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 813 | apply (simp add: inverse_set_def) | 
| 14335 | 814 | done | 
| 815 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 816 | lemma Rep_preal_of_rat: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 817 |      "0 < q ==> Rep_preal (preal_of_rat q) = {x. 0 < x \<and> x < q}"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 818 | by (simp add: preal_of_rat_def rat_mem_preal) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 819 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 820 | lemma subset_inverse_mult_lemma: | 
| 19765 | 821 | assumes xpos: "0 < x" and xless: "x < 1" | 
| 822 | shows "\<exists>r u y. 0 < r & r < y & inverse y \<notin> Rep_preal R & | |
| 823 | u \<in> Rep_preal R & x = r * u" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 824 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 825 | from xpos and xless have "1 < inverse x" by (simp add: one_less_inverse_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 826 | from lemma_gleason9_36 [OF Rep_preal this] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 827 | obtain r where r: "r \<in> Rep_preal R" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 828 | and notin: "r * (inverse x) \<notin> Rep_preal R" .. | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 829 | have rpos: "0<r" by (rule preal_imp_pos [OF Rep_preal r]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 830 | from preal_exists_greater [OF Rep_preal r] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 831 | obtain u where u: "u \<in> Rep_preal R" and rless: "r < u" .. | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 832 | have upos: "0<u" by (rule preal_imp_pos [OF Rep_preal u]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 833 | show ?thesis | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 834 | proof (intro exI conjI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 835 | show "0 < x/u" using xpos upos | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 836 | by (simp add: zero_less_divide_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 837 | show "x/u < x/r" using xpos upos rpos | 
| 14430 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 paulson parents: 
14387diff
changeset | 838 | by (simp add: divide_inverse mult_less_cancel_left rless) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 839 | show "inverse (x / r) \<notin> Rep_preal R" using notin | 
| 14430 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 paulson parents: 
14387diff
changeset | 840 | by (simp add: divide_inverse mult_commute) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 841 | show "u \<in> Rep_preal R" by (rule u) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 842 | show "x = x / u * u" using upos | 
| 14430 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 paulson parents: 
14387diff
changeset | 843 | by (simp add: divide_inverse mult_commute) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 844 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 845 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 846 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 847 | lemma subset_inverse_mult: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 848 | "Rep_preal(preal_of_rat 1) \<subseteq> Rep_preal(inverse R * R)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 849 | apply (auto simp add: Bex_def Rep_preal_of_rat mem_Rep_preal_inverse_iff | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 850 | mem_Rep_preal_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 851 | apply (blast dest: subset_inverse_mult_lemma) | 
| 14335 | 852 | done | 
| 853 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 854 | lemma inverse_mult_subset_lemma: | 
| 19765 | 855 | assumes rpos: "0 < r" | 
| 856 | and rless: "r < y" | |
| 857 | and notin: "inverse y \<notin> Rep_preal R" | |
| 858 | and q: "q \<in> Rep_preal R" | |
| 859 | shows "r*q < 1" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 860 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 861 | have "q < inverse y" using rpos rless | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 862 | by (simp add: not_in_preal_ub [OF Rep_preal notin] q) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 863 | hence "r * q < r/y" using rpos | 
| 14430 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 paulson parents: 
14387diff
changeset | 864 | by (simp add: divide_inverse mult_less_cancel_left) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 865 | also have "... \<le> 1" using rpos rless | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 866 | by (simp add: pos_divide_le_eq) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 867 | finally show ?thesis . | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 868 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 869 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 870 | lemma inverse_mult_subset: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 871 | "Rep_preal(inverse R * R) \<subseteq> Rep_preal(preal_of_rat 1)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 872 | apply (auto simp add: Bex_def Rep_preal_of_rat mem_Rep_preal_inverse_iff | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 873 | mem_Rep_preal_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 874 | apply (simp add: zero_less_mult_iff preal_imp_pos [OF Rep_preal]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 875 | apply (blast intro: inverse_mult_subset_lemma) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 876 | done | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 877 | |
| 15413 | 878 | lemma preal_mult_inverse: "inverse R * R = (preal_of_rat 1)" | 
| 879 | apply (rule Rep_preal_inject [THEN iffD1]) | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 880 | apply (rule equalityI [OF inverse_mult_subset subset_inverse_mult]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 881 | done | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 882 | |
| 15413 | 883 | lemma preal_mult_inverse_right: "R * inverse R = (preal_of_rat 1)" | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 884 | apply (rule preal_mult_commute [THEN subst]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 885 | apply (rule preal_mult_inverse) | 
| 14335 | 886 | done | 
| 887 | ||
| 888 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 889 | text{*Theorems needing @{text Gleason9_34}*}
 | 
| 14335 | 890 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 891 | lemma Rep_preal_self_subset: "Rep_preal (R) \<subseteq> Rep_preal(R + S)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 892 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 893 | fix r | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 894 | assume r: "r \<in> Rep_preal R" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 895 | have rpos: "0<r" by (rule preal_imp_pos [OF Rep_preal r]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 896 | from mem_Rep_preal_Ex | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 897 | obtain y where y: "y \<in> Rep_preal S" .. | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 898 | have ypos: "0<y" by (rule preal_imp_pos [OF Rep_preal y]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 899 | have ry: "r+y \<in> Rep_preal(R + S)" using r y | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 900 | by (auto simp add: mem_Rep_preal_add_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 901 | show "r \<in> Rep_preal(R + S)" using r ypos rpos | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 902 | by (simp add: preal_downwards_closed [OF Rep_preal ry]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 903 | qed | 
| 14335 | 904 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 905 | lemma Rep_preal_sum_not_subset: "~ Rep_preal (R + S) \<subseteq> Rep_preal(R)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 906 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 907 | from mem_Rep_preal_Ex | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 908 | obtain y where y: "y \<in> Rep_preal S" .. | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 909 | have ypos: "0<y" by (rule preal_imp_pos [OF Rep_preal y]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 910 | from Gleason9_34 [OF Rep_preal ypos] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 911 | obtain r where r: "r \<in> Rep_preal R" and notin: "r + y \<notin> Rep_preal R" .. | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 912 | have "r + y \<in> Rep_preal (R + S)" using r y | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 913 | by (auto simp add: mem_Rep_preal_add_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 914 | thus ?thesis using notin by blast | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 915 | qed | 
| 14335 | 916 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 917 | lemma Rep_preal_sum_not_eq: "Rep_preal (R + S) \<noteq> Rep_preal(R)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 918 | by (insert Rep_preal_sum_not_subset, blast) | 
| 14335 | 919 | |
| 920 | text{*at last, Gleason prop. 9-3.5(iii) page 123*}
 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 921 | lemma preal_self_less_add_left: "(R::preal) < R + S" | 
| 14335 | 922 | apply (unfold preal_less_def psubset_def) | 
| 923 | apply (simp add: Rep_preal_self_subset Rep_preal_sum_not_eq [THEN not_sym]) | |
| 924 | done | |
| 925 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 926 | lemma preal_self_less_add_right: "(R::preal) < S + R" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 927 | by (simp add: preal_add_commute preal_self_less_add_left) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 928 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 929 | lemma preal_not_eq_self: "x \<noteq> x + (y::preal)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 930 | by (insert preal_self_less_add_left [of x y], auto) | 
| 14335 | 931 | |
| 932 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 933 | subsection{*Subtraction for Positive Reals*}
 | 
| 14335 | 934 | |
| 22710 | 935 | text{*Gleason prop. 9-3.5(iv), page 123: proving @{prop "A < B ==> \<exists>D. A + D =
 | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 936 | B"}. We define the claimed @{term D} and show that it is a positive real*}
 | 
| 14335 | 937 | |
| 938 | text{*Part 1 of Dedekind sections definition*}
 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 939 | lemma diff_set_not_empty: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 940 |      "R < S ==> {} \<subset> diff_set (Rep_preal S) (Rep_preal R)"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 941 | apply (auto simp add: preal_less_def diff_set_def elim!: equalityE) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 942 | apply (frule_tac x1 = S in Rep_preal [THEN preal_exists_greater]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 943 | apply (drule preal_imp_pos [OF Rep_preal], clarify) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 944 | apply (cut_tac a=x and b=u in add_eq_exists, force) | 
| 14335 | 945 | done | 
| 946 | ||
| 947 | text{*Part 2 of Dedekind sections definition*}
 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 948 | lemma diff_set_nonempty: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 949 | "\<exists>q. 0 < q & q \<notin> diff_set (Rep_preal S) (Rep_preal R)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 950 | apply (cut_tac X = S in Rep_preal_exists_bound) | 
| 14335 | 951 | apply (erule exE) | 
| 952 | apply (rule_tac x = x in exI, auto) | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 953 | apply (simp add: diff_set_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 954 | apply (auto dest: Rep_preal [THEN preal_downwards_closed]) | 
| 14335 | 955 | done | 
| 956 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 957 | lemma diff_set_not_rat_set: | 
| 19765 | 958 |   "diff_set (Rep_preal S) (Rep_preal R) < {r. 0 < r}" (is "?lhs < ?rhs")
 | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 959 | proof | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 960 | show "?lhs \<subseteq> ?rhs" by (auto simp add: diff_set_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 961 | show "?lhs \<noteq> ?rhs" using diff_set_nonempty by blast | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 962 | qed | 
| 14335 | 963 | |
| 964 | text{*Part 3 of Dedekind sections definition*}
 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 965 | lemma diff_set_lemma3: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 966 | "[|R < S; u \<in> diff_set (Rep_preal S) (Rep_preal R); 0 < z; z < u|] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 967 | ==> z \<in> diff_set (Rep_preal S) (Rep_preal R)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 968 | apply (auto simp add: diff_set_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 969 | apply (rule_tac x=x in exI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 970 | apply (drule Rep_preal [THEN preal_downwards_closed], auto) | 
| 14335 | 971 | done | 
| 972 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 973 | text{*Part 4 of Dedekind sections definition*}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 974 | lemma diff_set_lemma4: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 975 | "[|R < S; y \<in> diff_set (Rep_preal S) (Rep_preal R)|] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 976 | ==> \<exists>u \<in> diff_set (Rep_preal S) (Rep_preal R). y < u" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 977 | apply (auto simp add: diff_set_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 978 | apply (drule Rep_preal [THEN preal_exists_greater], clarify) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 979 | apply (cut_tac a="x+y" and b=u in add_eq_exists, clarify) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 980 | apply (rule_tac x="y+xa" in exI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 981 | apply (auto simp add: add_ac) | 
| 14335 | 982 | done | 
| 983 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 984 | lemma mem_diff_set: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 985 | "R < S ==> diff_set (Rep_preal S) (Rep_preal R) \<in> preal" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 986 | apply (unfold preal_def cut_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 987 | apply (blast intro!: diff_set_not_empty diff_set_not_rat_set | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 988 | diff_set_lemma3 diff_set_lemma4) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 989 | done | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 990 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 991 | lemma mem_Rep_preal_diff_iff: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 992 | "R < S ==> | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 993 | (z \<in> Rep_preal(S-R)) = | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 994 | (\<exists>x. 0 < x & 0 < z & x \<notin> Rep_preal R & x + z \<in> Rep_preal S)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 995 | apply (simp add: preal_diff_def mem_diff_set Rep_preal) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 996 | apply (force simp add: diff_set_def) | 
| 14335 | 997 | done | 
| 998 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 999 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1000 | text{*proving that @{term "R + D \<le> S"}*}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1001 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1002 | lemma less_add_left_lemma: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1003 | assumes Rless: "R < S" | 
| 19765 | 1004 | and a: "a \<in> Rep_preal R" | 
| 1005 | and cb: "c + b \<in> Rep_preal S" | |
| 1006 | and "c \<notin> Rep_preal R" | |
| 1007 | and "0 < b" | |
| 1008 | and "0 < c" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1009 | shows "a + b \<in> Rep_preal S" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1010 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1011 | have "0<a" by (rule preal_imp_pos [OF Rep_preal a]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1012 | moreover | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1013 | have "a < c" using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1014 | by (blast intro: not_in_Rep_preal_ub ) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1015 | ultimately show ?thesis using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1016 | by (simp add: preal_downwards_closed [OF Rep_preal cb]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1017 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1018 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1019 | lemma less_add_left_le1: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1020 | "R < (S::preal) ==> R + (S-R) \<le> S" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1021 | apply (auto simp add: Bex_def preal_le_def mem_Rep_preal_add_iff | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1022 | mem_Rep_preal_diff_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1023 | apply (blast intro: less_add_left_lemma) | 
| 14335 | 1024 | done | 
| 1025 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1026 | subsection{*proving that @{term "S \<le> R + D"} --- trickier*}
 | 
| 14335 | 1027 | |
| 1028 | lemma lemma_sum_mem_Rep_preal_ex: | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1029 | "x \<in> Rep_preal S ==> \<exists>e. 0 < e & x + e \<in> Rep_preal S" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1030 | apply (drule Rep_preal [THEN preal_exists_greater], clarify) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1031 | apply (cut_tac a=x and b=u in add_eq_exists, auto) | 
| 14335 | 1032 | done | 
| 1033 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1034 | lemma less_add_left_lemma2: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1035 | assumes Rless: "R < S" | 
| 19765 | 1036 | and x: "x \<in> Rep_preal S" | 
| 1037 | and xnot: "x \<notin> Rep_preal R" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1038 | shows "\<exists>u v z. 0 < v & 0 < z & u \<in> Rep_preal R & z \<notin> Rep_preal R & | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1039 | z + v \<in> Rep_preal S & x = u + v" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1040 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1041 | have xpos: "0<x" by (rule preal_imp_pos [OF Rep_preal x]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1042 | from lemma_sum_mem_Rep_preal_ex [OF x] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1043 | obtain e where epos: "0 < e" and xe: "x + e \<in> Rep_preal S" by blast | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1044 | from Gleason9_34 [OF Rep_preal epos] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1045 | obtain r where r: "r \<in> Rep_preal R" and notin: "r + e \<notin> Rep_preal R" .. | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1046 | with x xnot xpos have rless: "r < x" by (blast intro: not_in_Rep_preal_ub) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1047 | from add_eq_exists [of r x] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1048 | obtain y where eq: "x = r+y" by auto | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1049 | show ?thesis | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1050 | proof (intro exI conjI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1051 | show "r \<in> Rep_preal R" by (rule r) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1052 | show "r + e \<notin> Rep_preal R" by (rule notin) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1053 | show "r + e + y \<in> Rep_preal S" using xe eq by (simp add: add_ac) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1054 | show "x = r + y" by (simp add: eq) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1055 | show "0 < r + e" using epos preal_imp_pos [OF Rep_preal r] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1056 | by simp | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1057 | show "0 < y" using rless eq by arith | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1058 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1059 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1060 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1061 | lemma less_add_left_le2: "R < (S::preal) ==> S \<le> R + (S-R)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1062 | apply (auto simp add: preal_le_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1063 | apply (case_tac "x \<in> Rep_preal R") | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1064 | apply (cut_tac Rep_preal_self_subset [of R], force) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1065 | apply (auto simp add: Bex_def mem_Rep_preal_add_iff mem_Rep_preal_diff_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1066 | apply (blast dest: less_add_left_lemma2) | 
| 14335 | 1067 | done | 
| 1068 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1069 | lemma less_add_left: "R < (S::preal) ==> R + (S-R) = S" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1070 | by (blast intro: preal_le_anti_sym [OF less_add_left_le1 less_add_left_le2]) | 
| 14335 | 1071 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1072 | lemma less_add_left_Ex: "R < (S::preal) ==> \<exists>D. R + D = S" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1073 | by (fast dest: less_add_left) | 
| 14335 | 1074 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1075 | lemma preal_add_less2_mono1: "R < (S::preal) ==> R + T < S + T" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1076 | apply (auto dest!: less_add_left_Ex simp add: preal_add_assoc) | 
| 14335 | 1077 | apply (rule_tac y1 = D in preal_add_commute [THEN subst]) | 
| 1078 | apply (auto intro: preal_self_less_add_left simp add: preal_add_assoc [symmetric]) | |
| 1079 | done | |
| 1080 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1081 | lemma preal_add_less2_mono2: "R < (S::preal) ==> T + R < T + S" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1082 | by (auto intro: preal_add_less2_mono1 simp add: preal_add_commute [of T]) | 
| 14335 | 1083 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1084 | lemma preal_add_right_less_cancel: "R + T < S + T ==> R < (S::preal)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1085 | apply (insert linorder_less_linear [of R S], auto) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1086 | apply (drule_tac R = S and T = T in preal_add_less2_mono1) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1087 | apply (blast dest: order_less_trans) | 
| 14335 | 1088 | done | 
| 1089 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1090 | lemma preal_add_left_less_cancel: "T + R < T + S ==> R < (S::preal)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1091 | by (auto elim: preal_add_right_less_cancel simp add: preal_add_commute [of T]) | 
| 14335 | 1092 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1093 | lemma preal_add_less_cancel_right: "((R::preal) + T < S + T) = (R < S)" | 
| 14335 | 1094 | by (blast intro: preal_add_less2_mono1 preal_add_right_less_cancel) | 
| 1095 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1096 | lemma preal_add_less_cancel_left: "(T + (R::preal) < T + S) = (R < S)" | 
| 14335 | 1097 | by (blast intro: preal_add_less2_mono2 preal_add_left_less_cancel) | 
| 1098 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1099 | lemma preal_add_le_cancel_right: "((R::preal) + T \<le> S + T) = (R \<le> S)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1100 | by (simp add: linorder_not_less [symmetric] preal_add_less_cancel_right) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1101 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1102 | lemma preal_add_le_cancel_left: "(T + (R::preal) \<le> T + S) = (R \<le> S)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1103 | by (simp add: linorder_not_less [symmetric] preal_add_less_cancel_left) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1104 | |
| 14335 | 1105 | lemma preal_add_less_mono: | 
| 1106 | "[| x1 < y1; x2 < y2 |] ==> x1 + x2 < y1 + (y2::preal)" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1107 | apply (auto dest!: less_add_left_Ex simp add: preal_add_ac) | 
| 14335 | 1108 | apply (rule preal_add_assoc [THEN subst]) | 
| 1109 | apply (rule preal_self_less_add_right) | |
| 1110 | done | |
| 1111 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1112 | lemma preal_add_right_cancel: "(R::preal) + T = S + T ==> R = S" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1113 | apply (insert linorder_less_linear [of R S], safe) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1114 | apply (drule_tac [!] T = T in preal_add_less2_mono1, auto) | 
| 14335 | 1115 | done | 
| 1116 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1117 | lemma preal_add_left_cancel: "C + A = C + B ==> A = (B::preal)" | 
| 14335 | 1118 | by (auto intro: preal_add_right_cancel simp add: preal_add_commute) | 
| 1119 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1120 | lemma preal_add_left_cancel_iff: "(C + A = C + B) = ((A::preal) = B)" | 
| 14335 | 1121 | by (fast intro: preal_add_left_cancel) | 
| 1122 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1123 | lemma preal_add_right_cancel_iff: "(A + C = B + C) = ((A::preal) = B)" | 
| 14335 | 1124 | by (fast intro: preal_add_right_cancel) | 
| 1125 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1126 | lemmas preal_cancels = | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1127 | preal_add_less_cancel_right preal_add_less_cancel_left | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1128 | preal_add_le_cancel_right preal_add_le_cancel_left | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1129 | preal_add_left_cancel_iff preal_add_right_cancel_iff | 
| 14335 | 1130 | |
| 1131 | ||
| 1132 | subsection{*Completeness of type @{typ preal}*}
 | |
| 1133 | ||
| 1134 | text{*Prove that supremum is a cut*}
 | |
| 1135 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1136 | text{*Part 1 of Dedekind sections definition*}
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1137 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1138 | lemma preal_sup_set_not_empty: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1139 |      "P \<noteq> {} ==> {} \<subset> (\<Union>X \<in> P. Rep_preal(X))"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1140 | apply auto | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1141 | apply (cut_tac X = x in mem_Rep_preal_Ex, auto) | 
| 14335 | 1142 | done | 
| 1143 | ||
| 1144 | ||
| 1145 | text{*Part 2 of Dedekind sections definition*}
 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1146 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1147 | lemma preal_sup_not_exists: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1148 | "\<forall>X \<in> P. X \<le> Y ==> \<exists>q. 0 < q & q \<notin> (\<Union>X \<in> P. Rep_preal(X))" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1149 | apply (cut_tac X = Y in Rep_preal_exists_bound) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1150 | apply (auto simp add: preal_le_def) | 
| 14335 | 1151 | done | 
| 1152 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1153 | lemma preal_sup_set_not_rat_set: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1154 |      "\<forall>X \<in> P. X \<le> Y ==> (\<Union>X \<in> P. Rep_preal(X)) < {r. 0 < r}"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1155 | apply (drule preal_sup_not_exists) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1156 | apply (blast intro: preal_imp_pos [OF Rep_preal]) | 
| 14335 | 1157 | done | 
| 1158 | ||
| 1159 | text{*Part 3 of Dedekind sections definition*}
 | |
| 1160 | lemma preal_sup_set_lemma3: | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1161 |      "[|P \<noteq> {}; \<forall>X \<in> P. X \<le> Y; u \<in> (\<Union>X \<in> P. Rep_preal(X)); 0 < z; z < u|]
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1162 | ==> z \<in> (\<Union>X \<in> P. Rep_preal(X))" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1163 | by (auto elim: Rep_preal [THEN preal_downwards_closed]) | 
| 14335 | 1164 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1165 | text{*Part 4 of Dedekind sections definition*}
 | 
| 14335 | 1166 | lemma preal_sup_set_lemma4: | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1167 |      "[|P \<noteq> {}; \<forall>X \<in> P. X \<le> Y; y \<in> (\<Union>X \<in> P. Rep_preal(X)) |]
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1168 | ==> \<exists>u \<in> (\<Union>X \<in> P. Rep_preal(X)). y < u" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1169 | by (blast dest: Rep_preal [THEN preal_exists_greater]) | 
| 14335 | 1170 | |
| 1171 | lemma preal_sup: | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1172 |      "[|P \<noteq> {}; \<forall>X \<in> P. X \<le> Y|] ==> (\<Union>X \<in> P. Rep_preal(X)) \<in> preal"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1173 | apply (unfold preal_def cut_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1174 | apply (blast intro!: preal_sup_set_not_empty preal_sup_set_not_rat_set | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1175 | preal_sup_set_lemma3 preal_sup_set_lemma4) | 
| 14335 | 1176 | done | 
| 1177 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1178 | lemma preal_psup_le: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1179 | "[| \<forall>X \<in> P. X \<le> Y; x \<in> P |] ==> x \<le> psup P" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1180 | apply (simp (no_asm_simp) add: preal_le_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1181 | apply (subgoal_tac "P \<noteq> {}") 
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1182 | apply (auto simp add: psup_def preal_sup) | 
| 14335 | 1183 | done | 
| 1184 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1185 | lemma psup_le_ub: "[| P \<noteq> {}; \<forall>X \<in> P. X \<le> Y |] ==> psup P \<le> Y"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1186 | apply (simp (no_asm_simp) add: preal_le_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1187 | apply (simp add: psup_def preal_sup) | 
| 14335 | 1188 | apply (auto simp add: preal_le_def) | 
| 1189 | done | |
| 1190 | ||
| 1191 | text{*Supremum property*}
 | |
| 1192 | lemma preal_complete: | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1193 |      "[| P \<noteq> {}; \<forall>X \<in> P. X \<le> Y |] ==> (\<exists>X \<in> P. Z < X) = (Z < psup P)"
 | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1194 | apply (simp add: preal_less_def psup_def preal_sup) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1195 | apply (auto simp add: preal_le_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1196 | apply (rename_tac U) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1197 | apply (cut_tac x = U and y = Z in linorder_less_linear) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1198 | apply (auto simp add: preal_less_def) | 
| 14335 | 1199 | done | 
| 1200 | ||
| 1201 | ||
| 20495 | 1202 | subsection{*The Embedding from @{typ rat} into @{typ preal}*}
 | 
| 14335 | 1203 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1204 | lemma preal_of_rat_add_lemma1: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1205 | "[|x < y + z; 0 < x; 0 < y|] ==> x * y * inverse (y + z) < (y::rat)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1206 | apply (frule_tac c = "y * inverse (y + z) " in mult_strict_right_mono) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1207 | apply (simp add: zero_less_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1208 | apply (simp add: mult_ac) | 
| 14335 | 1209 | done | 
| 1210 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1211 | lemma preal_of_rat_add_lemma2: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1212 | assumes "u < x + y" | 
| 19765 | 1213 | and "0 < x" | 
| 1214 | and "0 < y" | |
| 1215 | and "0 < u" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1216 | shows "\<exists>v w::rat. w < y & 0 < v & v < x & 0 < w & u = v + w" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1217 | proof (intro exI conjI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1218 | show "u * x * inverse(x+y) < x" using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1219 | by (simp add: preal_of_rat_add_lemma1) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1220 | show "u * y * inverse(x+y) < y" using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1221 | by (simp add: preal_of_rat_add_lemma1 add_commute [of x]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1222 | show "0 < u * x * inverse (x + y)" using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1223 | by (simp add: zero_less_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1224 | show "0 < u * y * inverse (x + y)" using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1225 | by (simp add: zero_less_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1226 | show "u = u * x * inverse (x + y) + u * y * inverse (x + y)" using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1227 | by (simp add: left_distrib [symmetric] right_distrib [symmetric] mult_ac) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1228 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1229 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1230 | lemma preal_of_rat_add: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1231 | "[| 0 < x; 0 < y|] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1232 | ==> preal_of_rat ((x::rat) + y) = preal_of_rat x + preal_of_rat y" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1233 | apply (unfold preal_of_rat_def preal_add_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1234 | apply (simp add: rat_mem_preal) | 
| 14335 | 1235 | apply (rule_tac f = Abs_preal in arg_cong) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1236 | apply (auto simp add: add_set_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1237 | apply (blast dest: preal_of_rat_add_lemma2) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1238 | done | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1239 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1240 | lemma preal_of_rat_mult_lemma1: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1241 | "[|x < y; 0 < x; 0 < z|] ==> x * z * inverse y < (z::rat)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1242 | apply (frule_tac c = "z * inverse y" in mult_strict_right_mono) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1243 | apply (simp add: zero_less_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1244 | apply (subgoal_tac "y * (z * inverse y) = z * (y * inverse y)") | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1245 | apply (simp_all add: mult_ac) | 
| 14335 | 1246 | done | 
| 1247 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1248 | lemma preal_of_rat_mult_lemma2: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1249 | assumes xless: "x < y * z" | 
| 19765 | 1250 | and xpos: "0 < x" | 
| 1251 | and ypos: "0 < y" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1252 | shows "x * z * inverse y * inverse z < (z::rat)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1253 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1254 | have "0 < y * z" using prems by simp | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1255 | hence zpos: "0 < z" using prems by (simp add: zero_less_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1256 | have "x * z * inverse y * inverse z = x * inverse y * (z * inverse z)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1257 | by (simp add: mult_ac) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1258 | also have "... = x/y" using zpos | 
| 14430 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 paulson parents: 
14387diff
changeset | 1259 | by (simp add: divide_inverse) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1260 | also have "... < z" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1261 | by (simp add: pos_divide_less_eq [OF ypos] mult_commute) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1262 | finally show ?thesis . | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1263 | qed | 
| 14335 | 1264 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1265 | lemma preal_of_rat_mult_lemma3: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1266 | assumes uless: "u < x * y" | 
| 19765 | 1267 | and "0 < x" | 
| 1268 | and "0 < y" | |
| 1269 | and "0 < u" | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1270 | shows "\<exists>v w::rat. v < x & w < y & 0 < v & 0 < w & u = v * w" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1271 | proof - | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1272 | from dense [OF uless] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1273 | obtain r where "u < r" "r < x * y" by blast | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1274 | thus ?thesis | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1275 | proof (intro exI conjI) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1276 | show "u * x * inverse r < x" using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1277 | by (simp add: preal_of_rat_mult_lemma1) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1278 | show "r * y * inverse x * inverse y < y" using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1279 | by (simp add: preal_of_rat_mult_lemma2) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1280 | show "0 < u * x * inverse r" using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1281 | by (simp add: zero_less_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1282 | show "0 < r * y * inverse x * inverse y" using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1283 | by (simp add: zero_less_mult_iff) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1284 | have "u * x * inverse r * (r * y * inverse x * inverse y) = | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1285 | u * (r * inverse r) * (x * inverse x) * (y * inverse y)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1286 | by (simp only: mult_ac) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1287 | thus "u = u * x * inverse r * (r * y * inverse x * inverse y)" using prems | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1288 | by simp | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1289 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1290 | qed | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1291 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1292 | lemma preal_of_rat_mult: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1293 | "[| 0 < x; 0 < y|] | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1294 | ==> preal_of_rat ((x::rat) * y) = preal_of_rat x * preal_of_rat y" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1295 | apply (unfold preal_of_rat_def preal_mult_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1296 | apply (simp add: rat_mem_preal) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1297 | apply (rule_tac f = Abs_preal in arg_cong) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1298 | apply (auto simp add: zero_less_mult_iff mult_strict_mono mult_set_def) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1299 | apply (blast dest: preal_of_rat_mult_lemma3) | 
| 14335 | 1300 | done | 
| 1301 | ||
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1302 | lemma preal_of_rat_less_iff: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1303 | "[| 0 < x; 0 < y|] ==> (preal_of_rat x < preal_of_rat y) = (x < y)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1304 | by (force simp add: preal_of_rat_def preal_less_def rat_mem_preal) | 
| 14335 | 1305 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1306 | lemma preal_of_rat_le_iff: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1307 | "[| 0 < x; 0 < y|] ==> (preal_of_rat x \<le> preal_of_rat y) = (x \<le> y)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1308 | by (simp add: preal_of_rat_less_iff linorder_not_less [symmetric]) | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1309 | |
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1310 | lemma preal_of_rat_eq_iff: | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1311 | "[| 0 < x; 0 < y|] ==> (preal_of_rat x = preal_of_rat y) = (x = y)" | 
| 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14335diff
changeset | 1312 | by (simp add: preal_of_rat_le_iff order_eq_iff) | 
| 14335 | 1313 | |
| 5078 | 1314 | end |