author | paulson <lp15@cam.ac.uk> |
Fri, 26 Apr 2019 19:00:02 +0100 | |
changeset 70197 | e383580ffc35 |
parent 69597 | ff784d5a5bfb |
child 70199 | b3630f5cc403 |
permissions | -rw-r--r-- |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1 |
(* Title: HOL/ex/Dedekind_Real.thy |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
2 |
Author: Jacques D. Fleuriot, University of Cambridge |
36794 | 3 |
Conversion to Isar and new proofs by Lawrence C Paulson, 2003/4 |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
4 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
5 |
The positive reals as Dedekind sections of positive |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
6 |
rationals. Fundamentals of Abstract Analysis [Gleason- p. 121] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
7 |
provides some of the definitions. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
8 |
*) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
9 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
10 |
theory Dedekind_Real |
53373 | 11 |
imports Complex_Main |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
12 |
begin |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
13 |
|
61343 | 14 |
section \<open>Positive real numbers\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
15 |
|
61933 | 16 |
text\<open>Could be generalized and moved to \<open>Groups\<close>\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
17 |
lemma add_eq_exists: "\<exists>x. a+x = (b::rat)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
18 |
by (rule_tac x="b-a" in exI, simp) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
19 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
20 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
21 |
cut :: "rat set => bool" where |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
22 |
"cut A = ({} \<subset> A \<and> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
23 |
A < {r. 0 < r} \<and> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
24 |
(\<forall>y \<in> A. ((\<forall>z. 0<z \<and> z < y \<longrightarrow> z \<in> A) \<and> (\<exists>u \<in> A. y < u))))" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
25 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
26 |
lemma interval_empty_iff: |
53215
5e47c31c6f7c
renamed typeclass dense_linorder to unbounded_dense_linorder
hoelzl
parents:
49962
diff
changeset
|
27 |
"{y. (x::'a::unbounded_dense_linorder) < y \<and> y < z} = {} \<longleftrightarrow> \<not> x < z" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
28 |
by (auto dest: dense) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
29 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
30 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
31 |
lemma cut_of_rat: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
32 |
assumes q: "0 < q" shows "cut {r::rat. 0 < r \<and> r < q}" (is "cut ?A") |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
33 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
34 |
from q have pos: "?A < {r. 0 < r}" by force |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
35 |
have nonempty: "{} \<subset> ?A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
36 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
37 |
show "{} \<subseteq> ?A" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
38 |
show "{} \<noteq> ?A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
39 |
by (force simp only: q eq_commute [of "{}"] interval_empty_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
40 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
41 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
42 |
by (simp add: cut_def pos nonempty, |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
43 |
blast dest: dense intro: order_less_trans) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
44 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
45 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
46 |
|
59814 | 47 |
typedef preal = "Collect cut" |
48 |
by (blast intro: cut_of_rat [OF zero_less_one]) |
|
45694
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
41541
diff
changeset
|
49 |
|
59814 | 50 |
lemma Abs_preal_induct [induct type: preal]: |
51 |
"(\<And>x. cut x \<Longrightarrow> P (Abs_preal x)) \<Longrightarrow> P x" |
|
52 |
using Abs_preal_induct [of P x] by simp |
|
53 |
||
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
54 |
lemma Rep_preal: "cut (Rep_preal x)" |
59814 | 55 |
using Rep_preal [of x] by simp |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
56 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
57 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
58 |
psup :: "preal set => preal" where |
37765 | 59 |
"psup P = Abs_preal (\<Union>X \<in> P. Rep_preal X)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
60 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
61 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
62 |
add_set :: "[rat set,rat set] => rat set" where |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
63 |
"add_set A B = {w. \<exists>x \<in> A. \<exists>y \<in> B. w = x + y}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
64 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
65 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
66 |
diff_set :: "[rat set,rat set] => rat set" where |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
67 |
"diff_set A B = {w. \<exists>x. 0 < w \<and> 0 < x \<and> x \<notin> B \<and> x + w \<in> A}" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
68 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
69 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
70 |
mult_set :: "[rat set,rat set] => rat set" where |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
71 |
"mult_set A B = {w. \<exists>x \<in> A. \<exists>y \<in> B. w = x * y}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
72 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
73 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
74 |
inverse_set :: "rat set => rat set" where |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
75 |
"inverse_set A \<equiv> {x. \<exists>y. 0 < x \<and> x < y \<and> inverse y \<notin> A}" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
76 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
77 |
instantiation preal :: "{ord, plus, minus, times, inverse, one}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
78 |
begin |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
79 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
80 |
definition |
37765 | 81 |
preal_less_def: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
82 |
"R < S \<equiv> Rep_preal R < Rep_preal S" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
83 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
84 |
definition |
37765 | 85 |
preal_le_def: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
86 |
"R \<le> S \<equiv> Rep_preal R \<subseteq> Rep_preal S" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
87 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
88 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
89 |
preal_add_def: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
90 |
"R + S \<equiv> Abs_preal (add_set (Rep_preal R) (Rep_preal S))" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
91 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
92 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
93 |
preal_diff_def: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
94 |
"R - S \<equiv> Abs_preal (diff_set (Rep_preal R) (Rep_preal S))" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
95 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
96 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
97 |
preal_mult_def: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
98 |
"R * S \<equiv> Abs_preal (mult_set (Rep_preal R) (Rep_preal S))" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
99 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
100 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
101 |
preal_inverse_def: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
102 |
"inverse R \<equiv> Abs_preal (inverse_set (Rep_preal R))" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
103 |
|
61076 | 104 |
definition "R div S = R * inverse (S::preal)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
105 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
106 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
107 |
preal_one_def: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
108 |
"1 \<equiv> Abs_preal {x. 0 < x \<and> x < 1}" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
109 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
110 |
instance .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
111 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
112 |
end |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
113 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
114 |
|
61343 | 115 |
text\<open>Reduces equality on abstractions to equality on representatives\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
116 |
declare Abs_preal_inject [simp] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
117 |
declare Abs_preal_inverse [simp] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
118 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
119 |
lemma rat_mem_preal: "0 < q \<Longrightarrow> cut {r::rat. 0 < r \<and> r < q}" |
59814 | 120 |
by (simp add: cut_of_rat) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
121 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
122 |
lemma preal_nonempty: "cut A \<Longrightarrow> \<exists>x\<in>A. 0 < x" |
59814 | 123 |
unfolding cut_def [abs_def] by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
124 |
|
59814 | 125 |
lemma preal_Ex_mem: "cut A \<Longrightarrow> \<exists>x. x \<in> A" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
126 |
using preal_nonempty by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
127 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
128 |
lemma preal_imp_psubset_positives: "cut A \<Longrightarrow> A < {r. 0 < r}" |
59814 | 129 |
by (force simp add: cut_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
130 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
131 |
lemma preal_exists_bound: "cut A \<Longrightarrow> \<exists>x. 0 < x \<and> x \<notin> A" |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
132 |
using Dedekind_Real.cut_def by fastforce |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
133 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
134 |
lemma preal_exists_greater: "\<lbrakk>cut A; y \<in> A\<rbrakk> \<Longrightarrow> \<exists>u \<in> A. y < u" |
59814 | 135 |
unfolding cut_def [abs_def] by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
136 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
137 |
lemma preal_downwards_closed: "\<lbrakk>cut A; y \<in> A; 0 < z; z < y\<rbrakk> \<Longrightarrow> z \<in> A" |
59814 | 138 |
unfolding cut_def [abs_def] by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
139 |
|
61343 | 140 |
text\<open>Relaxing the final premise\<close> |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
141 |
lemma preal_downwards_closed': "\<lbrakk>cut A; y \<in> A; 0 < z; z \<le> y\<rbrakk> \<Longrightarrow> z \<in> A" |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
142 |
using less_eq_rat_def preal_downwards_closed by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
143 |
|
61343 | 144 |
text\<open>A positive fraction not in a positive real is an upper bound. |
145 |
Gleason p. 122 - Remark (1)\<close> |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
146 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
147 |
lemma not_in_preal_ub: |
59814 | 148 |
assumes A: "cut A" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
149 |
and notx: "x \<notin> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
150 |
and y: "y \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
151 |
and pos: "0 < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
152 |
shows "y < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
153 |
proof (cases rule: linorder_cases) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
154 |
assume "x<y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
155 |
with notx show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
156 |
by (simp add: preal_downwards_closed [OF A y] pos) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
157 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
158 |
assume "x=y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
159 |
with notx and y show ?thesis by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
160 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
161 |
assume "y<x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
162 |
thus ?thesis . |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
163 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
164 |
|
69597 | 165 |
text \<open>preal lemmas instantiated to \<^term>\<open>Rep_preal X\<close>\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
166 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
167 |
lemma mem_Rep_preal_Ex: "\<exists>x. x \<in> Rep_preal X" |
59814 | 168 |
thm preal_Ex_mem |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
169 |
by (rule preal_Ex_mem [OF Rep_preal]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
170 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
171 |
lemma Rep_preal_exists_bound: "\<exists>x>0. x \<notin> Rep_preal X" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
172 |
by (rule preal_exists_bound [OF Rep_preal]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
173 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
174 |
lemmas not_in_Rep_preal_ub = not_in_preal_ub [OF Rep_preal] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
175 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
176 |
|
61343 | 177 |
subsection\<open>Properties of Ordering\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
178 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
179 |
instance preal :: order |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
180 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
181 |
fix w :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
182 |
show "w \<le> w" by (simp add: preal_le_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
183 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
184 |
fix i j k :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
185 |
assume "i \<le> j" and "j \<le> k" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
186 |
then show "i \<le> k" by (simp add: preal_le_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
187 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
188 |
fix z w :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
189 |
assume "z \<le> w" and "w \<le> z" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
190 |
then show "z = w" by (simp add: preal_le_def Rep_preal_inject) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
191 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
192 |
fix z w :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
193 |
show "z < w \<longleftrightarrow> z \<le> w \<and> \<not> w \<le> z" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
194 |
by (auto simp add: preal_le_def preal_less_def Rep_preal_inject) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
195 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
196 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
197 |
lemma preal_imp_pos: "\<lbrakk>cut A; r \<in> A\<rbrakk> \<Longrightarrow> 0 < r" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
198 |
by (insert preal_imp_psubset_positives, blast) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
199 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
200 |
instance preal :: linorder |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
201 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
202 |
fix x y :: preal |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
203 |
show "x \<le> y \<or> y \<le> x" |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
204 |
unfolding preal_le_def |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
205 |
by (meson Dedekind_Real.Rep_preal not_in_preal_ub preal_downwards_closed preal_imp_pos subsetI) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
206 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
207 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
208 |
instantiation preal :: distrib_lattice |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
209 |
begin |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
210 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
211 |
definition |
61076 | 212 |
"(inf :: preal \<Rightarrow> preal \<Rightarrow> preal) = min" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
213 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
214 |
definition |
61076 | 215 |
"(sup :: preal \<Rightarrow> preal \<Rightarrow> preal) = max" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
216 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
217 |
instance |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
218 |
by intro_classes |
54863
82acc20ded73
prefer more canonical names for lemmas on min/max
haftmann
parents:
54263
diff
changeset
|
219 |
(auto simp add: inf_preal_def sup_preal_def max_min_distrib2) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
220 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
221 |
end |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
222 |
|
61343 | 223 |
subsection\<open>Properties of Addition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
224 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
225 |
lemma preal_add_commute: "(x::preal) + y = y + x" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
226 |
unfolding preal_add_def add_set_def |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
227 |
by (metis (no_types, hide_lams) add.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
228 |
|
61343 | 229 |
text\<open>Lemmas for proving that addition of two positive reals gives |
230 |
a positive real\<close> |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
231 |
|
61343 | 232 |
text\<open>Part 1 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
233 |
lemma add_set_not_empty: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
234 |
"\<lbrakk>cut A; cut B\<rbrakk> \<Longrightarrow> {} \<subset> add_set A B" |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
235 |
by (force simp add: add_set_def dest: preal_nonempty) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
236 |
|
61343 | 237 |
text\<open>Part 2 of Dedekind sections definition. A structured version of |
61933 | 238 |
this proof is \<open>preal_not_mem_mult_set_Ex\<close> below.\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
239 |
lemma preal_not_mem_add_set_Ex: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
240 |
assumes "cut A" "cut B" |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
241 |
shows "\<exists>q>0. q \<notin> add_set A B" |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
242 |
proof - |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
243 |
obtain a b where "a > 0" "a \<notin> A" "b > 0" "b \<notin> B" "\<And>x. x \<in> A \<Longrightarrow> x < a" "\<And>y. y \<in> B \<Longrightarrow> y < b" |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
244 |
by (meson assms preal_exists_bound not_in_preal_ub) |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
245 |
with assms have "a+b \<notin> add_set A B" |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
246 |
by (fastforce simp add: add_set_def) |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
247 |
then show ?thesis |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
248 |
using \<open>0 < a\<close> \<open>0 < b\<close> add_pos_pos by blast |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
249 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
250 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
251 |
lemma add_set_not_rat_set: |
59814 | 252 |
assumes A: "cut A" |
253 |
and B: "cut B" |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
254 |
shows "add_set A B < {r. 0 < r}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
255 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
256 |
from preal_imp_pos [OF A] preal_imp_pos [OF B] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
257 |
show "add_set A B \<subseteq> {r. 0 < r}" by (force simp add: add_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
258 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
259 |
show "add_set A B \<noteq> {r. 0 < r}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
260 |
by (insert preal_not_mem_add_set_Ex [OF A B], blast) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
261 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
262 |
|
61343 | 263 |
text\<open>Part 3 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
264 |
lemma add_set_lemma3: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
265 |
"\<lbrakk>cut A; cut B; u \<in> add_set A B; 0 < z; z < u\<rbrakk> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
266 |
\<Longrightarrow> z \<in> add_set A B" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
267 |
proof (unfold add_set_def, clarify) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
268 |
fix x::rat and y::rat |
59814 | 269 |
assume A: "cut A" |
270 |
and B: "cut B" |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
271 |
and [simp]: "0 < z" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
272 |
and zless: "z < x + y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
273 |
and x: "x \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
274 |
and y: "y \<in> B" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
275 |
have xpos [simp]: "0<x" by (rule preal_imp_pos [OF A x]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
276 |
have ypos [simp]: "0<y" by (rule preal_imp_pos [OF B y]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
277 |
have xypos [simp]: "0 < x+y" by (simp add: pos_add_strict) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
278 |
let ?f = "z/(x+y)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
279 |
have fless: "?f < 1" by (simp add: zless pos_divide_less_eq) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
280 |
show "\<exists>x' \<in> A. \<exists>y'\<in>B. z = x' + y'" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
281 |
proof (intro bexI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
282 |
show "z = x*?f + y*?f" |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
283 |
by (simp add: distrib_right [symmetric] divide_inverse ac_simps |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
284 |
order_less_imp_not_eq2) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
285 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
286 |
show "y * ?f \<in> B" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
287 |
proof (rule preal_downwards_closed [OF B y]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
288 |
show "0 < y * ?f" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
289 |
by (simp add: divide_inverse zero_less_mult_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
290 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
291 |
show "y * ?f < y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
292 |
by (insert mult_strict_left_mono [OF fless ypos], simp) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
293 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
294 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
295 |
show "x * ?f \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
296 |
proof (rule preal_downwards_closed [OF A x]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
297 |
show "0 < x * ?f" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
298 |
by (simp add: divide_inverse zero_less_mult_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
299 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
300 |
show "x * ?f < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
301 |
by (insert mult_strict_left_mono [OF fless xpos], simp) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
302 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
303 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
304 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
305 |
|
61343 | 306 |
text\<open>Part 4 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
307 |
lemma add_set_lemma4: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
308 |
"\<lbrakk>cut A; cut B; y \<in> add_set A B\<rbrakk> \<Longrightarrow> \<exists>u \<in> add_set A B. y < u" |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
309 |
unfolding add_set_def |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
310 |
using preal_exists_greater by fastforce |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
311 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
312 |
lemma mem_add_set: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
313 |
"\<lbrakk>cut A; cut B\<rbrakk> \<Longrightarrow> cut (add_set A B)" |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
314 |
by (meson Dedekind_Real.cut_def add_set_lemma3 add_set_lemma4 add_set_not_empty add_set_not_rat_set) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
315 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
316 |
lemma preal_add_assoc: "((x::preal) + y) + z = x + (y + z)" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
317 |
apply (simp add: preal_add_def mem_add_set Rep_preal) |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
318 |
apply (force simp add: add_set_def ac_simps) |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
319 |
done |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
320 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
321 |
instance preal :: ab_semigroup_add |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
322 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
323 |
fix a b c :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
324 |
show "(a + b) + c = a + (b + c)" by (rule preal_add_assoc) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
325 |
show "a + b = b + a" by (rule preal_add_commute) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
326 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
327 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
328 |
|
61343 | 329 |
subsection\<open>Properties of Multiplication\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
330 |
|
61343 | 331 |
text\<open>Proofs essentially same as for addition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
332 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
333 |
lemma preal_mult_commute: "(x::preal) * y = y * x" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
334 |
unfolding preal_mult_def mult_set_def |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
335 |
by (metis (no_types, hide_lams) mult.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
336 |
|
61343 | 337 |
text\<open>Multiplication of two positive reals gives a positive real.\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
338 |
|
69597 | 339 |
text\<open>Lemmas for proving positive reals multiplication set in \<^typ>\<open>preal\<close>\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
340 |
|
61343 | 341 |
text\<open>Part 1 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
342 |
lemma mult_set_not_empty: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
343 |
"\<lbrakk>cut A; cut B\<rbrakk> \<Longrightarrow> {} \<subset> mult_set A B" |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
344 |
by (force simp add: mult_set_def dest: preal_nonempty) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
345 |
|
61343 | 346 |
text\<open>Part 2 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
347 |
lemma preal_not_mem_mult_set_Ex: |
59814 | 348 |
assumes A: "cut A" |
349 |
and B: "cut B" |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
350 |
shows "\<exists>q. 0 < q \<and> q \<notin> mult_set A B" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
351 |
proof - |
41541 | 352 |
from preal_exists_bound [OF A] obtain x where 1 [simp]: "0 < x" "x \<notin> A" by blast |
353 |
from preal_exists_bound [OF B] obtain y where 2 [simp]: "0 < y" "y \<notin> B" by blast |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
354 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
355 |
proof (intro exI conjI) |
56544 | 356 |
show "0 < x*y" by simp |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
357 |
show "x * y \<notin> mult_set A B" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
358 |
proof - |
41541 | 359 |
{ |
360 |
fix u::rat and v::rat |
|
361 |
assume u: "u \<in> A" and v: "v \<in> B" and xy: "x*y = u*v" |
|
362 |
moreover from A B 1 2 u v have "u<x" and "v<y" by (blast dest: not_in_preal_ub)+ |
|
363 |
moreover |
|
364 |
from A B 1 2 u v have "0\<le>v" |
|
365 |
by (blast intro: preal_imp_pos [OF B] order_less_imp_le) |
|
366 |
moreover |
|
61343 | 367 |
from A B 1 \<open>u < x\<close> \<open>v < y\<close> \<open>0 \<le> v\<close> |
41541 | 368 |
have "u*v < x*y" by (blast intro: mult_strict_mono) |
369 |
ultimately have False by force |
|
370 |
} |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
371 |
thus ?thesis by (auto simp add: mult_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
372 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
373 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
374 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
375 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
376 |
lemma mult_set_not_rat_set: |
59814 | 377 |
assumes A: "cut A" |
378 |
and B: "cut B" |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
379 |
shows "mult_set A B < {r. 0 < r}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
380 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
381 |
show "mult_set A B \<subseteq> {r. 0 < r}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
382 |
by (force simp add: mult_set_def |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
383 |
intro: preal_imp_pos [OF A] preal_imp_pos [OF B] mult_pos_pos) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
384 |
show "mult_set A B \<noteq> {r. 0 < r}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
385 |
using preal_not_mem_mult_set_Ex [OF A B] by blast |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
386 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
387 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
388 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
389 |
|
61343 | 390 |
text\<open>Part 3 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
391 |
lemma mult_set_lemma3: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
392 |
"\<lbrakk>cut A; cut B; u \<in> mult_set A B; 0 < z; z < u\<rbrakk> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
393 |
\<Longrightarrow> z \<in> mult_set A B" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
394 |
proof (unfold mult_set_def, clarify) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
395 |
fix x::rat and y::rat |
59814 | 396 |
assume A: "cut A" |
397 |
and B: "cut B" |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
398 |
and [simp]: "0 < z" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
399 |
and zless: "z < x * y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
400 |
and x: "x \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
401 |
and y: "y \<in> B" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
402 |
have [simp]: "0<y" by (rule preal_imp_pos [OF B y]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
403 |
show "\<exists>x' \<in> A. \<exists>y' \<in> B. z = x' * y'" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
404 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
405 |
show "\<exists>y'\<in>B. z = (z/y) * y'" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
406 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
407 |
show "z = (z/y)*y" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
408 |
by (simp add: divide_inverse mult.commute [of y] mult.assoc |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
409 |
order_less_imp_not_eq2) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
410 |
show "y \<in> B" by fact |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
411 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
412 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
413 |
show "z/y \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
414 |
proof (rule preal_downwards_closed [OF A x]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
415 |
show "0 < z/y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
416 |
by (simp add: zero_less_divide_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
417 |
show "z/y < x" by (simp add: pos_divide_less_eq zless) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
418 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
419 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
420 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
421 |
|
61343 | 422 |
text\<open>Part 4 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
423 |
lemma mult_set_lemma4: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
424 |
"\<lbrakk>cut A; cut B; y \<in> mult_set A B\<rbrakk> \<Longrightarrow> \<exists>u \<in> mult_set A B. y < u" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
425 |
apply (auto simp add: mult_set_def) |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
426 |
apply (frule preal_exists_greater [of A], auto) |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
427 |
using mult_strict_right_mono preal_imp_pos by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
428 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
429 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
430 |
lemma mem_mult_set: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
431 |
"\<lbrakk>cut A; cut B\<rbrakk> \<Longrightarrow> cut (mult_set A B)" |
59814 | 432 |
apply (simp (no_asm_simp) add: cut_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
433 |
apply (blast intro!: mult_set_not_empty mult_set_not_rat_set |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
434 |
mult_set_lemma3 mult_set_lemma4) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
435 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
436 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
437 |
lemma preal_mult_assoc: "((x::preal) * y) * z = x * (y * z)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
438 |
apply (simp add: preal_mult_def mem_mult_set Rep_preal) |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
439 |
apply (force simp add: mult_set_def ac_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
440 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
441 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
442 |
instance preal :: ab_semigroup_mult |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
443 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
444 |
fix a b c :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
445 |
show "(a * b) * c = a * (b * c)" by (rule preal_mult_assoc) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
446 |
show "a * b = b * a" by (rule preal_mult_commute) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
447 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
448 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
449 |
|
61343 | 450 |
text\<open>Positive real 1 is the multiplicative identity element\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
451 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
452 |
lemma preal_mult_1: "(1::preal) * z = z" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
453 |
proof (induct z) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
454 |
fix A :: "rat set" |
59814 | 455 |
assume A: "cut A" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
456 |
have "{w. \<exists>u. 0 < u \<and> u < 1 \<and> (\<exists>v \<in> A. w = u * v)} = A" (is "?lhs = A") |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
457 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
458 |
show "?lhs \<subseteq> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
459 |
proof clarify |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
460 |
fix x::rat and u::rat and v::rat |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
461 |
assume upos: "0<u" and "u<1" and v: "v \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
462 |
have vpos: "0<v" by (rule preal_imp_pos [OF A v]) |
61343 | 463 |
hence "u*v < 1*v" by (simp only: mult_strict_right_mono upos \<open>u < 1\<close> v) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
464 |
thus "u * v \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
465 |
by (force intro: preal_downwards_closed [OF A v] mult_pos_pos |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
466 |
upos vpos) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
467 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
468 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
469 |
show "A \<subseteq> ?lhs" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
470 |
proof clarify |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
471 |
fix x::rat |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
472 |
assume x: "x \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
473 |
have xpos: "0<x" by (rule preal_imp_pos [OF A x]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
474 |
from preal_exists_greater [OF A x] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
475 |
obtain v where v: "v \<in> A" and xlessv: "x < v" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
476 |
have vpos: "0<v" by (rule preal_imp_pos [OF A v]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
477 |
show "\<exists>u. 0 < u \<and> u < 1 \<and> (\<exists>v\<in>A. x = u * v)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
478 |
proof (intro exI conjI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
479 |
show "0 < x/v" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
480 |
by (simp add: zero_less_divide_iff xpos vpos) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
481 |
show "x / v < 1" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
482 |
by (simp add: pos_divide_less_eq vpos xlessv) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
483 |
show "\<exists>v'\<in>A. x = (x / v) * v'" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
484 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
485 |
show "x = (x/v)*v" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
486 |
by (simp add: divide_inverse mult.assoc vpos |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
487 |
order_less_imp_not_eq2) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
488 |
show "v \<in> A" by fact |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
489 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
490 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
491 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
492 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
493 |
thus "1 * Abs_preal A = Abs_preal A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
494 |
by (simp add: preal_one_def preal_mult_def mult_set_def |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
495 |
rat_mem_preal A) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
496 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
497 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
498 |
instance preal :: comm_monoid_mult |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
499 |
by intro_classes (rule preal_mult_1) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
500 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
501 |
|
61343 | 502 |
subsection\<open>Distribution of Multiplication across Addition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
503 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
504 |
lemma mem_Rep_preal_add_iff: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
505 |
"(z \<in> Rep_preal(R+S)) = (\<exists>x \<in> Rep_preal R. \<exists>y \<in> Rep_preal S. z = x + y)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
506 |
apply (simp add: preal_add_def mem_add_set Rep_preal) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
507 |
apply (simp add: add_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
508 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
509 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
510 |
lemma mem_Rep_preal_mult_iff: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
511 |
"(z \<in> Rep_preal(R*S)) = (\<exists>x \<in> Rep_preal R. \<exists>y \<in> Rep_preal S. z = x * y)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
512 |
apply (simp add: preal_mult_def mem_mult_set Rep_preal) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
513 |
apply (simp add: mult_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
514 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
515 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
516 |
lemma distrib_subset1: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
517 |
"Rep_preal (w * (x + y)) \<subseteq> Rep_preal (w * x + w * y)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
518 |
apply (auto simp add: Bex_def mem_Rep_preal_add_iff mem_Rep_preal_mult_iff) |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
49834
diff
changeset
|
519 |
apply (force simp add: distrib_left) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
520 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
521 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
522 |
lemma preal_add_mult_distrib_mean: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
523 |
assumes a: "a \<in> Rep_preal w" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
524 |
and b: "b \<in> Rep_preal w" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
525 |
and d: "d \<in> Rep_preal x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
526 |
and e: "e \<in> Rep_preal y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
527 |
shows "\<exists>c \<in> Rep_preal w. a * d + b * e = c * (d + e)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
528 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
529 |
let ?c = "(a*d + b*e)/(d+e)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
530 |
have [simp]: "0<a" "0<b" "0<d" "0<e" "0<d+e" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
531 |
by (blast intro: preal_imp_pos [OF Rep_preal] a b d e pos_add_strict)+ |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
532 |
have cpos: "0 < ?c" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
533 |
by (simp add: zero_less_divide_iff zero_less_mult_iff pos_add_strict) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
534 |
show "a * d + b * e = ?c * (d + e)" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
535 |
by (simp add: divide_inverse mult.assoc order_less_imp_not_eq2) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
536 |
show "?c \<in> Rep_preal w" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
537 |
proof (cases rule: linorder_le_cases) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
538 |
assume "a \<le> b" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
539 |
hence "?c \<le> b" |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
49834
diff
changeset
|
540 |
by (simp add: pos_divide_le_eq distrib_left mult_right_mono |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
541 |
order_less_imp_le) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
542 |
thus ?thesis by (rule preal_downwards_closed' [OF Rep_preal b cpos]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
543 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
544 |
assume "b \<le> a" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
545 |
hence "?c \<le> a" |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
49834
diff
changeset
|
546 |
by (simp add: pos_divide_le_eq distrib_left mult_right_mono |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
547 |
order_less_imp_le) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
548 |
thus ?thesis by (rule preal_downwards_closed' [OF Rep_preal a cpos]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
549 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
550 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
551 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
552 |
lemma distrib_subset2: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
553 |
"Rep_preal (w * x + w * y) \<subseteq> Rep_preal (w * (x + y))" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
554 |
apply (auto simp add: Bex_def mem_Rep_preal_add_iff mem_Rep_preal_mult_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
555 |
apply (drule_tac w=w and x=x and y=y in preal_add_mult_distrib_mean, auto) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
556 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
557 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
558 |
lemma preal_add_mult_distrib2: "(w * ((x::preal) + y)) = (w * x) + (w * y)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
559 |
apply (rule Rep_preal_inject [THEN iffD1]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
560 |
apply (rule equalityI [OF distrib_subset1 distrib_subset2]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
561 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
562 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
563 |
lemma preal_add_mult_distrib: "(((x::preal) + y) * w) = (x * w) + (y * w)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
564 |
by (simp add: preal_mult_commute preal_add_mult_distrib2) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
565 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
566 |
instance preal :: comm_semiring |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
567 |
by intro_classes (rule preal_add_mult_distrib) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
568 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
569 |
|
61343 | 570 |
subsection\<open>Existence of Inverse, a Positive Real\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
571 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
572 |
lemma mem_inv_set_ex: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
573 |
assumes A: "cut A" shows "\<exists>x y. 0 < x \<and> x < y \<and> inverse y \<notin> A" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
574 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
575 |
from preal_exists_bound [OF A] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
576 |
obtain x where [simp]: "0<x" "x \<notin> A" by blast |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
577 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
578 |
proof (intro exI conjI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
579 |
show "0 < inverse (x+1)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
580 |
by (simp add: order_less_trans [OF _ less_add_one]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
581 |
show "inverse(x+1) < inverse x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
582 |
by (simp add: less_imp_inverse_less less_add_one) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
583 |
show "inverse (inverse x) \<notin> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
584 |
by (simp add: order_less_imp_not_eq2) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
585 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
586 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
587 |
|
61343 | 588 |
text\<open>Part 1 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
589 |
lemma inverse_set_not_empty: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
590 |
"cut A \<Longrightarrow> {} \<subset> inverse_set A" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
591 |
apply (insert mem_inv_set_ex [of A]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
592 |
apply (auto simp add: inverse_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
593 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
594 |
|
61343 | 595 |
text\<open>Part 2 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
596 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
597 |
lemma preal_not_mem_inverse_set_Ex: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
598 |
assumes A: "cut A" shows "\<exists>q. 0 < q \<and> q \<notin> inverse_set A" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
599 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
600 |
from preal_nonempty [OF A] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
601 |
obtain x where x: "x \<in> A" and xpos [simp]: "0<x" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
602 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
603 |
proof (intro exI conjI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
604 |
show "0 < inverse x" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
605 |
show "inverse x \<notin> inverse_set A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
606 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
607 |
{ fix y::rat |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
608 |
assume ygt: "inverse x < y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
609 |
have [simp]: "0 < y" by (simp add: order_less_trans [OF _ ygt]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
610 |
have iyless: "inverse y < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
611 |
by (simp add: inverse_less_imp_less [of x] ygt) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
612 |
have "inverse y \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
613 |
by (simp add: preal_downwards_closed [OF A x] iyless)} |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
614 |
thus ?thesis by (auto simp add: inverse_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
615 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
616 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
617 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
618 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
619 |
lemma inverse_set_not_rat_set: |
59814 | 620 |
assumes A: "cut A" shows "inverse_set A < {r. 0 < r}" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
621 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
622 |
show "inverse_set A \<subseteq> {r. 0 < r}" by (force simp add: inverse_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
623 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
624 |
show "inverse_set A \<noteq> {r. 0 < r}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
625 |
by (insert preal_not_mem_inverse_set_Ex [OF A], blast) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
626 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
627 |
|
61343 | 628 |
text\<open>Part 3 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
629 |
lemma inverse_set_lemma3: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
630 |
"\<lbrakk>cut A; u \<in> inverse_set A; 0 < z; z < u\<rbrakk> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
631 |
\<Longrightarrow> z \<in> inverse_set A" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
632 |
apply (auto simp add: inverse_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
633 |
apply (auto intro: order_less_trans) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
634 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
635 |
|
61343 | 636 |
text\<open>Part 4 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
637 |
lemma inverse_set_lemma4: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
638 |
"\<lbrakk>cut A; y \<in> inverse_set A\<rbrakk> \<Longrightarrow> \<exists>u \<in> inverse_set A. y < u" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
639 |
apply (auto simp add: inverse_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
640 |
apply (drule dense [of y]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
641 |
apply (blast intro: order_less_trans) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
642 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
643 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
644 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
645 |
lemma mem_inverse_set: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
646 |
"cut A \<Longrightarrow> cut (inverse_set A)" |
59814 | 647 |
apply (simp (no_asm_simp) add: cut_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
648 |
apply (blast intro!: inverse_set_not_empty inverse_set_not_rat_set |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
649 |
inverse_set_lemma3 inverse_set_lemma4) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
650 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
651 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
652 |
|
61343 | 653 |
subsection\<open>Gleason's Lemma 9-3.4, page 122\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
654 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
655 |
lemma Gleason9_34_exists: |
59814 | 656 |
assumes A: "cut A" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
657 |
and "\<forall>x\<in>A. x + u \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
658 |
and "0 \<le> z" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
659 |
shows "\<exists>b\<in>A. b + (of_int z) * u \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
660 |
proof (cases z rule: int_cases) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
661 |
case (nonneg n) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
662 |
show ?thesis |
41541 | 663 |
proof (simp add: nonneg, induct n) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
664 |
case 0 |
41541 | 665 |
from preal_nonempty [OF A] |
666 |
show ?case by force |
|
667 |
next |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
668 |
case (Suc k) |
41541 | 669 |
then obtain b where b: "b \<in> A" "b + of_nat k * u \<in> A" .. |
670 |
hence "b + of_int (int k)*u + u \<in> A" by (simp add: assms) |
|
671 |
thus ?case by (force simp add: algebra_simps b) |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
672 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
673 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
674 |
case (neg n) |
41541 | 675 |
with assms show ?thesis by simp |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
676 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
677 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
678 |
lemma Gleason9_34_contra: |
59814 | 679 |
assumes A: "cut A" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
680 |
shows "\<lbrakk>\<forall>x\<in>A. x + u \<in> A; 0 < u; 0 < y; y \<notin> A\<rbrakk> \<Longrightarrow> False" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
681 |
proof (induct u, induct y) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
682 |
fix a::int and b::int |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
683 |
fix c::int and d::int |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
684 |
assume bpos [simp]: "0 < b" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
685 |
and dpos [simp]: "0 < d" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
686 |
and closed: "\<forall>x\<in>A. x + (Fract c d) \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
687 |
and upos: "0 < Fract c d" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
688 |
and ypos: "0 < Fract a b" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
689 |
and notin: "Fract a b \<notin> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
690 |
have cpos [simp]: "0 < c" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
691 |
by (simp add: zero_less_Fract_iff [OF dpos, symmetric] upos) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
692 |
have apos [simp]: "0 < a" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
693 |
by (simp add: zero_less_Fract_iff [OF bpos, symmetric] ypos) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
694 |
let ?k = "a*d" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
695 |
have frle: "Fract a b \<le> Fract ?k 1 * (Fract c d)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
696 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
697 |
have "?thesis = ((a * d * b * d) \<le> c * b * (a * d * b * d))" |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
698 |
by (simp add: order_less_imp_not_eq2 ac_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
699 |
moreover |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
700 |
have "(1 * (a * d * b * d)) \<le> c * b * (a * d * b * d)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
701 |
by (rule mult_mono, |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
702 |
simp_all add: int_one_le_iff_zero_less zero_less_mult_iff |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
703 |
order_less_imp_le) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
704 |
ultimately |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
705 |
show ?thesis by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
706 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
707 |
have k: "0 \<le> ?k" by (simp add: order_less_imp_le zero_less_mult_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
708 |
from Gleason9_34_exists [OF A closed k] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
709 |
obtain z where z: "z \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
710 |
and mem: "z + of_int ?k * Fract c d \<in> A" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
711 |
have less: "z + of_int ?k * Fract c d < Fract a b" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
712 |
by (rule not_in_preal_ub [OF A notin mem ypos]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
713 |
have "0<z" by (rule preal_imp_pos [OF A z]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
714 |
with frle and less show False by (simp add: Fract_of_int_eq) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
715 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
716 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
717 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
718 |
lemma Gleason9_34: |
59814 | 719 |
assumes A: "cut A" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
720 |
and upos: "0 < u" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
721 |
shows "\<exists>r \<in> A. r + u \<notin> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
722 |
proof (rule ccontr, simp) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
723 |
assume closed: "\<forall>r\<in>A. r + u \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
724 |
from preal_exists_bound [OF A] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
725 |
obtain y where y: "y \<notin> A" and ypos: "0 < y" by blast |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
726 |
show False |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
727 |
by (rule Gleason9_34_contra [OF A closed upos ypos y]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
728 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
729 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
730 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
731 |
|
61343 | 732 |
subsection\<open>Gleason's Lemma 9-3.6\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
733 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
734 |
lemma lemma_gleason9_36: |
59814 | 735 |
assumes A: "cut A" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
736 |
and x: "1 < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
737 |
shows "\<exists>r \<in> A. r*x \<notin> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
738 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
739 |
from preal_nonempty [OF A] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
740 |
obtain y where y: "y \<in> A" and ypos: "0<y" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
741 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
742 |
proof (rule classical) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
743 |
assume "~(\<exists>r\<in>A. r * x \<notin> A)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
744 |
with y have ymem: "y * x \<in> A" by blast |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
745 |
from ypos mult_strict_left_mono [OF x] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
746 |
have yless: "y < y*x" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
747 |
let ?d = "y*x - y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
748 |
from yless have dpos: "0 < ?d" and eq: "y + ?d = y*x" by auto |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
749 |
from Gleason9_34 [OF A dpos] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
750 |
obtain r where r: "r\<in>A" and notin: "r + ?d \<notin> A" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
751 |
have rpos: "0<r" by (rule preal_imp_pos [OF A r]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
752 |
with dpos have rdpos: "0 < r + ?d" by arith |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
753 |
have "~ (r + ?d \<le> y + ?d)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
754 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
755 |
assume le: "r + ?d \<le> y + ?d" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
756 |
from ymem have yd: "y + ?d \<in> A" by (simp add: eq) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
757 |
have "r + ?d \<in> A" by (rule preal_downwards_closed' [OF A yd rdpos le]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
758 |
with notin show False by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
759 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
760 |
hence "y < r" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
761 |
with ypos have dless: "?d < (r * ?d)/y" |
61762
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61343
diff
changeset
|
762 |
using dpos less_divide_eq_1 by fastforce |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
763 |
have "r + ?d < r*x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
764 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
765 |
have "r + ?d < r + (r * ?d)/y" by (simp add: dless) |
53373 | 766 |
also from ypos have "... = (r/y) * (y + ?d)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
767 |
by (simp only: algebra_simps divide_inverse, simp) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
768 |
also have "... = r*x" using ypos |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
769 |
by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
770 |
finally show "r + ?d < r*x" . |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
771 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
772 |
with r notin rdpos |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
773 |
show "\<exists>r\<in>A. r * x \<notin> A" by (blast dest: preal_downwards_closed [OF A]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
774 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
775 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
776 |
|
61343 | 777 |
subsection\<open>Existence of Inverse: Part 2\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
778 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
779 |
lemma mem_Rep_preal_inverse_iff: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
780 |
"(z \<in> Rep_preal(inverse R)) = |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
781 |
(0 < z \<and> (\<exists>y. z < y \<and> inverse y \<notin> Rep_preal R))" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
782 |
apply (simp add: preal_inverse_def mem_inverse_set Rep_preal) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
783 |
apply (simp add: inverse_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
784 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
785 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
786 |
lemma Rep_preal_one: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
787 |
"Rep_preal 1 = {x. 0 < x \<and> x < 1}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
788 |
by (simp add: preal_one_def rat_mem_preal) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
789 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
790 |
lemma subset_inverse_mult_lemma: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
791 |
assumes xpos: "0 < x" and xless: "x < 1" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
792 |
shows "\<exists>r u y. 0 < r \<and> r < y \<and> inverse y \<notin> Rep_preal R \<and> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
793 |
u \<in> Rep_preal R \<and> x = r * u" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
794 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
795 |
from xpos and xless have "1 < inverse x" by (simp add: one_less_inverse_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
796 |
from lemma_gleason9_36 [OF Rep_preal this] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
797 |
obtain r where r: "r \<in> Rep_preal R" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
798 |
and notin: "r * (inverse x) \<notin> Rep_preal R" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
799 |
have rpos: "0<r" by (rule preal_imp_pos [OF Rep_preal r]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
800 |
from preal_exists_greater [OF Rep_preal r] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
801 |
obtain u where u: "u \<in> Rep_preal R" and rless: "r < u" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
802 |
have upos: "0<u" by (rule preal_imp_pos [OF Rep_preal u]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
803 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
804 |
proof (intro exI conjI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
805 |
show "0 < x/u" using xpos upos |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
806 |
by (simp add: zero_less_divide_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
807 |
show "x/u < x/r" using xpos upos rpos |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
808 |
by (simp add: divide_inverse mult_less_cancel_left rless) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
809 |
show "inverse (x / r) \<notin> Rep_preal R" using notin |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
810 |
by (simp add: divide_inverse mult.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
811 |
show "u \<in> Rep_preal R" by (rule u) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
812 |
show "x = x / u * u" using upos |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
813 |
by (simp add: divide_inverse mult.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
814 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
815 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
816 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
817 |
lemma subset_inverse_mult: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
818 |
"Rep_preal 1 \<subseteq> Rep_preal(inverse R * R)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
819 |
apply (auto simp add: Bex_def Rep_preal_one mem_Rep_preal_inverse_iff |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
820 |
mem_Rep_preal_mult_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
821 |
apply (blast dest: subset_inverse_mult_lemma) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
822 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
823 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
824 |
lemma inverse_mult_subset_lemma: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
825 |
assumes rpos: "0 < r" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
826 |
and rless: "r < y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
827 |
and notin: "inverse y \<notin> Rep_preal R" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
828 |
and q: "q \<in> Rep_preal R" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
829 |
shows "r*q < 1" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
830 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
831 |
have "q < inverse y" using rpos rless |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
832 |
by (simp add: not_in_preal_ub [OF Rep_preal notin] q) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
833 |
hence "r * q < r/y" using rpos |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
834 |
by (simp add: divide_inverse mult_less_cancel_left) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
835 |
also have "... \<le> 1" using rpos rless |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
836 |
by (simp add: pos_divide_le_eq) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
837 |
finally show ?thesis . |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
838 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
839 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
840 |
lemma inverse_mult_subset: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
841 |
"Rep_preal(inverse R * R) \<subseteq> Rep_preal 1" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
842 |
apply (auto simp add: Bex_def Rep_preal_one mem_Rep_preal_inverse_iff |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
843 |
mem_Rep_preal_mult_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
844 |
apply (simp add: zero_less_mult_iff preal_imp_pos [OF Rep_preal]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
845 |
apply (blast intro: inverse_mult_subset_lemma) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
846 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
847 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
848 |
lemma preal_mult_inverse: "inverse R * R = (1::preal)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
849 |
apply (rule Rep_preal_inject [THEN iffD1]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
850 |
apply (rule equalityI [OF inverse_mult_subset subset_inverse_mult]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
851 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
852 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
853 |
lemma preal_mult_inverse_right: "R * inverse R = (1::preal)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
854 |
apply (rule preal_mult_commute [THEN subst]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
855 |
apply (rule preal_mult_inverse) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
856 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
857 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
858 |
|
61933 | 859 |
text\<open>Theorems needing \<open>Gleason9_34\<close>\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
860 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
861 |
lemma Rep_preal_self_subset: "Rep_preal (R) \<subseteq> Rep_preal(R + S)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
862 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
863 |
fix r |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
864 |
assume r: "r \<in> Rep_preal R" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
865 |
have rpos: "0<r" by (rule preal_imp_pos [OF Rep_preal r]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
866 |
from mem_Rep_preal_Ex |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
867 |
obtain y where y: "y \<in> Rep_preal S" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
868 |
have ypos: "0<y" by (rule preal_imp_pos [OF Rep_preal y]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
869 |
have ry: "r+y \<in> Rep_preal(R + S)" using r y |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
870 |
by (auto simp add: mem_Rep_preal_add_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
871 |
show "r \<in> Rep_preal(R + S)" using r ypos rpos |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
872 |
by (simp add: preal_downwards_closed [OF Rep_preal ry]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
873 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
874 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
875 |
lemma Rep_preal_sum_not_subset: "~ Rep_preal (R + S) \<subseteq> Rep_preal(R)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
876 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
877 |
from mem_Rep_preal_Ex |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
878 |
obtain y where y: "y \<in> Rep_preal S" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
879 |
have ypos: "0<y" by (rule preal_imp_pos [OF Rep_preal y]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
880 |
from Gleason9_34 [OF Rep_preal ypos] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
881 |
obtain r where r: "r \<in> Rep_preal R" and notin: "r + y \<notin> Rep_preal R" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
882 |
have "r + y \<in> Rep_preal (R + S)" using r y |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
883 |
by (auto simp add: mem_Rep_preal_add_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
884 |
thus ?thesis using notin by blast |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
885 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
886 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
887 |
lemma Rep_preal_sum_not_eq: "Rep_preal (R + S) \<noteq> Rep_preal(R)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
888 |
by (insert Rep_preal_sum_not_subset, blast) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
889 |
|
61343 | 890 |
text\<open>at last, Gleason prop. 9-3.5(iii) page 123\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
891 |
lemma preal_self_less_add_left: "(R::preal) < R + S" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
892 |
apply (unfold preal_less_def less_le) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
893 |
apply (simp add: Rep_preal_self_subset Rep_preal_sum_not_eq [THEN not_sym]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
894 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
895 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
896 |
|
61343 | 897 |
subsection\<open>Subtraction for Positive Reals\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
898 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
899 |
text\<open>Gleason prop. 9-3.5(iv), page 123: proving \<^prop>\<open>A < B \<Longrightarrow> \<exists>D. A + D = |
69597 | 900 |
B\<close>. We define the claimed \<^term>\<open>D\<close> and show that it is a positive real\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
901 |
|
61343 | 902 |
text\<open>Part 1 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
903 |
lemma diff_set_not_empty: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
904 |
"R < S \<Longrightarrow> {} \<subset> diff_set (Rep_preal S) (Rep_preal R)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
905 |
apply (auto simp add: preal_less_def diff_set_def elim!: equalityE) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
906 |
apply (frule_tac x1 = S in Rep_preal [THEN preal_exists_greater]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
907 |
apply (drule preal_imp_pos [OF Rep_preal], clarify) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
908 |
apply (cut_tac a=x and b=u in add_eq_exists, force) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
909 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
910 |
|
61343 | 911 |
text\<open>Part 2 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
912 |
lemma diff_set_nonempty: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
913 |
"\<exists>q. 0 < q \<and> q \<notin> diff_set (Rep_preal S) (Rep_preal R)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
914 |
apply (cut_tac X = S in Rep_preal_exists_bound) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
915 |
apply (erule exE) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
916 |
apply (rule_tac x = x in exI, auto) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
917 |
apply (simp add: diff_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
918 |
apply (auto dest: Rep_preal [THEN preal_downwards_closed]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
919 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
920 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
921 |
lemma diff_set_not_rat_set: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
922 |
"diff_set (Rep_preal S) (Rep_preal R) < {r. 0 < r}" (is "?lhs < ?rhs") |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
923 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
924 |
show "?lhs \<subseteq> ?rhs" by (auto simp add: diff_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
925 |
show "?lhs \<noteq> ?rhs" using diff_set_nonempty by blast |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
926 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
927 |
|
61343 | 928 |
text\<open>Part 3 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
929 |
lemma diff_set_lemma3: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
930 |
"\<lbrakk>R < S; u \<in> diff_set (Rep_preal S) (Rep_preal R); 0 < z; z < u\<rbrakk> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
931 |
\<Longrightarrow> z \<in> diff_set (Rep_preal S) (Rep_preal R)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
932 |
apply (auto simp add: diff_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
933 |
apply (rule_tac x=x in exI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
934 |
apply (drule Rep_preal [THEN preal_downwards_closed], auto) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
935 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
936 |
|
61343 | 937 |
text\<open>Part 4 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
938 |
lemma diff_set_lemma4: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
939 |
"\<lbrakk>R < S; y \<in> diff_set (Rep_preal S) (Rep_preal R)\<rbrakk> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
940 |
\<Longrightarrow> \<exists>u \<in> diff_set (Rep_preal S) (Rep_preal R). y < u" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
941 |
apply (auto simp add: diff_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
942 |
apply (drule Rep_preal [THEN preal_exists_greater], clarify) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
943 |
apply (cut_tac a="x+y" and b=u in add_eq_exists, clarify) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
944 |
apply (rule_tac x="y+xa" in exI) |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
945 |
apply (auto simp add: ac_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
946 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
947 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
948 |
lemma mem_diff_set: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
949 |
"R < S \<Longrightarrow> cut (diff_set (Rep_preal S) (Rep_preal R))" |
59814 | 950 |
apply (unfold cut_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
951 |
apply (blast intro!: diff_set_not_empty diff_set_not_rat_set |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
952 |
diff_set_lemma3 diff_set_lemma4) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
953 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
954 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
955 |
lemma mem_Rep_preal_diff_iff: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
956 |
"R < S \<Longrightarrow> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
957 |
(z \<in> Rep_preal(S-R)) = |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
958 |
(\<exists>x. 0 < x \<and> 0 < z \<and> x \<notin> Rep_preal R \<and> x + z \<in> Rep_preal S)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
959 |
apply (simp add: preal_diff_def mem_diff_set Rep_preal) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
960 |
apply (force simp add: diff_set_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
961 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
962 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
963 |
|
69597 | 964 |
text\<open>proving that \<^term>\<open>R + D \<le> S\<close>\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
965 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
966 |
lemma less_add_left_lemma: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
967 |
assumes Rless: "R < S" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
968 |
and a: "a \<in> Rep_preal R" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
969 |
and cb: "c + b \<in> Rep_preal S" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
970 |
and "c \<notin> Rep_preal R" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
971 |
and "0 < b" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
972 |
and "0 < c" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
973 |
shows "a + b \<in> Rep_preal S" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
974 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
975 |
have "0<a" by (rule preal_imp_pos [OF Rep_preal a]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
976 |
moreover |
41541 | 977 |
have "a < c" using assms by (blast intro: not_in_Rep_preal_ub ) |
978 |
ultimately show ?thesis |
|
979 |
using assms by (simp add: preal_downwards_closed [OF Rep_preal cb]) |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
980 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
981 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
982 |
lemma less_add_left_le1: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
983 |
"R < (S::preal) \<Longrightarrow> R + (S-R) \<le> S" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
984 |
apply (auto simp add: Bex_def preal_le_def mem_Rep_preal_add_iff |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
985 |
mem_Rep_preal_diff_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
986 |
apply (blast intro: less_add_left_lemma) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
987 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
988 |
|
69597 | 989 |
subsection\<open>proving that \<^term>\<open>S \<le> R + D\<close> --- trickier\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
990 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
991 |
lemma lemma_sum_mem_Rep_preal_ex: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
992 |
"x \<in> Rep_preal S \<Longrightarrow> \<exists>e. 0 < e \<and> x + e \<in> Rep_preal S" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
993 |
apply (drule Rep_preal [THEN preal_exists_greater], clarify) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
994 |
apply (cut_tac a=x and b=u in add_eq_exists, auto) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
995 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
996 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
997 |
lemma less_add_left_lemma2: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
998 |
assumes Rless: "R < S" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
999 |
and x: "x \<in> Rep_preal S" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1000 |
and xnot: "x \<notin> Rep_preal R" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1001 |
shows "\<exists>u v z. 0 < v \<and> 0 < z \<and> u \<in> Rep_preal R \<and> z \<notin> Rep_preal R \<and> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1002 |
z + v \<in> Rep_preal S \<and> x = u + v" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1003 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1004 |
have xpos: "0<x" by (rule preal_imp_pos [OF Rep_preal x]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1005 |
from lemma_sum_mem_Rep_preal_ex [OF x] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1006 |
obtain e where epos: "0 < e" and xe: "x + e \<in> Rep_preal S" by blast |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1007 |
from Gleason9_34 [OF Rep_preal epos] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1008 |
obtain r where r: "r \<in> Rep_preal R" and notin: "r + e \<notin> Rep_preal R" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1009 |
with x xnot xpos have rless: "r < x" by (blast intro: not_in_Rep_preal_ub) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1010 |
from add_eq_exists [of r x] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1011 |
obtain y where eq: "x = r+y" by auto |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1012 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1013 |
proof (intro exI conjI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1014 |
show "r \<in> Rep_preal R" by (rule r) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1015 |
show "r + e \<notin> Rep_preal R" by (rule notin) |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1016 |
show "r + e + y \<in> Rep_preal S" using xe eq by (simp add: ac_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1017 |
show "x = r + y" by (simp add: eq) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1018 |
show "0 < r + e" using epos preal_imp_pos [OF Rep_preal r] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1019 |
by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1020 |
show "0 < y" using rless eq by arith |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1021 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1022 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1023 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1024 |
lemma less_add_left_le2: "R < (S::preal) \<Longrightarrow> S \<le> R + (S-R)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1025 |
apply (auto simp add: preal_le_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1026 |
apply (case_tac "x \<in> Rep_preal R") |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1027 |
apply (cut_tac Rep_preal_self_subset [of R], force) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1028 |
apply (auto simp add: Bex_def mem_Rep_preal_add_iff mem_Rep_preal_diff_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1029 |
apply (blast dest: less_add_left_lemma2) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1030 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1031 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1032 |
lemma less_add_left: "R < (S::preal) \<Longrightarrow> R + (S-R) = S" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1033 |
by (blast intro: antisym [OF less_add_left_le1 less_add_left_le2]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1034 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1035 |
lemma less_add_left_Ex: "R < (S::preal) \<Longrightarrow> \<exists>D. R + D = S" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1036 |
by (fast dest: less_add_left) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1037 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1038 |
lemma preal_add_less2_mono1: "R < (S::preal) \<Longrightarrow> R + T < S + T" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1039 |
apply (auto dest!: less_add_left_Ex simp add: preal_add_assoc) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1040 |
apply (rule_tac y1 = D in preal_add_commute [THEN subst]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1041 |
apply (auto intro: preal_self_less_add_left simp add: preal_add_assoc [symmetric]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1042 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1043 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1044 |
lemma preal_add_less2_mono2: "R < (S::preal) \<Longrightarrow> T + R < T + S" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1045 |
by (auto intro: preal_add_less2_mono1 simp add: preal_add_commute [of T]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1046 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1047 |
lemma preal_add_right_less_cancel: "R + T < S + T \<Longrightarrow> R < (S::preal)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1048 |
apply (insert linorder_less_linear [of R S], auto) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1049 |
apply (drule_tac R = S and T = T in preal_add_less2_mono1) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1050 |
apply (blast dest: order_less_trans) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1051 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1052 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1053 |
lemma preal_add_left_less_cancel: "T + R < T + S \<Longrightarrow> R < (S::preal)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1054 |
by (auto elim: preal_add_right_less_cancel simp add: preal_add_commute [of T]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1055 |
|
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1056 |
lemma preal_add_less_cancel_left [simp]: "(T + (R::preal) < T + S) = (R < S)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1057 |
by (blast intro: preal_add_less2_mono2 preal_add_left_less_cancel) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1058 |
|
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1059 |
lemma preal_add_less_cancel_right [simp]: "((R::preal) + T < S + T) = (R < S)" |
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1060 |
using preal_add_less_cancel_left [symmetric, of R S T] by (simp add: ac_simps) |
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1061 |
|
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1062 |
lemma preal_add_le_cancel_left [simp]: "(T + (R::preal) \<le> T + S) = (R \<le> S)" |
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1063 |
by (simp add: linorder_not_less [symmetric]) |
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1064 |
|
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1065 |
lemma preal_add_le_cancel_right [simp]: "((R::preal) + T \<le> S + T) = (R \<le> S)" |
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1066 |
using preal_add_le_cancel_left [symmetric, of R S T] by (simp add: ac_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1067 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1068 |
lemma preal_add_right_cancel: "(R::preal) + T = S + T \<Longrightarrow> R = S" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1069 |
apply (insert linorder_less_linear [of R S], safe) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1070 |
apply (drule_tac [!] T = T in preal_add_less2_mono1, auto) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1071 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1072 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1073 |
lemma preal_add_left_cancel: "C + A = C + B \<Longrightarrow> A = (B::preal)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1074 |
by (auto intro: preal_add_right_cancel simp add: preal_add_commute) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1075 |
|
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1076 |
instance preal :: linordered_ab_semigroup_add |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1077 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1078 |
fix a b c :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1079 |
show "a \<le> b \<Longrightarrow> c + a \<le> c + b" by (simp only: preal_add_le_cancel_left) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1080 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1081 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1082 |
|
69597 | 1083 |
subsection\<open>Completeness of type \<^typ>\<open>preal\<close>\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1084 |
|
61343 | 1085 |
text\<open>Prove that supremum is a cut\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1086 |
|
61343 | 1087 |
text\<open>Part 1 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1088 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1089 |
lemma preal_sup_set_not_empty: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1090 |
"P \<noteq> {} \<Longrightarrow> {} \<subset> (\<Union>X \<in> P. Rep_preal(X))" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1091 |
apply auto |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1092 |
apply (cut_tac X = x in mem_Rep_preal_Ex, auto) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1093 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1094 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1095 |
|
61343 | 1096 |
text\<open>Part 2 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1097 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1098 |
lemma preal_sup_not_exists: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1099 |
"\<forall>X \<in> P. X \<le> Y \<Longrightarrow> \<exists>q. 0 < q \<and> q \<notin> (\<Union>X \<in> P. Rep_preal(X))" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1100 |
apply (cut_tac X = Y in Rep_preal_exists_bound) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1101 |
apply (auto simp add: preal_le_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1102 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1103 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1104 |
lemma preal_sup_set_not_rat_set: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1105 |
"\<forall>X \<in> P. X \<le> Y \<Longrightarrow> (\<Union>X \<in> P. Rep_preal(X)) < {r. 0 < r}" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1106 |
apply (drule preal_sup_not_exists) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1107 |
apply (blast intro: preal_imp_pos [OF Rep_preal]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1108 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1109 |
|
61343 | 1110 |
text\<open>Part 3 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1111 |
lemma preal_sup_set_lemma3: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1112 |
"\<lbrakk>P \<noteq> {}; \<forall>X \<in> P. X \<le> Y; u \<in> (\<Union>X \<in> P. Rep_preal(X)); 0 < z; z < u\<rbrakk> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1113 |
\<Longrightarrow> z \<in> (\<Union>X \<in> P. Rep_preal(X))" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1114 |
by (auto elim: Rep_preal [THEN preal_downwards_closed]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1115 |
|
61343 | 1116 |
text\<open>Part 4 of Dedekind sections definition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1117 |
lemma preal_sup_set_lemma4: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1118 |
"\<lbrakk>P \<noteq> {}; \<forall>X \<in> P. X \<le> Y; y \<in> (\<Union>X \<in> P. Rep_preal(X))\<rbrakk> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1119 |
\<Longrightarrow> \<exists>u \<in> (\<Union>X \<in> P. Rep_preal(X)). y < u" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1120 |
by (blast dest: Rep_preal [THEN preal_exists_greater]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1121 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1122 |
lemma preal_sup: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1123 |
"\<lbrakk>P \<noteq> {}; \<forall>X \<in> P. X \<le> Y\<rbrakk> \<Longrightarrow> cut (\<Union>X \<in> P. Rep_preal(X))" |
59814 | 1124 |
apply (unfold cut_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1125 |
apply (blast intro!: preal_sup_set_not_empty preal_sup_set_not_rat_set |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1126 |
preal_sup_set_lemma3 preal_sup_set_lemma4) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1127 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1128 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1129 |
lemma preal_psup_le: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1130 |
"\<lbrakk>\<forall>X \<in> P. X \<le> Y; x \<in> P\<rbrakk> \<Longrightarrow> x \<le> psup P" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1131 |
apply (simp (no_asm_simp) add: preal_le_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1132 |
apply (subgoal_tac "P \<noteq> {}") |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1133 |
apply (auto simp add: psup_def preal_sup) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1134 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1135 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1136 |
lemma psup_le_ub: "\<lbrakk>P \<noteq> {}; \<forall>X \<in> P. X \<le> Y\<rbrakk> \<Longrightarrow> psup P \<le> Y" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1137 |
apply (simp (no_asm_simp) add: preal_le_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1138 |
apply (simp add: psup_def preal_sup) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1139 |
apply (auto simp add: preal_le_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1140 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1141 |
|
61343 | 1142 |
text\<open>Supremum property\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1143 |
lemma preal_complete: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1144 |
"\<lbrakk>P \<noteq> {}; \<forall>X \<in> P. X \<le> Y\<rbrakk> \<Longrightarrow> (\<exists>X \<in> P. Z < X) = (Z < psup P)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1145 |
apply (simp add: preal_less_def psup_def preal_sup) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1146 |
apply (auto simp add: preal_le_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1147 |
apply (rename_tac U) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1148 |
apply (cut_tac x = U and y = Z in linorder_less_linear) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1149 |
apply (auto simp add: preal_less_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1150 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1151 |
|
61343 | 1152 |
section \<open>Defining the Reals from the Positive Reals\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1153 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1154 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1155 |
realrel :: "((preal * preal) * (preal * preal)) set" where |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1156 |
"realrel = {p. \<exists>x1 y1 x2 y2. p = ((x1,y1),(x2,y2)) \<and> x1+y2 = x2+y1}" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1157 |
|
45694
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
41541
diff
changeset
|
1158 |
definition "Real = UNIV//realrel" |
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
41541
diff
changeset
|
1159 |
|
49834 | 1160 |
typedef real = Real |
45694
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
41541
diff
changeset
|
1161 |
morphisms Rep_Real Abs_Real |
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
41541
diff
changeset
|
1162 |
unfolding Real_def by (auto simp add: quotient_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1163 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1164 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1165 |
(** these don't use the overloaded "real" function: users don't see them **) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1166 |
real_of_preal :: "preal => real" where |
37765 | 1167 |
"real_of_preal m = Abs_Real (realrel `` {(m + 1, 1)})" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1168 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1169 |
instantiation real :: "{zero, one, plus, minus, uminus, times, inverse, ord, abs, sgn}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1170 |
begin |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1171 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1172 |
definition |
37765 | 1173 |
real_zero_def: "0 = Abs_Real(realrel``{(1, 1)})" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1174 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1175 |
definition |
37765 | 1176 |
real_one_def: "1 = Abs_Real(realrel``{(1 + 1, 1)})" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1177 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1178 |
definition |
37765 | 1179 |
real_add_def: "z + w = |
39910 | 1180 |
the_elem (\<Union>(x,y) \<in> Rep_Real(z). \<Union>(u,v) \<in> Rep_Real(w). |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1181 |
{ Abs_Real(realrel``{(x+u, y+v)}) })" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1182 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1183 |
definition |
39910 | 1184 |
real_minus_def: "- r = the_elem (\<Union>(x,y) \<in> Rep_Real(r). { Abs_Real(realrel``{(y,x)}) })" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1185 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1186 |
definition |
37765 | 1187 |
real_diff_def: "r - (s::real) = r + - s" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1188 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1189 |
definition |
37765 | 1190 |
real_mult_def: |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1191 |
"z * w = |
39910 | 1192 |
the_elem (\<Union>(x,y) \<in> Rep_Real(z). \<Union>(u,v) \<in> Rep_Real(w). |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1193 |
{ Abs_Real(realrel``{(x*u + y*v, x*v + y*u)}) })" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1194 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1195 |
definition |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1196 |
real_inverse_def: "inverse (R::real) = (THE S. (R = 0 \<and> S = 0) | S * R = 1)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1197 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1198 |
definition |
60429
d3d1e185cd63
uniform _ div _ as infix syntax for ring division
haftmann
parents:
60352
diff
changeset
|
1199 |
real_divide_def: "R div (S::real) = R * inverse S" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1200 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1201 |
definition |
37765 | 1202 |
real_le_def: "z \<le> (w::real) \<longleftrightarrow> |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1203 |
(\<exists>x y u v. x+v \<le> u+y \<and> (x,y) \<in> Rep_Real z \<and> (u,v) \<in> Rep_Real w)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1204 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1205 |
definition |
61076 | 1206 |
real_less_def: "x < (y::real) \<longleftrightarrow> x \<le> y \<and> x \<noteq> y" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1207 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1208 |
definition |
61945 | 1209 |
real_abs_def: "\<bar>r::real\<bar> = (if r < 0 then - r else r)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1210 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1211 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1212 |
real_sgn_def: "sgn (x::real) = (if x=0 then 0 else if 0<x then 1 else - 1)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1213 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1214 |
instance .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1215 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1216 |
end |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1217 |
|
61343 | 1218 |
subsection \<open>Equivalence relation over positive reals\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1219 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1220 |
lemma preal_trans_lemma: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1221 |
assumes "x + y1 = x1 + y" |
41541 | 1222 |
and "x + y2 = x2 + y" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1223 |
shows "x1 + y2 = x2 + (y1::preal)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1224 |
proof - |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1225 |
have "(x1 + y2) + x = (x + y2) + x1" by (simp add: ac_simps) |
41541 | 1226 |
also have "... = (x2 + y) + x1" by (simp add: assms) |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1227 |
also have "... = x2 + (x1 + y)" by (simp add: ac_simps) |
41541 | 1228 |
also have "... = x2 + (x + y1)" by (simp add: assms) |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1229 |
also have "... = (x2 + y1) + x" by (simp add: ac_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1230 |
finally have "(x1 + y2) + x = (x2 + y1) + x" . |
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1231 |
thus ?thesis by (rule preal_add_right_cancel) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1232 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1233 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1234 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1235 |
lemma realrel_iff [simp]: "(((x1,y1),(x2,y2)) \<in> realrel) = (x1 + y2 = x2 + y1)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1236 |
by (simp add: realrel_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1237 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1238 |
lemma equiv_realrel: "equiv UNIV realrel" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1239 |
apply (auto simp add: equiv_def refl_on_def sym_def trans_def realrel_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1240 |
apply (blast dest: preal_trans_lemma) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1241 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1242 |
|
69597 | 1243 |
text\<open>Reduces equality of equivalence classes to the \<^term>\<open>realrel\<close> relation: |
1244 |
\<^term>\<open>(realrel `` {x} = realrel `` {y}) = ((x,y) \<in> realrel)\<close>\<close> |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1245 |
lemmas equiv_realrel_iff = |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1246 |
eq_equiv_class_iff [OF equiv_realrel UNIV_I UNIV_I] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1247 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1248 |
declare equiv_realrel_iff [simp] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1249 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1250 |
|
67613 | 1251 |
lemma realrel_in_real [simp]: "realrel``{(x,y)} \<in> Real" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1252 |
by (simp add: Real_def realrel_def quotient_def, blast) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1253 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1254 |
declare Abs_Real_inject [simp] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1255 |
declare Abs_Real_inverse [simp] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1256 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1257 |
|
61343 | 1258 |
text\<open>Case analysis on the representation of a real number as an equivalence |
1259 |
class of pairs of positive reals.\<close> |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1260 |
lemma eq_Abs_Real [case_names Abs_Real, cases type: real]: |
67613 | 1261 |
"(\<And>x y. z = Abs_Real(realrel``{(x,y)}) \<Longrightarrow> P) \<Longrightarrow> P" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1262 |
apply (rule Rep_Real [of z, unfolded Real_def, THEN quotientE]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1263 |
apply (drule arg_cong [where f=Abs_Real]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1264 |
apply (auto simp add: Rep_Real_inverse) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1265 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1266 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1267 |
|
61343 | 1268 |
subsection \<open>Addition and Subtraction\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1269 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1270 |
lemma real_add_congruent2_lemma: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1271 |
"\<lbrakk>a + ba = aa + b; ab + bc = ac + bb\<rbrakk> |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1272 |
\<Longrightarrow> a + ab + (ba + bc) = aa + ac + (b + (bb::preal))" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1273 |
apply (simp add: add.assoc) |
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1274 |
apply (rule add.left_commute [of ab, THEN ssubst]) |
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1275 |
apply (simp add: add.assoc [symmetric]) |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1276 |
apply (simp add: ac_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1277 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1278 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1279 |
lemma real_add: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1280 |
"Abs_Real (realrel``{(x,y)}) + Abs_Real (realrel``{(u,v)}) = |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1281 |
Abs_Real (realrel``{(x+u, y+v)})" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1282 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1283 |
have "(\<lambda>z w. (\<lambda>(x,y). (\<lambda>(u,v). {Abs_Real (realrel `` {(x+u, y+v)})}) w) z) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1284 |
respects2 realrel" |
40822 | 1285 |
by (auto simp add: congruent2_def, blast intro: real_add_congruent2_lemma) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1286 |
thus ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1287 |
by (simp add: real_add_def UN_UN_split_split_eq |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1288 |
UN_equiv_class2 [OF equiv_realrel equiv_realrel]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1289 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1290 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1291 |
lemma real_minus: "- Abs_Real(realrel``{(x,y)}) = Abs_Real(realrel `` {(y,x)})" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1292 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1293 |
have "(\<lambda>(x,y). {Abs_Real (realrel``{(y,x)})}) respects realrel" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1294 |
by (auto simp add: congruent_def add.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1295 |
thus ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1296 |
by (simp add: real_minus_def UN_equiv_class [OF equiv_realrel]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1297 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1298 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1299 |
instance real :: ab_group_add |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1300 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1301 |
fix x y z :: real |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1302 |
show "(x + y) + z = x + (y + z)" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1303 |
by (cases x, cases y, cases z, simp add: real_add add.assoc) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1304 |
show "x + y = y + x" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1305 |
by (cases x, cases y, simp add: real_add add.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1306 |
show "0 + x = x" |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1307 |
by (cases x, simp add: real_add real_zero_def ac_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1308 |
show "- x + x = 0" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1309 |
by (cases x, simp add: real_minus real_add real_zero_def add.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1310 |
show "x - y = x + - y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1311 |
by (simp add: real_diff_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1312 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1313 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1314 |
|
61343 | 1315 |
subsection \<open>Multiplication\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1316 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1317 |
lemma real_mult_congruent2_lemma: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1318 |
"!!(x1::preal). \<lbrakk>x1 + y2 = x2 + y1\<rbrakk> \<Longrightarrow> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1319 |
x * x1 + y * y1 + (x * y2 + y * x2) = |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1320 |
x * x2 + y * y2 + (x * y1 + y * x1)" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1321 |
apply (simp add: add.left_commute add.assoc [symmetric]) |
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1322 |
apply (simp add: add.assoc distrib_left [symmetric]) |
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1323 |
apply (simp add: add.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1324 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1325 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1326 |
lemma real_mult_congruent2: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1327 |
"(%p1 p2. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1328 |
(%(x1,y1). (%(x2,y2). |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1329 |
{ Abs_Real (realrel``{(x1*x2 + y1*y2, x1*y2+y1*x2)}) }) p2) p1) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1330 |
respects2 realrel" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1331 |
apply (rule congruent2_commuteI [OF equiv_realrel], clarify) |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1332 |
apply (simp add: mult.commute add.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1333 |
apply (auto simp add: real_mult_congruent2_lemma) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1334 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1335 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1336 |
lemma real_mult: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1337 |
"Abs_Real((realrel``{(x1,y1)})) * Abs_Real((realrel``{(x2,y2)})) = |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1338 |
Abs_Real(realrel `` {(x1*x2+y1*y2,x1*y2+y1*x2)})" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1339 |
by (simp add: real_mult_def UN_UN_split_split_eq |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1340 |
UN_equiv_class2 [OF equiv_realrel equiv_realrel real_mult_congruent2]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1341 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1342 |
lemma real_mult_commute: "(z::real) * w = w * z" |
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1343 |
by (cases z, cases w, simp add: real_mult ac_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1344 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1345 |
lemma real_mult_assoc: "((z1::real) * z2) * z3 = z1 * (z2 * z3)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1346 |
apply (cases z1, cases z2, cases z3) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1347 |
apply (simp add: real_mult algebra_simps) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1348 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1349 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1350 |
lemma real_mult_1: "(1::real) * z = z" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1351 |
apply (cases z) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1352 |
apply (simp add: real_mult real_one_def algebra_simps) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1353 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1354 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1355 |
lemma real_add_mult_distrib: "((z1::real) + z2) * w = (z1 * w) + (z2 * w)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1356 |
apply (cases z1, cases z2, cases w) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1357 |
apply (simp add: real_add real_mult algebra_simps) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1358 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1359 |
|
61343 | 1360 |
text\<open>one and zero are distinct\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1361 |
lemma real_zero_not_eq_one: "0 \<noteq> (1::real)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1362 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1363 |
have "(1::preal) < 1 + 1" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1364 |
by (simp add: preal_self_less_add_left) |
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1365 |
then show ?thesis |
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1366 |
by (simp add: real_zero_def real_one_def neq_iff) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1367 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1368 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1369 |
instance real :: comm_ring_1 |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1370 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1371 |
fix x y z :: real |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1372 |
show "(x * y) * z = x * (y * z)" by (rule real_mult_assoc) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1373 |
show "x * y = y * x" by (rule real_mult_commute) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1374 |
show "1 * x = x" by (rule real_mult_1) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1375 |
show "(x + y) * z = x * z + y * z" by (rule real_add_mult_distrib) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1376 |
show "0 \<noteq> (1::real)" by (rule real_zero_not_eq_one) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1377 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1378 |
|
61343 | 1379 |
subsection \<open>Inverse and Division\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1380 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1381 |
lemma real_zero_iff: "Abs_Real (realrel `` {(x, x)}) = 0" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1382 |
by (simp add: real_zero_def add.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1383 |
|
61343 | 1384 |
text\<open>Instead of using an existential quantifier and constructing the inverse |
1385 |
within the proof, we could define the inverse explicitly.\<close> |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1386 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1387 |
lemma real_mult_inverse_left_ex: "x \<noteq> 0 \<Longrightarrow> \<exists>y. y*x = (1::real)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1388 |
apply (simp add: real_zero_def real_one_def, cases x) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1389 |
apply (cut_tac x = xa and y = y in linorder_less_linear) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1390 |
apply (auto dest!: less_add_left_Ex simp add: real_zero_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1391 |
apply (rule_tac |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1392 |
x = "Abs_Real (realrel``{(1, inverse (D) + 1)})" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1393 |
in exI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1394 |
apply (rule_tac [2] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1395 |
x = "Abs_Real (realrel``{(inverse (D) + 1, 1)})" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1396 |
in exI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1397 |
apply (auto simp add: real_mult preal_mult_inverse_right algebra_simps) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1398 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1399 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1400 |
lemma real_mult_inverse_left: "x \<noteq> 0 \<Longrightarrow> inverse(x)*x = (1::real)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1401 |
apply (simp add: real_inverse_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1402 |
apply (drule real_mult_inverse_left_ex, safe) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1403 |
apply (rule theI, assumption, rename_tac z) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1404 |
apply (subgoal_tac "(z * x) * y = z * (x * y)") |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1405 |
apply (simp add: mult.commute) |
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1406 |
apply (rule mult.assoc) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1407 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1408 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1409 |
|
61343 | 1410 |
subsection\<open>The Real Numbers form a Field\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1411 |
|
59867
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59815
diff
changeset
|
1412 |
instance real :: field |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1413 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1414 |
fix x y z :: real |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1415 |
show "x \<noteq> 0 \<Longrightarrow> inverse x * x = 1" by (rule real_mult_inverse_left) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1416 |
show "x / y = x * inverse y" by (simp add: real_divide_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1417 |
show "inverse 0 = (0::real)" by (simp add: real_inverse_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1418 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1419 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1420 |
|
61933 | 1421 |
subsection\<open>The \<open>\<le>\<close> Ordering\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1422 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1423 |
lemma real_le_refl: "w \<le> (w::real)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1424 |
by (cases w, force simp add: real_le_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1425 |
|
61343 | 1426 |
text\<open>The arithmetic decision procedure is not set up for type preal. |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1427 |
This lemma is currently unused, but it could simplify the proofs of the |
61343 | 1428 |
following two lemmas.\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1429 |
lemma preal_eq_le_imp_le: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1430 |
assumes eq: "a+b = c+d" and le: "c \<le> a" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1431 |
shows "b \<le> (d::preal)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1432 |
proof - |
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1433 |
from le have "c+d \<le> a+d" by simp |
41541 | 1434 |
hence "a+b \<le> a+d" by (simp add: eq) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1435 |
thus "b \<le> d" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1436 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1437 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1438 |
lemma real_le_lemma: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1439 |
assumes l: "u1 + v2 \<le> u2 + v1" |
41541 | 1440 |
and "x1 + v1 = u1 + y1" |
1441 |
and "x2 + v2 = u2 + y2" |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1442 |
shows "x1 + y2 \<le> x2 + (y1::preal)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1443 |
proof - |
41541 | 1444 |
have "(x1+v1) + (u2+y2) = (u1+y1) + (x2+v2)" by (simp add: assms) |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1445 |
hence "(x1+y2) + (u2+v1) = (x2+y1) + (u1+v2)" by (simp add: ac_simps) |
41541 | 1446 |
also have "... \<le> (x2+y1) + (u2+v1)" by (simp add: assms) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1447 |
finally show ?thesis by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1448 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1449 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1450 |
lemma real_le: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1451 |
"(Abs_Real(realrel``{(x1,y1)}) \<le> Abs_Real(realrel``{(x2,y2)})) = |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1452 |
(x1 + y2 \<le> x2 + y1)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1453 |
apply (simp add: real_le_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1454 |
apply (auto intro: real_le_lemma) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1455 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1456 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1457 |
lemma real_le_antisym: "\<lbrakk>z \<le> w; w \<le> z\<rbrakk> \<Longrightarrow> z = (w::real)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1458 |
by (cases z, cases w, simp add: real_le) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1459 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1460 |
lemma real_trans_lemma: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1461 |
assumes "x + v \<le> u + y" |
41541 | 1462 |
and "u + v' \<le> u' + v" |
1463 |
and "x2 + v2 = u2 + y2" |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1464 |
shows "x + v' \<le> u' + (y::preal)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1465 |
proof - |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1466 |
have "(x+v') + (u+v) = (x+v) + (u+v')" by (simp add: ac_simps) |
41541 | 1467 |
also have "... \<le> (u+y) + (u+v')" by (simp add: assms) |
1468 |
also have "... \<le> (u+y) + (u'+v)" by (simp add: assms) |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1469 |
also have "... = (u'+y) + (u+v)" by (simp add: ac_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1470 |
finally show ?thesis by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1471 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1472 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1473 |
lemma real_le_trans: "\<lbrakk>i \<le> j; j \<le> k\<rbrakk> \<Longrightarrow> i \<le> (k::real)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1474 |
apply (cases i, cases j, cases k) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1475 |
apply (simp add: real_le) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1476 |
apply (blast intro: real_trans_lemma) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1477 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1478 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1479 |
instance real :: order |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1480 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1481 |
fix u v :: real |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1482 |
show "u < v \<longleftrightarrow> u \<le> v \<and> \<not> v \<le> u" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1483 |
by (auto simp add: real_less_def intro: real_le_antisym) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1484 |
qed (assumption | rule real_le_refl real_le_trans real_le_antisym)+ |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1485 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1486 |
(* Axiom 'linorder_linear' of class 'linorder': *) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1487 |
lemma real_le_linear: "(z::real) \<le> w | w \<le> z" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1488 |
apply (cases z, cases w) |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1489 |
apply (auto simp add: real_le real_zero_def ac_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1490 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1491 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1492 |
instance real :: linorder |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1493 |
by (intro_classes, rule real_le_linear) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1494 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1495 |
lemma real_le_eq_diff: "(x \<le> y) = (x-y \<le> (0::real))" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1496 |
apply (cases x, cases y) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1497 |
apply (auto simp add: real_le real_zero_def real_diff_def real_add real_minus |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1498 |
ac_simps) |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1499 |
apply (simp_all add: add.assoc [symmetric]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1500 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1501 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1502 |
lemma real_add_left_mono: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1503 |
assumes le: "x \<le> y" shows "z + x \<le> z + (y::real)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1504 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1505 |
have "z + x - (z + y) = (z + -z) + (x - y)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1506 |
by (simp add: algebra_simps) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1507 |
with le show ?thesis |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53373
diff
changeset
|
1508 |
by (simp add: real_le_eq_diff[of x] real_le_eq_diff[of "z+x"]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1509 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1510 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1511 |
lemma real_sum_gt_zero_less: "(0 < S + (-W::real)) \<Longrightarrow> (W < S)" |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53373
diff
changeset
|
1512 |
by (simp add: linorder_not_le [symmetric] real_le_eq_diff [of S]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1513 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1514 |
lemma real_less_sum_gt_zero: "(W < S) \<Longrightarrow> (0 < S + (-W::real))" |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53373
diff
changeset
|
1515 |
by (simp add: linorder_not_le [symmetric] real_le_eq_diff [of S]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1516 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1517 |
lemma real_mult_order: "\<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> (0::real) < x * y" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1518 |
apply (cases x, cases y) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1519 |
apply (simp add: linorder_not_le [where 'a = real, symmetric] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1520 |
linorder_not_le [where 'a = preal] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1521 |
real_zero_def real_le real_mult) |
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
61945
diff
changeset
|
1522 |
\<comment> \<open>Reduce to the (simpler) \<open>\<le>\<close> relation\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1523 |
apply (auto dest!: less_add_left_Ex |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1524 |
simp add: algebra_simps preal_self_less_add_left) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1525 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1526 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1527 |
lemma real_mult_less_mono2: "\<lbrakk>(0::real) < z; x < y\<rbrakk> \<Longrightarrow> z * x < z * y" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1528 |
apply (rule real_sum_gt_zero_less) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1529 |
apply (drule real_less_sum_gt_zero [of x y]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1530 |
apply (drule real_mult_order, assumption) |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53373
diff
changeset
|
1531 |
apply (simp add: algebra_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1532 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1533 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1534 |
instantiation real :: distrib_lattice |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1535 |
begin |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1536 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1537 |
definition |
61076 | 1538 |
"(inf :: real \<Rightarrow> real \<Rightarrow> real) = min" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1539 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1540 |
definition |
61076 | 1541 |
"(sup :: real \<Rightarrow> real \<Rightarrow> real) = max" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1542 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1543 |
instance |
61169 | 1544 |
by standard (auto simp add: inf_real_def sup_real_def max_min_distrib2) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1545 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1546 |
end |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1547 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1548 |
|
61343 | 1549 |
subsection\<open>The Reals Form an Ordered Field\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1550 |
|
59867
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59815
diff
changeset
|
1551 |
instance real :: linordered_field |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1552 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1553 |
fix x y z :: real |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1554 |
show "x \<le> y \<Longrightarrow> z + x \<le> z + y" by (rule real_add_left_mono) |
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1555 |
show "x < y \<Longrightarrow> 0 < z \<Longrightarrow> z * x < z * y" by (rule real_mult_less_mono2) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1556 |
show "\<bar>x\<bar> = (if x < 0 then -x else x)" by (simp only: real_abs_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1557 |
show "sgn x = (if x=0 then 0 else if 0<x then 1 else - 1)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1558 |
by (simp only: real_sgn_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1559 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1560 |
|
69597 | 1561 |
text\<open>The function \<^term>\<open>real_of_preal\<close> requires many proofs, but it seems |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1562 |
to be essential for proving completeness of the reals from that of the |
61343 | 1563 |
positive reals.\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1564 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1565 |
lemma real_of_preal_add: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1566 |
"real_of_preal ((x::preal) + y) = real_of_preal x + real_of_preal y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1567 |
by (simp add: real_of_preal_def real_add algebra_simps) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1568 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1569 |
lemma real_of_preal_mult: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1570 |
"real_of_preal ((x::preal) * y) = real_of_preal x* real_of_preal y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1571 |
by (simp add: real_of_preal_def real_mult algebra_simps) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1572 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1573 |
|
61343 | 1574 |
text\<open>Gleason prop 9-4.4 p 127\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1575 |
lemma real_of_preal_trichotomy: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1576 |
"\<exists>m. (x::real) = real_of_preal m | x = 0 | x = -(real_of_preal m)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1577 |
apply (simp add: real_of_preal_def real_zero_def, cases x) |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1578 |
apply (auto simp add: real_minus ac_simps) |
57492
74bf65a1910a
Hypsubst preserves equality hypotheses
Thomas Sewell <thomas.sewell@nicta.com.au>
parents:
56544
diff
changeset
|
1579 |
apply (cut_tac x = xa and y = y in linorder_less_linear) |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1580 |
apply (auto dest!: less_add_left_Ex simp add: add.assoc [symmetric]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1581 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1582 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1583 |
lemma real_of_preal_leD: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1584 |
"real_of_preal m1 \<le> real_of_preal m2 \<Longrightarrow> m1 \<le> m2" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1585 |
by (simp add: real_of_preal_def real_le) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1586 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1587 |
lemma real_of_preal_lessI: "m1 < m2 \<Longrightarrow> real_of_preal m1 < real_of_preal m2" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1588 |
by (auto simp add: real_of_preal_leD linorder_not_le [symmetric]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1589 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1590 |
lemma real_of_preal_lessD: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1591 |
"real_of_preal m1 < real_of_preal m2 \<Longrightarrow> m1 < m2" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1592 |
by (simp add: real_of_preal_def real_le linorder_not_le [symmetric]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1593 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1594 |
lemma real_of_preal_less_iff [simp]: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1595 |
"(real_of_preal m1 < real_of_preal m2) = (m1 < m2)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1596 |
by (blast intro: real_of_preal_lessI real_of_preal_lessD) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1597 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1598 |
lemma real_of_preal_le_iff: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1599 |
"(real_of_preal m1 \<le> real_of_preal m2) = (m1 \<le> m2)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1600 |
by (simp add: linorder_not_less [symmetric]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1601 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1602 |
lemma real_of_preal_zero_less: "0 < real_of_preal m" |
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1603 |
using preal_self_less_add_left [of 1 m] |
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1604 |
apply (auto simp add: real_zero_def real_of_preal_def real_less_def real_le_def ac_simps neq_iff) |
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1605 |
apply (metis Rep_preal_self_subset add.commute preal_le_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1606 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1607 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1608 |
lemma real_of_preal_minus_less_zero: "- real_of_preal m < 0" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1609 |
by (simp add: real_of_preal_zero_less) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1610 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1611 |
lemma real_of_preal_not_minus_gt_zero: "~ 0 < - real_of_preal m" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1612 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1613 |
from real_of_preal_minus_less_zero |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1614 |
show ?thesis by (blast dest: order_less_trans) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1615 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1616 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1617 |
|
61343 | 1618 |
subsection\<open>Theorems About the Ordering\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1619 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1620 |
lemma real_gt_zero_preal_Ex: "(0 < x) = (\<exists>y. x = real_of_preal y)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1621 |
apply (auto simp add: real_of_preal_zero_less) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1622 |
apply (cut_tac x = x in real_of_preal_trichotomy) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1623 |
apply (blast elim!: real_of_preal_not_minus_gt_zero [THEN notE]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1624 |
done |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1625 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1626 |
lemma real_gt_preal_preal_Ex: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1627 |
"real_of_preal z < x \<Longrightarrow> \<exists>y. x = real_of_preal y" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1628 |
by (blast dest!: real_of_preal_zero_less [THEN order_less_trans] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1629 |
intro: real_gt_zero_preal_Ex [THEN iffD1]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1630 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1631 |
lemma real_ge_preal_preal_Ex: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1632 |
"real_of_preal z \<le> x \<Longrightarrow> \<exists>y. x = real_of_preal y" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1633 |
by (blast dest: order_le_imp_less_or_eq real_gt_preal_preal_Ex) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1634 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1635 |
lemma real_less_all_preal: "y \<le> 0 \<Longrightarrow> \<forall>x. y < real_of_preal x" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1636 |
by (auto elim: order_le_imp_less_or_eq [THEN disjE] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1637 |
intro: real_of_preal_zero_less [THEN [2] order_less_trans] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1638 |
simp add: real_of_preal_zero_less) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1639 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1640 |
lemma real_less_all_real2: "~ 0 < y \<Longrightarrow> \<forall>x. y < real_of_preal x" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1641 |
by (blast intro!: real_less_all_preal linorder_not_less [THEN iffD1]) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1642 |
|
61343 | 1643 |
subsection \<open>Completeness of Positive Reals\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1644 |
|
61343 | 1645 |
text \<open> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1646 |
Supremum property for the set of positive reals |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1647 |
|
61933 | 1648 |
Let \<open>P\<close> be a non-empty set of positive reals, with an upper |
1649 |
bound \<open>y\<close>. Then \<open>P\<close> has a least upper bound |
|
1650 |
(written \<open>S\<close>). |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1651 |
|
61933 | 1652 |
FIXME: Can the premise be weakened to \<open>\<forall>x \<in> P. x\<le> y\<close>? |
61343 | 1653 |
\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1654 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1655 |
lemma posreal_complete: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1656 |
assumes positive_P: "\<forall>x \<in> P. (0::real) < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1657 |
and not_empty_P: "\<exists>x. x \<in> P" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1658 |
and upper_bound_Ex: "\<exists>y. \<forall>x \<in> P. x<y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1659 |
shows "\<exists>S. \<forall>y. (\<exists>x \<in> P. y < x) = (y < S)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1660 |
proof (rule exI, rule allI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1661 |
fix y |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1662 |
let ?pP = "{w. real_of_preal w \<in> P}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1663 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1664 |
show "(\<exists>x\<in>P. y < x) = (y < real_of_preal (psup ?pP))" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1665 |
proof (cases "0 < y") |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1666 |
assume neg_y: "\<not> 0 < y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1667 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1668 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1669 |
assume "\<exists>x\<in>P. y < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1670 |
have "\<forall>x. y < real_of_preal x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1671 |
using neg_y by (rule real_less_all_real2) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1672 |
thus "y < real_of_preal (psup ?pP)" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1673 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1674 |
assume "y < real_of_preal (psup ?pP)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1675 |
obtain "x" where x_in_P: "x \<in> P" using not_empty_P .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1676 |
hence "0 < x" using positive_P by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1677 |
hence "y < x" using neg_y by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1678 |
thus "\<exists>x \<in> P. y < x" using x_in_P .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1679 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1680 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1681 |
assume pos_y: "0 < y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1682 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1683 |
then obtain py where y_is_py: "y = real_of_preal py" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1684 |
by (auto simp add: real_gt_zero_preal_Ex) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1685 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1686 |
obtain a where "a \<in> P" using not_empty_P .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1687 |
with positive_P have a_pos: "0 < a" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1688 |
then obtain pa where "a = real_of_preal pa" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1689 |
by (auto simp add: real_gt_zero_preal_Ex) |
61343 | 1690 |
hence "pa \<in> ?pP" using \<open>a \<in> P\<close> by auto |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1691 |
hence pP_not_empty: "?pP \<noteq> {}" by auto |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1692 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1693 |
obtain sup where sup: "\<forall>x \<in> P. x < sup" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1694 |
using upper_bound_Ex .. |
61343 | 1695 |
from this and \<open>a \<in> P\<close> have "a < sup" .. |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1696 |
hence "0 < sup" using a_pos by arith |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1697 |
then obtain possup where "sup = real_of_preal possup" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1698 |
by (auto simp add: real_gt_zero_preal_Ex) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1699 |
hence "\<forall>X \<in> ?pP. X \<le> possup" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1700 |
using sup by (auto simp add: real_of_preal_lessI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1701 |
with pP_not_empty have psup: "\<And>Z. (\<exists>X \<in> ?pP. Z < X) = (Z < psup ?pP)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1702 |
by (rule preal_complete) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1703 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1704 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1705 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1706 |
assume "\<exists>x \<in> P. y < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1707 |
then obtain x where x_in_P: "x \<in> P" and y_less_x: "y < x" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1708 |
hence "0 < x" using pos_y by arith |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1709 |
then obtain px where x_is_px: "x = real_of_preal px" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1710 |
by (auto simp add: real_gt_zero_preal_Ex) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1711 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1712 |
have py_less_X: "\<exists>X \<in> ?pP. py < X" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1713 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1714 |
show "py < px" using y_is_py and x_is_px and y_less_x |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1715 |
by (simp add: real_of_preal_lessI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1716 |
show "px \<in> ?pP" using x_in_P and x_is_px by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1717 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1718 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1719 |
have "(\<exists>X \<in> ?pP. py < X) \<Longrightarrow> (py < psup ?pP)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1720 |
using psup by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1721 |
hence "py < psup ?pP" using py_less_X by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1722 |
thus "y < real_of_preal (psup {w. real_of_preal w \<in> P})" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1723 |
using y_is_py and pos_y by (simp add: real_of_preal_lessI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1724 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1725 |
assume y_less_psup: "y < real_of_preal (psup ?pP)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1726 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1727 |
hence "py < psup ?pP" using y_is_py |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1728 |
by (simp add: real_of_preal_lessI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1729 |
then obtain "X" where py_less_X: "py < X" and X_in_pP: "X \<in> ?pP" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1730 |
using psup by auto |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1731 |
then obtain x where x_is_X: "x = real_of_preal X" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1732 |
by (simp add: real_gt_zero_preal_Ex) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1733 |
hence "y < x" using py_less_X and y_is_py |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1734 |
by (simp add: real_of_preal_lessI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1735 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1736 |
moreover have "x \<in> P" using x_is_X and X_in_pP by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1737 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1738 |
ultimately show "\<exists> x \<in> P. y < x" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1739 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1740 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1741 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1742 |
|
61343 | 1743 |
text \<open> |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1744 |
\medskip Completeness |
61343 | 1745 |
\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1746 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1747 |
lemma reals_complete: |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1748 |
fixes S :: "real set" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1749 |
assumes notempty_S: "\<exists>X. X \<in> S" |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1750 |
and exists_Ub: "bdd_above S" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1751 |
shows "\<exists>x. (\<forall>s\<in>S. s \<le> x) \<and> (\<forall>y. (\<forall>s\<in>S. s \<le> y) \<longrightarrow> x \<le> y)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1752 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1753 |
obtain X where X_in_S: "X \<in> S" using notempty_S .. |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1754 |
obtain Y where Y_isUb: "\<forall>s\<in>S. s \<le> Y" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1755 |
using exists_Ub by (auto simp: bdd_above_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1756 |
let ?SHIFT = "{z. \<exists>x \<in>S. z = x + (-X) + 1} \<inter> {x. 0 < x}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1757 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1758 |
{ |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1759 |
fix x |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1760 |
assume S_le_x: "\<forall>s\<in>S. s \<le> x" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1761 |
{ |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1762 |
fix s |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1763 |
assume "s \<in> {z. \<exists>x\<in>S. z = x + - X + 1}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1764 |
hence "\<exists> x \<in> S. s = x + -X + 1" .. |
53373 | 1765 |
then obtain x1 where x1: "x1 \<in> S" "s = x1 + (-X) + 1" .. |
1766 |
then have "x1 \<le> x" using S_le_x by simp |
|
1767 |
with x1 have "s \<le> x + - X + 1" by arith |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1768 |
} |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1769 |
then have "\<forall>s\<in>?SHIFT. s \<le> x + (-X) + 1" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1770 |
by auto |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1771 |
} note S_Ub_is_SHIFT_Ub = this |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1772 |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1773 |
have *: "\<forall>s\<in>?SHIFT. s \<le> Y + (-X) + 1" using Y_isUb by (rule S_Ub_is_SHIFT_Ub) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1774 |
have "\<forall>s\<in>?SHIFT. s < Y + (-X) + 2" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1775 |
proof |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1776 |
fix s assume "s\<in>?SHIFT" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1777 |
with * have "s \<le> Y + (-X) + 1" by simp |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1778 |
also have "\<dots> < Y + (-X) + 2" by simp |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1779 |
finally show "s < Y + (-X) + 2" . |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1780 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1781 |
moreover have "\<forall>y \<in> ?SHIFT. 0 < y" by auto |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1782 |
moreover have shifted_not_empty: "\<exists>u. u \<in> ?SHIFT" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1783 |
using X_in_S and Y_isUb by auto |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1784 |
ultimately obtain t where t_is_Lub: "\<forall>y. (\<exists>x\<in>?SHIFT. y < x) = (y < t)" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1785 |
using posreal_complete [of ?SHIFT] unfolding bdd_above_def by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1786 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1787 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1788 |
proof |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1789 |
show "(\<forall>s\<in>S. s \<le> (t + X + (-1))) \<and> (\<forall>y. (\<forall>s\<in>S. s \<le> y) \<longrightarrow> (t + X + (-1)) \<le> y)" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1790 |
proof safe |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1791 |
fix x |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1792 |
assume "\<forall>s\<in>S. s \<le> x" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1793 |
hence "\<forall>s\<in>?SHIFT. s \<le> x + (-X) + 1" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1794 |
using S_Ub_is_SHIFT_Ub by simp |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1795 |
then have "\<not> x + (-X) + 1 < t" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1796 |
by (subst t_is_Lub[rule_format, symmetric]) (simp add: not_less) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1797 |
thus "t + X + -1 \<le> x" by arith |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1798 |
next |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1799 |
fix y |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1800 |
assume y_in_S: "y \<in> S" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1801 |
obtain "u" where u_in_shift: "u \<in> ?SHIFT" using shifted_not_empty .. |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1802 |
hence "\<exists> x \<in> S. u = x + - X + 1" by simp |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1803 |
then obtain "x" where x_and_u: "u = x + - X + 1" .. |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1804 |
have u_le_t: "u \<le> t" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1805 |
proof (rule dense_le) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1806 |
fix x assume "x < u" then have "x < t" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1807 |
using u_in_shift t_is_Lub by auto |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1808 |
then show "x \<le> t" by simp |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1809 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1810 |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1811 |
show "y \<le> t + X + -1" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1812 |
proof cases |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1813 |
assume "y \<le> x" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1814 |
moreover have "x = u + X + - 1" using x_and_u by arith |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1815 |
moreover have "u + X + - 1 \<le> t + X + -1" using u_le_t by arith |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1816 |
ultimately show "y \<le> t + X + -1" by arith |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1817 |
next |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1818 |
assume "~(y \<le> x)" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1819 |
hence x_less_y: "x < y" by arith |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1820 |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1821 |
have "x + (-X) + 1 \<in> ?SHIFT" using x_and_u and u_in_shift by simp |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1822 |
hence "0 < x + (-X) + 1" by simp |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1823 |
hence "0 < y + (-X) + 1" using x_less_y by arith |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1824 |
hence *: "y + (-X) + 1 \<in> ?SHIFT" using y_in_S by simp |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1825 |
have "y + (-X) + 1 \<le> t" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1826 |
proof (rule dense_le) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1827 |
fix x assume "x < y + (-X) + 1" then have "x < t" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1828 |
using * t_is_Lub by auto |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1829 |
then show "x \<le> t" by simp |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1830 |
qed |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1831 |
thus ?thesis by simp |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1832 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1833 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1834 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1835 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1836 |
|
61343 | 1837 |
subsection \<open>The Archimedean Property of the Reals\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1838 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1839 |
theorem reals_Archimedean: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1840 |
fixes x :: real |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1841 |
assumes x_pos: "0 < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1842 |
shows "\<exists>n. inverse (of_nat (Suc n)) < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1843 |
proof (rule ccontr) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1844 |
assume contr: "\<not> ?thesis" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1845 |
have "\<forall>n. x * of_nat (Suc n) \<le> 1" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1846 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1847 |
fix n |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1848 |
from contr have "x \<le> inverse (of_nat (Suc n))" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1849 |
by (simp add: linorder_not_less) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1850 |
hence "x \<le> (1 / (of_nat (Suc n)))" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1851 |
by (simp add: inverse_eq_divide) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1852 |
moreover have "(0::real) \<le> of_nat (Suc n)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1853 |
by (rule of_nat_0_le_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1854 |
ultimately have "x * of_nat (Suc n) \<le> (1 / of_nat (Suc n)) * of_nat (Suc n)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1855 |
by (rule mult_right_mono) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1856 |
thus "x * of_nat (Suc n) \<le> 1" by (simp del: of_nat_Suc) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1857 |
qed |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1858 |
hence 2: "bdd_above {z. \<exists>n. z = x * (of_nat (Suc n))}" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1859 |
by (auto intro!: bdd_aboveI[of _ 1]) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1860 |
have 1: "\<exists>X. X \<in> {z. \<exists>n. z = x* (of_nat (Suc n))}" by auto |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1861 |
obtain t where |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1862 |
upper: "\<And>z. z \<in> {z. \<exists>n. z = x * of_nat (Suc n)} \<Longrightarrow> z \<le> t" and |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1863 |
least: "\<And>y. (\<And>a. a \<in> {z. \<exists>n. z = x * of_nat (Suc n)} \<Longrightarrow> a \<le> y) \<Longrightarrow> t \<le> y" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1864 |
using reals_complete[OF 1 2] by auto |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1865 |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1866 |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1867 |
have "t \<le> t + - x" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1868 |
proof (rule least) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1869 |
fix a assume a: "a \<in> {z. \<exists>n. z = x * (of_nat (Suc n))}" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1870 |
have "\<forall>n::nat. x * of_nat n \<le> t + - x" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1871 |
proof |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1872 |
fix n |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1873 |
have "x * of_nat (Suc n) \<le> t" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1874 |
by (simp add: upper) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1875 |
hence "x * (of_nat n) + x \<le> t" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1876 |
by (simp add: distrib_left) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1877 |
thus "x * (of_nat n) \<le> t + - x" by arith |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1878 |
qed hence "\<forall>m. x * of_nat (Suc m) \<le> t + - x" by (simp del: of_nat_Suc) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1879 |
with a show "a \<le> t + - x" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1880 |
by auto |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1881 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1882 |
thus False using x_pos by arith |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1883 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1884 |
|
61343 | 1885 |
text \<open> |
61933 | 1886 |
There must be other proofs, e.g. \<open>Suc\<close> of the largest |
1887 |
integer in the cut representing \<open>x\<close>. |
|
61343 | 1888 |
\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1889 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1890 |
lemma reals_Archimedean2: "\<exists>n. (x::real) < of_nat (n::nat)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1891 |
proof cases |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1892 |
assume "x \<le> 0" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1893 |
hence "x < of_nat (1::nat)" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1894 |
thus ?thesis .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1895 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1896 |
assume "\<not> x \<le> 0" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1897 |
hence x_greater_zero: "0 < x" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1898 |
hence "0 < inverse x" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1899 |
then obtain n where "inverse (of_nat (Suc n)) < inverse x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1900 |
using reals_Archimedean by blast |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1901 |
hence "inverse (of_nat (Suc n)) * x < inverse x * x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1902 |
using x_greater_zero by (rule mult_strict_right_mono) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1903 |
hence "inverse (of_nat (Suc n)) * x < 1" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1904 |
using x_greater_zero by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1905 |
hence "of_nat (Suc n) * (inverse (of_nat (Suc n)) * x) < of_nat (Suc n) * 1" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1906 |
by (rule mult_strict_left_mono) (simp del: of_nat_Suc) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1907 |
hence "x < of_nat (Suc n)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1908 |
by (simp add: algebra_simps del: of_nat_Suc) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1909 |
thus "\<exists>(n::nat). x < of_nat n" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1910 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1911 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1912 |
instance real :: archimedean_field |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1913 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1914 |
fix r :: real |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1915 |
obtain n :: nat where "r < of_nat n" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1916 |
using reals_Archimedean2 .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1917 |
then have "r \<le> of_int (int n)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1918 |
by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1919 |
then show "\<exists>z. r \<le> of_int z" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1920 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1921 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1922 |
end |