author | desharna |
Thu, 08 Jul 2021 08:42:36 +0200 | |
changeset 73932 | fd21b4a93043 |
parent 73648 | 1bd3463e30b8 |
permissions | -rw-r--r-- |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1 |
section \<open>The Reals as Dedekind Sections of Positive Rationals\<close> |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
2 |
|
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
3 |
text \<open>Fundamentals of Abstract Analysis [Gleason- p. 121] provides some of the definitions.\<close> |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
4 |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
5 |
(* Title: HOL/ex/Dedekind_Real.thy |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
6 |
Author: Jacques D. Fleuriot, University of Cambridge |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
7 |
Conversion to Isar and new proofs by Lawrence C Paulson, 2003/4; 2019 |
36793
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 |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
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 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
14 |
text\<open>Could be moved to \<open>Groups\<close>\<close> |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
15 |
lemma add_eq_exists: "\<exists>x. a+x = (b::'a::ab_group_add)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
16 |
by (rule_tac x="b-a" in exI, simp) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
17 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
18 |
subsection \<open>Dedekind cuts or sections\<close> |
36793
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 |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
21 |
cut :: "rat set \<Rightarrow> bool" where |
70200 | 22 |
"cut A \<equiv> {} \<subset> A \<and> A \<subset> {0<..} \<and> |
23 |
(\<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
|
24 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
25 |
lemma cut_of_rat: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
26 |
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
|
27 |
proof - |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
28 |
from q have pos: "?A \<subset> {0<..}" by force |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
29 |
have nonempty: "{} \<subset> ?A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
30 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
31 |
show "{} \<subseteq> ?A" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
32 |
show "{} \<noteq> ?A" |
70200 | 33 |
using field_lbound_gt_zero q by auto |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
34 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
35 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
36 |
by (simp add: cut_def pos nonempty, |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
37 |
blast dest: dense intro: order_less_trans) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
38 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
39 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
40 |
|
59814 | 41 |
typedef preal = "Collect cut" |
42 |
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
|
43 |
|
59814 | 44 |
lemma Abs_preal_induct [induct type: preal]: |
45 |
"(\<And>x. cut x \<Longrightarrow> P (Abs_preal x)) \<Longrightarrow> P x" |
|
46 |
using Abs_preal_induct [of P x] by simp |
|
47 |
||
70200 | 48 |
lemma cut_Rep_preal [simp]: "cut (Rep_preal x)" |
59814 | 49 |
using Rep_preal [of x] by simp |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
50 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
51 |
definition |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
52 |
psup :: "preal set \<Rightarrow> preal" where |
37765 | 53 |
"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
|
54 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
55 |
definition |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
56 |
add_set :: "[rat set,rat set] \<Rightarrow> rat set" where |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
57 |
"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
|
58 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
59 |
definition |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
60 |
diff_set :: "[rat set,rat set] \<Rightarrow> rat set" where |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
61 |
"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
|
62 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
63 |
definition |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
64 |
mult_set :: "[rat set,rat set] \<Rightarrow> rat set" where |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
65 |
"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
|
66 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
67 |
definition |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
68 |
inverse_set :: "rat set \<Rightarrow> rat set" where |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
69 |
"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
|
70 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
71 |
instantiation preal :: "{ord, plus, minus, times, inverse, one}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
72 |
begin |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
73 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
74 |
definition |
37765 | 75 |
preal_less_def: |
70201 | 76 |
"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
|
77 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
78 |
definition |
37765 | 79 |
preal_le_def: |
70201 | 80 |
"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
|
81 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
82 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
83 |
preal_add_def: |
70201 | 84 |
"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
|
85 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
86 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
87 |
preal_diff_def: |
70201 | 88 |
"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
|
89 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
90 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
91 |
preal_mult_def: |
70201 | 92 |
"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
|
93 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
94 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
95 |
preal_inverse_def: |
70201 | 96 |
"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
|
97 |
|
70201 | 98 |
definition "r div s = r * inverse (s::preal)" |
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_one_def: |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
102 |
"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
|
103 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
104 |
instance .. |
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 |
end |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
107 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
108 |
|
61343 | 109 |
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
|
110 |
declare Abs_preal_inject [simp] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
111 |
declare Abs_preal_inverse [simp] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
112 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
113 |
lemma rat_mem_preal: "0 < q \<Longrightarrow> cut {r::rat. 0 < r \<and> r < q}" |
59814 | 114 |
by (simp add: cut_of_rat) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
115 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
116 |
lemma preal_nonempty: "cut A \<Longrightarrow> \<exists>x\<in>A. 0 < x" |
59814 | 117 |
unfolding cut_def [abs_def] by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
118 |
|
59814 | 119 |
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
|
120 |
using preal_nonempty by blast |
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_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
|
123 |
using Dedekind_Real.cut_def by fastforce |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
124 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
125 |
lemma preal_exists_greater: "\<lbrakk>cut A; y \<in> A\<rbrakk> \<Longrightarrow> \<exists>u \<in> A. y < u" |
59814 | 126 |
unfolding cut_def [abs_def] 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_downwards_closed: "\<lbrakk>cut A; y \<in> A; 0 < z; z < y\<rbrakk> \<Longrightarrow> z \<in> A" |
59814 | 129 |
unfolding cut_def [abs_def] by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
130 |
|
61343 | 131 |
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
|
132 |
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
|
133 |
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
|
134 |
|
61343 | 135 |
text\<open>A positive fraction not in a positive real is an upper bound. |
136 |
Gleason p. 122 - Remark (1)\<close> |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
137 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
138 |
lemma not_in_preal_ub: |
59814 | 139 |
assumes A: "cut A" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
140 |
and notx: "x \<notin> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
141 |
and y: "y \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
142 |
and pos: "0 < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
143 |
shows "y < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
144 |
proof (cases rule: linorder_cases) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
145 |
assume "x<y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
146 |
with notx show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
147 |
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
|
148 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
149 |
assume "x=y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
150 |
with notx and y show ?thesis by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
151 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
152 |
assume "y<x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
153 |
thus ?thesis . |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
154 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
155 |
|
69597 | 156 |
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
|
157 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
158 |
lemma mem_Rep_preal_Ex: "\<exists>x. x \<in> Rep_preal X" |
59814 | 159 |
thm preal_Ex_mem |
70200 | 160 |
by (rule preal_Ex_mem [OF cut_Rep_preal]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
161 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
162 |
lemma Rep_preal_exists_bound: "\<exists>x>0. x \<notin> Rep_preal X" |
70200 | 163 |
by (rule preal_exists_bound [OF cut_Rep_preal]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
164 |
|
70200 | 165 |
lemmas not_in_Rep_preal_ub = not_in_preal_ub [OF cut_Rep_preal] |
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 |
|
61343 | 168 |
subsection\<open>Properties of Ordering\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
169 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
170 |
instance preal :: order |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
171 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
172 |
fix w :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
173 |
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
|
174 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
175 |
fix i j k :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
176 |
assume "i \<le> j" and "j \<le> k" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
177 |
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
|
178 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
179 |
fix z w :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
180 |
assume "z \<le> w" and "w \<le> z" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
181 |
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
|
182 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
183 |
fix z w :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
184 |
show "z < w \<longleftrightarrow> z \<le> w \<and> \<not> w \<le> z" |
70200 | 185 |
by (auto simp: preal_le_def preal_less_def Rep_preal_inject) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
186 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
187 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
188 |
lemma preal_imp_pos: "\<lbrakk>cut A; r \<in> A\<rbrakk> \<Longrightarrow> 0 < r" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
189 |
by (auto simp: cut_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
190 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
191 |
instance preal :: linorder |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
192 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
193 |
fix x y :: preal |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
194 |
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
|
195 |
unfolding preal_le_def |
70200 | 196 |
by (meson cut_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
|
197 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
198 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
199 |
instantiation preal :: distrib_lattice |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
200 |
begin |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
201 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
202 |
definition |
61076 | 203 |
"(inf :: preal \<Rightarrow> preal \<Rightarrow> preal) = min" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
204 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
205 |
definition |
61076 | 206 |
"(sup :: preal \<Rightarrow> preal \<Rightarrow> preal) = max" |
36793
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 |
instance |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
209 |
by intro_classes |
70200 | 210 |
(auto simp: 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
|
211 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
212 |
end |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
213 |
|
61343 | 214 |
subsection\<open>Properties of Addition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
215 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
216 |
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
|
217 |
unfolding preal_add_def add_set_def |
73932
fd21b4a93043
added opaque_combs and renamed hide_lams to opaque_lifting
desharna
parents:
73648
diff
changeset
|
218 |
by (metis (no_types, opaque_lifting) add.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
219 |
|
61343 | 220 |
text\<open>Lemmas for proving that addition of two positive reals gives |
221 |
a positive real\<close> |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
222 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
223 |
lemma mem_add_set: |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
224 |
assumes "cut A" "cut B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
225 |
shows "cut (add_set A B)" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
226 |
proof - |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
227 |
have "{} \<subset> add_set A B" |
70200 | 228 |
using assms by (force simp: add_set_def dest: preal_nonempty) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
229 |
moreover |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
230 |
obtain q where "q > 0" "q \<notin> add_set A B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
231 |
proof - |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
232 |
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" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
233 |
by (meson assms preal_exists_bound not_in_preal_ub) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
234 |
with assms have "a+b \<notin> add_set A B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
235 |
by (fastforce simp add: add_set_def) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
236 |
then show thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
237 |
using \<open>0 < a\<close> \<open>0 < b\<close> add_pos_pos that by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
238 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
239 |
then have "add_set A B \<subset> {0<..}" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
240 |
unfolding add_set_def |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
241 |
using preal_imp_pos [OF \<open>cut A\<close>] preal_imp_pos [OF \<open>cut B\<close>] by fastforce |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
242 |
moreover have "z \<in> add_set A B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
243 |
if u: "u \<in> add_set A B" and "0 < z" "z < u" for u z |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
244 |
using u unfolding add_set_def |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
245 |
proof (clarify) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
246 |
fix x::rat and y::rat |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
247 |
assume ueq: "u = x + y" and x: "x \<in> A" and y:"y \<in> B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
248 |
have xpos [simp]: "x > 0" and ypos [simp]: "y > 0" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
249 |
using assms preal_imp_pos x y by blast+ |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
250 |
have xypos [simp]: "x+y > 0" by (simp add: pos_add_strict) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
251 |
let ?f = "z/(x+y)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
252 |
have fless: "?f < 1" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
253 |
using divide_less_eq_1_pos \<open>z < u\<close> ueq xypos by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
254 |
show "\<exists>x' \<in> A. \<exists>y'\<in>B. z = x' + y'" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
255 |
proof (intro bexI) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
256 |
show "z = x*?f + y*?f" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
257 |
by (simp add: distrib_right [symmetric] divide_inverse ac_simps order_less_imp_not_eq2) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
258 |
next |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
259 |
show "y * ?f \<in> B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
260 |
proof (rule preal_downwards_closed [OF \<open>cut B\<close> y]) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
261 |
show "0 < y * ?f" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
262 |
by (simp add: \<open>0 < z\<close>) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
263 |
next |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
264 |
show "y * ?f < y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
265 |
by (insert mult_strict_left_mono [OF fless ypos], simp) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
266 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
267 |
next |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
268 |
show "x * ?f \<in> A" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
269 |
proof (rule preal_downwards_closed [OF \<open>cut A\<close> x]) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
270 |
show "0 < x * ?f" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
271 |
by (simp add: \<open>0 < z\<close>) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
272 |
next |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
273 |
show "x * ?f < x" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
274 |
by (insert mult_strict_left_mono [OF fless xpos], simp) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
275 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
276 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
277 |
qed |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
278 |
moreover |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
279 |
have "\<And>y. y \<in> add_set A B \<Longrightarrow> \<exists>u \<in> add_set A B. y < u" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
280 |
unfolding add_set_def using preal_exists_greater assms by fastforce |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
281 |
ultimately show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
282 |
by (simp add: Dedekind_Real.cut_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
283 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
284 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
285 |
lemma preal_add_assoc: "((x::preal) + y) + z = x + (y + z)" |
70201 | 286 |
apply (simp add: preal_add_def mem_add_set) |
70200 | 287 |
apply (force simp: add_set_def ac_simps) |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
288 |
done |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
289 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
290 |
instance preal :: ab_semigroup_add |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
291 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
292 |
fix a b c :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
293 |
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
|
294 |
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
|
295 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
296 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
297 |
|
61343 | 298 |
subsection\<open>Properties of Multiplication\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
299 |
|
61343 | 300 |
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
|
301 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
302 |
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
|
303 |
unfolding preal_mult_def mult_set_def |
73932
fd21b4a93043
added opaque_combs and renamed hide_lams to opaque_lifting
desharna
parents:
73648
diff
changeset
|
304 |
by (metis (no_types, opaque_lifting) mult.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
305 |
|
61343 | 306 |
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
|
307 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
308 |
lemma mem_mult_set: |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
309 |
assumes "cut A" "cut B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
310 |
shows "cut (mult_set A B)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
311 |
proof - |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
312 |
have "{} \<subset> mult_set A B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
313 |
using assms |
70200 | 314 |
by (force simp: mult_set_def dest: preal_nonempty) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
315 |
moreover |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
316 |
obtain q where "q > 0" "q \<notin> mult_set A B" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
317 |
proof - |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
318 |
obtain x y where x [simp]: "0 < x" "x \<notin> A" and y [simp]: "0 < y" "y \<notin> B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
319 |
using preal_exists_bound assms by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
320 |
show thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
321 |
proof |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
322 |
show "0 < x*y" by simp |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
323 |
show "x * y \<notin> mult_set A B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
324 |
proof - |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
325 |
{ |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
326 |
fix u::rat and v::rat |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
327 |
assume u: "u \<in> A" and v: "v \<in> B" and xy: "x*y = u*v" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
328 |
moreover have "u<x" and "v<y" using assms x y u v by (blast dest: not_in_preal_ub)+ |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
329 |
moreover have "0\<le>v" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
330 |
using less_imp_le preal_imp_pos assms x y u v by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
331 |
moreover have "u*v < x*y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
332 |
using assms x \<open>u < x\<close> \<open>v < y\<close> \<open>0 \<le> v\<close> by (blast intro: mult_strict_mono) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
333 |
ultimately have False by force |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
334 |
} |
70200 | 335 |
thus ?thesis by (auto simp: mult_set_def) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
336 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
337 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
338 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
339 |
then have "mult_set A B \<subset> {0<..}" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
340 |
unfolding mult_set_def |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
341 |
using preal_imp_pos [OF \<open>cut A\<close>] preal_imp_pos [OF \<open>cut B\<close>] by fastforce |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
342 |
moreover have "z \<in> mult_set A B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
343 |
if u: "u \<in> mult_set A B" and "0 < z" "z < u" for u z |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
344 |
using u unfolding mult_set_def |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
345 |
proof (clarify) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
346 |
fix x::rat and y::rat |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
347 |
assume ueq: "u = x * y" and x: "x \<in> A" and y: "y \<in> B" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
348 |
have [simp]: "y > 0" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
349 |
using \<open>cut B\<close> preal_imp_pos y by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
350 |
show "\<exists>x' \<in> A. \<exists>y' \<in> B. z = x' * y'" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
351 |
proof |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
352 |
have "z = (z/y)*y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
353 |
by (simp add: divide_inverse mult.commute [of y] mult.assoc order_less_imp_not_eq2) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
354 |
then show "\<exists>y'\<in>B. z = (z/y) * y'" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
355 |
using y by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
356 |
next |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
357 |
show "z/y \<in> A" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
358 |
proof (rule preal_downwards_closed [OF \<open>cut A\<close> x]) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
359 |
show "0 < z/y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
360 |
by (simp add: \<open>0 < z\<close>) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
361 |
show "z/y < x" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
362 |
using \<open>0 < y\<close> pos_divide_less_eq \<open>z < u\<close> ueq by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
363 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
364 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
365 |
qed |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
366 |
moreover have "\<And>y. y \<in> mult_set A B \<Longrightarrow> \<exists>u \<in> mult_set A B. y < u" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
367 |
apply (simp add: mult_set_def) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
368 |
by (metis preal_exists_greater mult_strict_right_mono preal_imp_pos assms) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
369 |
ultimately show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
370 |
by (simp add: Dedekind_Real.cut_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
371 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
372 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
373 |
lemma preal_mult_assoc: "((x::preal) * y) * z = x * (y * z)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
374 |
apply (simp add: preal_mult_def mem_mult_set Rep_preal) |
73648 | 375 |
apply (simp add: mult_set_def) |
73932
fd21b4a93043
added opaque_combs and renamed hide_lams to opaque_lifting
desharna
parents:
73648
diff
changeset
|
376 |
apply (metis (no_types, opaque_lifting) ab_semigroup_mult_class.mult_ac(1)) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
377 |
done |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
378 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
379 |
instance preal :: ab_semigroup_mult |
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 |
fix a b c :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
382 |
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
|
383 |
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
|
384 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
385 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
386 |
|
61343 | 387 |
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
|
388 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
389 |
lemma preal_mult_1: "(1::preal) * z = z" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
390 |
proof (induct z) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
391 |
fix A :: "rat set" |
59814 | 392 |
assume A: "cut A" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
393 |
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
|
394 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
395 |
show "?lhs \<subseteq> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
396 |
proof clarify |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
397 |
fix x::rat and u::rat and v::rat |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
398 |
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
|
399 |
have vpos: "0<v" by (rule preal_imp_pos [OF A v]) |
61343 | 400 |
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
|
401 |
thus "u * v \<in> A" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
402 |
by (force intro: preal_downwards_closed [OF A v] mult_pos_pos upos vpos) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
403 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
404 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
405 |
show "A \<subseteq> ?lhs" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
406 |
proof clarify |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
407 |
fix x::rat |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
408 |
assume x: "x \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
409 |
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
|
410 |
from preal_exists_greater [OF A x] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
411 |
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
|
412 |
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
|
413 |
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
|
414 |
proof (intro exI conjI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
415 |
show "0 < x/v" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
416 |
by (simp add: zero_less_divide_iff xpos vpos) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
417 |
show "x / v < 1" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
418 |
by (simp add: pos_divide_less_eq vpos xlessv) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
419 |
have "x = (x/v)*v" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
420 |
by (simp add: divide_inverse mult.assoc vpos order_less_imp_not_eq2) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
421 |
then show "\<exists>v'\<in>A. x = (x / v) * v'" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
422 |
using v by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
423 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
424 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
425 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
426 |
thus "1 * Abs_preal A = Abs_preal A" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
427 |
by (simp add: preal_one_def preal_mult_def mult_set_def rat_mem_preal A) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
428 |
qed |
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 |
instance preal :: comm_monoid_mult |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
431 |
by intro_classes (rule preal_mult_1) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
432 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
433 |
|
61343 | 434 |
subsection\<open>Distribution of Multiplication across Addition\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
435 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
436 |
lemma mem_Rep_preal_add_iff: |
70201 | 437 |
"(z \<in> Rep_preal(r+s)) = (\<exists>x \<in> Rep_preal r. \<exists>y \<in> Rep_preal s. z = x + y)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
438 |
apply (simp add: preal_add_def mem_add_set Rep_preal) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
439 |
apply (simp add: add_set_def) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
440 |
done |
36793
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 |
lemma mem_Rep_preal_mult_iff: |
70201 | 443 |
"(z \<in> Rep_preal(r*s)) = (\<exists>x \<in> Rep_preal r. \<exists>y \<in> Rep_preal s. z = x * y)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
444 |
apply (simp add: preal_mult_def mem_mult_set Rep_preal) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
445 |
apply (simp add: mult_set_def) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
446 |
done |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
447 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
448 |
lemma distrib_subset1: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
449 |
"Rep_preal (w * (x + y)) \<subseteq> Rep_preal (w * x + w * y)" |
70200 | 450 |
by (force simp: Bex_def mem_Rep_preal_add_iff mem_Rep_preal_mult_iff distrib_left) |
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_add_mult_distrib_mean: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
453 |
assumes a: "a \<in> Rep_preal w" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
454 |
and b: "b \<in> Rep_preal w" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
455 |
and d: "d \<in> Rep_preal x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
456 |
and e: "e \<in> Rep_preal y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
457 |
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
|
458 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
459 |
let ?c = "(a*d + b*e)/(d+e)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
460 |
have [simp]: "0<a" "0<b" "0<d" "0<e" "0<d+e" |
70200 | 461 |
by (blast intro: preal_imp_pos [OF cut_Rep_preal] a b d e pos_add_strict)+ |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
462 |
have cpos: "0 < ?c" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
463 |
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
|
464 |
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
|
465 |
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
|
466 |
show "?c \<in> Rep_preal w" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
467 |
proof (cases rule: linorder_le_cases) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
468 |
assume "a \<le> b" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
469 |
hence "?c \<le> b" |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
49834
diff
changeset
|
470 |
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
|
471 |
order_less_imp_le) |
70200 | 472 |
thus ?thesis by (rule preal_downwards_closed' [OF cut_Rep_preal b cpos]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
473 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
474 |
assume "b \<le> a" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
475 |
hence "?c \<le> a" |
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
49834
diff
changeset
|
476 |
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
|
477 |
order_less_imp_le) |
70200 | 478 |
thus ?thesis by (rule preal_downwards_closed' [OF cut_Rep_preal a cpos]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
479 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
480 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
481 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
482 |
lemma distrib_subset2: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
483 |
"Rep_preal (w * x + w * y) \<subseteq> Rep_preal (w * (x + y))" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
484 |
apply (clarsimp simp: mem_Rep_preal_add_iff mem_Rep_preal_mult_iff) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
485 |
using mem_Rep_preal_add_iff preal_add_mult_distrib_mean by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
486 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
487 |
lemma preal_add_mult_distrib2: "(w * ((x::preal) + y)) = (w * x) + (w * y)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
488 |
by (metis Rep_preal_inverse distrib_subset1 distrib_subset2 subset_antisym) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
489 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
490 |
lemma preal_add_mult_distrib: "(((x::preal) + y) * w) = (x * w) + (y * w)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
491 |
by (simp add: preal_mult_commute preal_add_mult_distrib2) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
492 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
493 |
instance preal :: comm_semiring |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
494 |
by intro_classes (rule preal_add_mult_distrib) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
495 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
496 |
|
61343 | 497 |
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
|
498 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
499 |
lemma mem_inverse_set: |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
500 |
assumes "cut A" shows "cut (inverse_set A)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
501 |
proof - |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
502 |
have "\<exists>x y. 0 < x \<and> x < y \<and> inverse y \<notin> A" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
503 |
proof - |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
504 |
from preal_exists_bound [OF \<open>cut A\<close>] |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
505 |
obtain x where [simp]: "0<x" "x \<notin> A" by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
506 |
show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
507 |
proof (intro exI conjI) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
508 |
show "0 < inverse (x+1)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
509 |
by (simp add: order_less_trans [OF _ less_add_one]) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
510 |
show "inverse(x+1) < inverse x" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
511 |
by (simp add: less_imp_inverse_less less_add_one) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
512 |
show "inverse (inverse x) \<notin> A" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
513 |
by (simp add: order_less_imp_not_eq2) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
514 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
515 |
qed |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
516 |
then have "{} \<subset> inverse_set A" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
517 |
using inverse_set_def by fastforce |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
518 |
moreover obtain q where "q > 0" "q \<notin> inverse_set A" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
519 |
proof - |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
520 |
from preal_nonempty [OF \<open>cut A\<close>] |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
521 |
obtain x where x: "x \<in> A" and xpos [simp]: "0<x" .. |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
522 |
show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
523 |
proof |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
524 |
show "0 < inverse x" by simp |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
525 |
show "inverse x \<notin> inverse_set A" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
526 |
proof - |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
527 |
{ fix y::rat |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
528 |
assume ygt: "inverse x < y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
529 |
have [simp]: "0 < y" by (simp add: order_less_trans [OF _ ygt]) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
530 |
have iyless: "inverse y < x" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
531 |
by (simp add: inverse_less_imp_less [of x] ygt) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
532 |
have "inverse y \<in> A" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
533 |
by (simp add: preal_downwards_closed [OF \<open>cut A\<close> x] iyless)} |
70200 | 534 |
thus ?thesis by (auto simp: inverse_set_def) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
535 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
536 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
537 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
538 |
moreover have "inverse_set A \<subset> {0<..}" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
539 |
using calculation inverse_set_def by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
540 |
moreover have "z \<in> inverse_set A" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
541 |
if u: "u \<in> inverse_set A" and "0 < z" "z < u" for u z |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
542 |
using u that less_trans unfolding inverse_set_def by auto |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
543 |
moreover have "\<And>y. y \<in> inverse_set A \<Longrightarrow> \<exists>u \<in> inverse_set A. y < u" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
544 |
by (simp add: inverse_set_def) (meson dense less_trans) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
545 |
ultimately show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
546 |
by (simp add: Dedekind_Real.cut_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
547 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
548 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
549 |
|
61343 | 550 |
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
|
551 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
552 |
lemma Gleason9_34_exists: |
59814 | 553 |
assumes A: "cut A" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
554 |
and "\<forall>x\<in>A. x + u \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
555 |
and "0 \<le> z" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
556 |
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
|
557 |
proof (cases z rule: int_cases) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
558 |
case (nonneg n) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
559 |
show ?thesis |
41541 | 560 |
proof (simp add: nonneg, induct n) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
561 |
case 0 |
41541 | 562 |
from preal_nonempty [OF A] |
563 |
show ?case by force |
|
564 |
next |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
565 |
case (Suc k) |
41541 | 566 |
then obtain b where b: "b \<in> A" "b + of_nat k * u \<in> A" .. |
567 |
hence "b + of_int (int k)*u + u \<in> A" by (simp add: assms) |
|
70200 | 568 |
thus ?case by (force simp: algebra_simps b) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
569 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
570 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
571 |
case (neg n) |
41541 | 572 |
with assms show ?thesis by simp |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
573 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
574 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
575 |
lemma Gleason9_34_contra: |
59814 | 576 |
assumes A: "cut A" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
577 |
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
|
578 |
proof (induct u, induct y) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
579 |
fix a::int and b::int |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
580 |
fix c::int and d::int |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
581 |
assume bpos [simp]: "0 < b" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
582 |
and dpos [simp]: "0 < d" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
583 |
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
|
584 |
and upos: "0 < Fract c d" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
585 |
and ypos: "0 < Fract a b" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
586 |
and notin: "Fract a b \<notin> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
587 |
have cpos [simp]: "0 < c" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
588 |
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
|
589 |
have apos [simp]: "0 < a" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
590 |
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
|
591 |
let ?k = "a*d" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
592 |
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
|
593 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
594 |
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
|
595 |
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
|
596 |
moreover |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
597 |
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
|
598 |
by (rule mult_mono, |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
599 |
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
|
600 |
order_less_imp_le) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
601 |
ultimately |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
602 |
show ?thesis by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
603 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
604 |
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
|
605 |
from Gleason9_34_exists [OF A closed k] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
606 |
obtain z where z: "z \<in> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
607 |
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
|
608 |
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
|
609 |
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
|
610 |
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
|
611 |
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
|
612 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
613 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
614 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
615 |
lemma Gleason9_34: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
616 |
assumes "cut A" "0 < u" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
617 |
shows "\<exists>r \<in> A. r + u \<notin> A" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
618 |
using assms Gleason9_34_contra preal_exists_bound by blast |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
619 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
620 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
621 |
|
61343 | 622 |
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
|
623 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
624 |
lemma lemma_gleason9_36: |
59814 | 625 |
assumes A: "cut A" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
626 |
and x: "1 < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
627 |
shows "\<exists>r \<in> A. r*x \<notin> A" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
628 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
629 |
from preal_nonempty [OF A] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
630 |
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
|
631 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
632 |
proof (rule classical) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
633 |
assume "~(\<exists>r\<in>A. r * x \<notin> A)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
634 |
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
|
635 |
from ypos mult_strict_left_mono [OF x] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
636 |
have yless: "y < y*x" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
637 |
let ?d = "y*x - y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
638 |
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
|
639 |
from Gleason9_34 [OF A dpos] |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
640 |
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
|
641 |
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
|
642 |
with dpos have rdpos: "0 < r + ?d" by arith |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
643 |
have "~ (r + ?d \<le> y + ?d)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
644 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
645 |
assume le: "r + ?d \<le> y + ?d" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
646 |
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
|
647 |
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
|
648 |
with notin show False by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
649 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
650 |
hence "y < r" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
651 |
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
|
652 |
using dpos less_divide_eq_1 by fastforce |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
653 |
have "r + ?d < r*x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
654 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
655 |
have "r + ?d < r + (r * ?d)/y" by (simp add: dless) |
70200 | 656 |
also from ypos have "\<dots> = (r/y) * (y + ?d)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
657 |
by (simp only: algebra_simps divide_inverse, simp) |
70200 | 658 |
also have "\<dots> = r*x" using ypos |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
659 |
by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
660 |
finally show "r + ?d < r*x" . |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
661 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
662 |
with r notin rdpos |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
663 |
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
|
664 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
665 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
666 |
|
61343 | 667 |
subsection\<open>Existence of Inverse: Part 2\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
668 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
669 |
lemma mem_Rep_preal_inverse_iff: |
70201 | 670 |
"(z \<in> Rep_preal(inverse r)) \<longleftrightarrow> (0 < z \<and> (\<exists>y. z < y \<and> inverse y \<notin> Rep_preal r))" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
671 |
apply (simp add: preal_inverse_def mem_inverse_set Rep_preal) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
672 |
apply (simp add: inverse_set_def) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
673 |
done |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
674 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
675 |
lemma Rep_preal_one: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
676 |
"Rep_preal 1 = {x. 0 < x \<and> x < 1}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
677 |
by (simp add: preal_one_def rat_mem_preal) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
678 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
679 |
lemma subset_inverse_mult_lemma: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
680 |
assumes xpos: "0 < x" and xless: "x < 1" |
70201 | 681 |
shows "\<exists>v u y. 0 < v \<and> v < y \<and> inverse y \<notin> Rep_preal R \<and> |
682 |
u \<in> Rep_preal R \<and> x = v * u" |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
683 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
684 |
from xpos and xless have "1 < inverse x" by (simp add: one_less_inverse_iff) |
70200 | 685 |
from lemma_gleason9_36 [OF cut_Rep_preal this] |
70201 | 686 |
obtain t where t: "t \<in> Rep_preal R" |
687 |
and notin: "t * (inverse x) \<notin> Rep_preal R" .. |
|
688 |
have rpos: "0<t" by (rule preal_imp_pos [OF cut_Rep_preal t]) |
|
689 |
from preal_exists_greater [OF cut_Rep_preal t] |
|
690 |
obtain u where u: "u \<in> Rep_preal R" and rless: "t < u" .. |
|
70200 | 691 |
have upos: "0<u" by (rule preal_imp_pos [OF cut_Rep_preal u]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
692 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
693 |
proof (intro exI conjI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
694 |
show "0 < x/u" using xpos upos |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
695 |
by (simp add: zero_less_divide_iff) |
70201 | 696 |
show "x/u < x/t" using xpos upos rpos |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
697 |
by (simp add: divide_inverse mult_less_cancel_left rless) |
70201 | 698 |
show "inverse (x / t) \<notin> Rep_preal R" using notin |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
699 |
by (simp add: divide_inverse mult.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
700 |
show "u \<in> Rep_preal R" by (rule u) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
701 |
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
|
702 |
by (simp add: divide_inverse mult.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
703 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
704 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
705 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
706 |
lemma subset_inverse_mult: |
70201 | 707 |
"Rep_preal 1 \<subseteq> Rep_preal(inverse r * r)" |
70200 | 708 |
by (force simp: Rep_preal_one mem_Rep_preal_inverse_iff mem_Rep_preal_mult_iff dest: subset_inverse_mult_lemma) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
709 |
|
70201 | 710 |
lemma inverse_mult_subset: "Rep_preal(inverse r * r) \<subseteq> Rep_preal 1" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
711 |
proof - |
70201 | 712 |
have "0 < u * v" if "v \<in> Rep_preal r" "0 < u" "u < t" for u v t :: rat |
70200 | 713 |
using that by (simp add: zero_less_mult_iff preal_imp_pos [OF cut_Rep_preal]) |
70201 | 714 |
moreover have "t * q < 1" |
715 |
if "q \<in> Rep_preal r" "0 < t" "t < y" "inverse y \<notin> Rep_preal r" |
|
716 |
for t q y :: rat |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
717 |
proof - |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
718 |
have "q < inverse y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
719 |
using not_in_Rep_preal_ub that by auto |
70201 | 720 |
hence "t * q < t/y" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
721 |
using that by (simp add: divide_inverse mult_less_cancel_left) |
70200 | 722 |
also have "\<dots> \<le> 1" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
723 |
using that by (simp add: pos_divide_le_eq) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
724 |
finally show ?thesis . |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
725 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
726 |
ultimately show ?thesis |
70200 | 727 |
by (auto simp: Rep_preal_one mem_Rep_preal_inverse_iff mem_Rep_preal_mult_iff) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
728 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
729 |
|
70201 | 730 |
lemma preal_mult_inverse: "inverse r * r = (1::preal)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
731 |
by (meson Rep_preal_inject inverse_mult_subset subset_antisym subset_inverse_mult) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
732 |
|
70201 | 733 |
lemma preal_mult_inverse_right: "r * inverse r = (1::preal)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
734 |
using preal_mult_commute preal_mult_inverse by auto |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
735 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
736 |
|
61933 | 737 |
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
|
738 |
|
70201 | 739 |
lemma Rep_preal_self_subset: "Rep_preal (r) \<subseteq> Rep_preal(r + s)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
740 |
proof |
70201 | 741 |
fix x |
742 |
assume x: "x \<in> Rep_preal r" |
|
743 |
obtain y where y: "y \<in> Rep_preal s" and "y > 0" |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
744 |
using Rep_preal preal_nonempty by blast |
70201 | 745 |
have ry: "x+y \<in> Rep_preal(r + s)" using x y |
70200 | 746 |
by (auto simp: mem_Rep_preal_add_iff) |
70201 | 747 |
then show "x \<in> Rep_preal(r + s)" |
748 |
by (meson \<open>0 < y\<close> add_less_same_cancel1 not_in_Rep_preal_ub order.asym preal_imp_pos [OF cut_Rep_preal x]) |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
749 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
750 |
|
70201 | 751 |
lemma Rep_preal_sum_not_subset: "~ Rep_preal (r + s) \<subseteq> Rep_preal(r)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
752 |
proof - |
70201 | 753 |
obtain y where y: "y \<in> Rep_preal s" and "y > 0" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
754 |
using Rep_preal preal_nonempty by blast |
70201 | 755 |
obtain x where "x \<in> Rep_preal r" and notin: "x + y \<notin> Rep_preal r" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
756 |
using Dedekind_Real.Rep_preal Gleason9_34 \<open>0 < y\<close> by blast |
70201 | 757 |
then have "x + y \<in> Rep_preal (r + s)" using y |
70200 | 758 |
by (auto simp: mem_Rep_preal_add_iff) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
759 |
thus ?thesis using notin by blast |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
760 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
761 |
|
61343 | 762 |
text\<open>at last, Gleason prop. 9-3.5(iii) page 123\<close> |
70201 | 763 |
proposition preal_self_less_add_left: "(r::preal) < r + s" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
764 |
by (meson Rep_preal_sum_not_subset not_less preal_le_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
765 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
766 |
|
61343 | 767 |
subsection\<open>Subtraction for Positive Reals\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
768 |
|
70201 | 769 |
text\<open>gleason prop. 9-3.5(iv), page 123: proving \<^prop>\<open>a < b \<Longrightarrow> \<exists>d. a + d = b\<close>. |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
770 |
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
|
771 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
772 |
lemma mem_diff_set: |
70201 | 773 |
assumes "r < s" |
774 |
shows "cut (diff_set (Rep_preal s) (Rep_preal r))" |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
775 |
proof - |
70201 | 776 |
obtain p where "Rep_preal r \<subseteq> Rep_preal s" "p \<in> Rep_preal s" "p \<notin> Rep_preal r" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
777 |
using assms unfolding preal_less_def by auto |
70201 | 778 |
then have "{} \<subset> diff_set (Rep_preal s) (Rep_preal r)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
779 |
apply (simp add: diff_set_def psubset_eq) |
70200 | 780 |
by (metis cut_Rep_preal add_eq_exists less_add_same_cancel1 preal_exists_greater preal_imp_pos) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
781 |
moreover |
70201 | 782 |
obtain q where "q > 0" "q \<notin> Rep_preal s" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
783 |
using Rep_preal_exists_bound by blast |
70201 | 784 |
then have qnot: "q \<notin> diff_set (Rep_preal s) (Rep_preal r)" |
70200 | 785 |
by (auto simp: diff_set_def dest: cut_Rep_preal [THEN preal_downwards_closed]) |
70201 | 786 |
moreover have "diff_set (Rep_preal s) (Rep_preal r) \<subset> {0<..}" (is "?lhs < ?rhs") |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
787 |
using \<open>0 < q\<close> diff_set_def qnot by blast |
70201 | 788 |
moreover have "z \<in> diff_set (Rep_preal s) (Rep_preal r)" |
789 |
if u: "u \<in> diff_set (Rep_preal s) (Rep_preal r)" and "0 < z" "z < u" for u z |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
790 |
using u that less_trans Rep_preal unfolding diff_set_def Dedekind_Real.cut_def by auto |
70201 | 791 |
moreover have "\<exists>u \<in> diff_set (Rep_preal s) (Rep_preal r). y < u" |
792 |
if y: "y \<in> diff_set (Rep_preal s) (Rep_preal r)" for y |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
793 |
proof - |
70201 | 794 |
obtain a b where "0 < a" "0 < b" "a \<notin> Rep_preal r" "a + y + b \<in> Rep_preal s" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
795 |
using y |
70200 | 796 |
by (simp add: diff_set_def) (metis cut_Rep_preal add_eq_exists less_add_same_cancel1 preal_exists_greater) |
70201 | 797 |
then have "a + (y + b) \<in> Rep_preal s" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
798 |
by (simp add: add.assoc) |
70201 | 799 |
then have "y + b \<in> diff_set (Rep_preal s) (Rep_preal r)" |
800 |
using \<open>0 < a\<close> \<open>0 < b\<close> \<open>a \<notin> Rep_preal r\<close> y |
|
70200 | 801 |
by (auto simp: diff_set_def) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
802 |
then show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
803 |
using \<open>0 < b\<close> less_add_same_cancel1 by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
804 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
805 |
ultimately show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
806 |
by (simp add: Dedekind_Real.cut_def) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
807 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
808 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
809 |
lemma mem_Rep_preal_diff_iff: |
70201 | 810 |
"r < s \<Longrightarrow> |
811 |
(z \<in> Rep_preal (s - r)) \<longleftrightarrow> |
|
812 |
(\<exists>x. 0 < x \<and> 0 < z \<and> x \<notin> Rep_preal r \<and> x + z \<in> Rep_preal s)" |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
813 |
apply (simp add: preal_diff_def mem_diff_set Rep_preal) |
70200 | 814 |
apply (force simp: diff_set_def) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
815 |
done |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
816 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
817 |
proposition less_add_left: |
70201 | 818 |
fixes r::preal |
819 |
assumes "r < s" |
|
820 |
shows "r + (s-r) = s" |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
821 |
proof - |
70201 | 822 |
have "a + b \<in> Rep_preal s" |
823 |
if "a \<in> Rep_preal r" "c + b \<in> Rep_preal s" "c \<notin> Rep_preal r" |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
824 |
and "0 < b" "0 < c" for a b c |
70200 | 825 |
by (meson cut_Rep_preal add_less_imp_less_right add_pos_pos not_in_Rep_preal_ub preal_downwards_closed preal_imp_pos that) |
70201 | 826 |
then have "r + (s-r) \<le> s" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
827 |
using assms mem_Rep_preal_add_iff mem_Rep_preal_diff_iff preal_le_def by auto |
70201 | 828 |
have "x \<in> Rep_preal (r + (s - r))" if "x \<in> Rep_preal s" for x |
829 |
proof (cases "x \<in> Rep_preal r") |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
830 |
case True |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
831 |
then show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
832 |
using Rep_preal_self_subset by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
833 |
next |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
834 |
case False |
70201 | 835 |
have "\<exists>u v z. 0 < v \<and> 0 < z \<and> u \<in> Rep_preal r \<and> z \<notin> Rep_preal r \<and> z + v \<in> Rep_preal s \<and> x = u + v" |
836 |
if x: "x \<in> Rep_preal s" |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
837 |
proof - |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
838 |
have xpos: "x > 0" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
839 |
using Rep_preal preal_imp_pos that by blast |
70201 | 840 |
obtain e where epos: "0 < e" and xe: "x + e \<in> Rep_preal s" |
70200 | 841 |
by (metis cut_Rep_preal x add_eq_exists less_add_same_cancel1 preal_exists_greater) |
842 |
from Gleason9_34 [OF cut_Rep_preal epos] |
|
70201 | 843 |
obtain u where r: "u \<in> Rep_preal r" and notin: "u + e \<notin> Rep_preal r" .. |
844 |
with x False xpos have rless: "u < x" by (blast intro: not_in_Rep_preal_ub) |
|
845 |
from add_eq_exists [of u x] |
|
846 |
obtain y where eq: "x = u+y" by auto |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
847 |
show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
848 |
proof (intro exI conjI) |
70201 | 849 |
show "u + e \<notin> Rep_preal r" by (rule notin) |
850 |
show "u + e + y \<in> Rep_preal s" using xe eq by (simp add: ac_simps) |
|
851 |
show "0 < u + e" |
|
70200 | 852 |
using epos preal_imp_pos [OF cut_Rep_preal r] by simp |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
853 |
qed (use r rless eq in auto) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
854 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
855 |
then show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
856 |
using assms mem_Rep_preal_add_iff mem_Rep_preal_diff_iff that by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
857 |
qed |
70201 | 858 |
then have "s \<le> r + (s-r)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
859 |
by (auto simp: preal_le_def) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
860 |
then show ?thesis |
70201 | 861 |
by (simp add: \<open>r + (s - r) \<le> s\<close> antisym) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
862 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
863 |
|
70201 | 864 |
lemma preal_add_less2_mono1: "r < (s::preal) \<Longrightarrow> r + t < s + t" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
865 |
by (metis add.assoc add.commute less_add_left preal_self_less_add_left) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
866 |
|
70201 | 867 |
lemma preal_add_less2_mono2: "r < (s::preal) \<Longrightarrow> t + r < t + s" |
868 |
by (auto intro: preal_add_less2_mono1 simp add: preal_add_commute [of t]) |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
869 |
|
70201 | 870 |
lemma preal_add_right_less_cancel: "r + t < s + t \<Longrightarrow> r < (s::preal)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
871 |
by (metis linorder_cases order.asym preal_add_less2_mono1) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
872 |
|
70201 | 873 |
lemma preal_add_left_less_cancel: "t + r < t + s \<Longrightarrow> r < (s::preal)" |
874 |
by (auto elim: preal_add_right_less_cancel simp add: preal_add_commute [of t]) |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
875 |
|
70201 | 876 |
lemma preal_add_less_cancel_left [simp]: "(t + (r::preal) < t + s) \<longleftrightarrow> (r < s)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
877 |
by (blast intro: preal_add_less2_mono2 preal_add_left_less_cancel) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
878 |
|
70201 | 879 |
lemma preal_add_less_cancel_right [simp]: "((r::preal) + t < s + t) = (r < s)" |
880 |
using preal_add_less_cancel_left [symmetric, of r s t] by (simp add: ac_simps) |
|
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
881 |
|
70201 | 882 |
lemma preal_add_le_cancel_left [simp]: "(t + (r::preal) \<le> t + s) = (r \<le> s)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
883 |
by (simp add: linorder_not_less [symmetric]) |
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
884 |
|
70201 | 885 |
lemma preal_add_le_cancel_right [simp]: "((r::preal) + t \<le> s + t) = (r \<le> s)" |
886 |
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
|
887 |
|
70201 | 888 |
lemma preal_add_right_cancel: "(r::preal) + t = s + t \<Longrightarrow> r = s" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
889 |
by (metis less_irrefl linorder_cases preal_add_less_cancel_right) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
890 |
|
70201 | 891 |
lemma preal_add_left_cancel: "c + a = c + b \<Longrightarrow> a = (b::preal)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
892 |
by (auto intro: preal_add_right_cancel simp add: preal_add_commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
893 |
|
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
894 |
instance preal :: linordered_ab_semigroup_add |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
895 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
896 |
fix a b c :: preal |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
897 |
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
|
898 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
899 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
900 |
|
69597 | 901 |
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
|
902 |
|
61343 | 903 |
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
|
904 |
|
61343 | 905 |
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
|
906 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
907 |
lemma preal_sup: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
908 |
assumes le: "\<And>X. X \<in> P \<Longrightarrow> X \<le> Y" and "P \<noteq> {}" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
909 |
shows "cut (\<Union>X \<in> P. Rep_preal(X))" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
910 |
proof - |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
911 |
have "{} \<subset> (\<Union>X \<in> P. Rep_preal(X))" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
912 |
using \<open>P \<noteq> {}\<close> mem_Rep_preal_Ex by fastforce |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
913 |
moreover |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
914 |
obtain q where "q > 0" and "q \<notin> (\<Union>X \<in> P. Rep_preal(X))" |
70200 | 915 |
using Rep_preal_exists_bound [of Y] le by (auto simp: preal_le_def) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
916 |
then have "(\<Union>X \<in> P. Rep_preal(X)) \<subset> {0<..}" |
70200 | 917 |
using cut_Rep_preal preal_imp_pos by force |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
918 |
moreover |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
919 |
have "\<And>u z. \<lbrakk>u \<in> (\<Union>X \<in> P. Rep_preal(X)); 0 < z; z < u\<rbrakk> \<Longrightarrow> z \<in> (\<Union>X \<in> P. Rep_preal(X))" |
70200 | 920 |
by (auto elim: cut_Rep_preal [THEN preal_downwards_closed]) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
921 |
moreover |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
922 |
have "\<And>y. y \<in> (\<Union>X \<in> P. Rep_preal(X)) \<Longrightarrow> \<exists>u \<in> (\<Union>X \<in> P. Rep_preal(X)). y < u" |
70200 | 923 |
by (blast dest: cut_Rep_preal [THEN preal_exists_greater]) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
924 |
ultimately show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
925 |
by (simp add: Dedekind_Real.cut_def) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
926 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
927 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
928 |
lemma preal_psup_le: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
929 |
"\<lbrakk>\<And>X. X \<in> P \<Longrightarrow> X \<le> Y; x \<in> P\<rbrakk> \<Longrightarrow> x \<le> psup P" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
930 |
using preal_sup [of P Y] unfolding preal_le_def psup_def by fastforce |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
931 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
932 |
lemma psup_le_ub: "\<lbrakk>\<And>X. X \<in> P \<Longrightarrow> X \<le> Y; P \<noteq> {}\<rbrakk> \<Longrightarrow> psup P \<le> Y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
933 |
using preal_sup [of P Y] by (simp add: SUP_least preal_le_def psup_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
934 |
|
61343 | 935 |
text\<open>Supremum property\<close> |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
936 |
proposition preal_complete: |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
937 |
assumes le: "\<And>X. X \<in> P \<Longrightarrow> X \<le> Y" and "P \<noteq> {}" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
938 |
shows "(\<exists>X \<in> P. Z < X) \<longleftrightarrow> (Z < psup P)" (is "?lhs = ?rhs") |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
939 |
proof |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
940 |
assume ?lhs |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
941 |
then show ?rhs |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
942 |
using preal_sup [OF assms] preal_less_def psup_def by auto |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
943 |
next |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
944 |
assume ?rhs |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
945 |
then show ?lhs |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
946 |
by (meson \<open>P \<noteq> {}\<close> not_less psup_le_ub) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
947 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
948 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
949 |
subsection \<open>Defining the Reals from the Positive Reals\<close> |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
950 |
|
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
951 |
text \<open>Here we do quotients the old-fashioned way\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
952 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
953 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
954 |
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
|
955 |
"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
|
956 |
|
45694
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
41541
diff
changeset
|
957 |
definition "Real = UNIV//realrel" |
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
41541
diff
changeset
|
958 |
|
49834 | 959 |
typedef real = Real |
45694
4a8743618257
prefer typedef without extra definition and alternative name;
wenzelm
parents:
41541
diff
changeset
|
960 |
morphisms Rep_Real Abs_Real |
70200 | 961 |
unfolding Real_def by (auto simp: quotient_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
962 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
963 |
text \<open>This doesn't involve the overloaded "real" function: users don't see it\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
964 |
definition |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
965 |
real_of_preal :: "preal \<Rightarrow> real" where |
37765 | 966 |
"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
|
967 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
968 |
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
|
969 |
begin |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
970 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
971 |
definition |
37765 | 972 |
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
|
973 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
974 |
definition |
37765 | 975 |
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
|
976 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
977 |
definition |
37765 | 978 |
real_add_def: "z + w = |
39910 | 979 |
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
|
980 |
{ Abs_Real(realrel``{(x+u, y+v)}) })" |
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 |
definition |
39910 | 983 |
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
|
984 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
985 |
definition |
37765 | 986 |
real_diff_def: "r - (s::real) = r + - s" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
987 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
988 |
definition |
37765 | 989 |
real_mult_def: |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
990 |
"z * w = |
39910 | 991 |
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
|
992 |
{ 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
|
993 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
994 |
definition |
70201 | 995 |
real_inverse_def: "inverse (r::real) = (THE s. (r = 0 \<and> s = 0) \<or> s * r = 1)" |
36793
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 |
definition |
70201 | 998 |
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
|
999 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1000 |
definition |
37765 | 1001 |
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
|
1002 |
(\<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
|
1003 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1004 |
definition |
61076 | 1005 |
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
|
1006 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1007 |
definition |
61945 | 1008 |
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
|
1009 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1010 |
definition |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1011 |
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
|
1012 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1013 |
instance .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1014 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1015 |
end |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1016 |
|
61343 | 1017 |
subsection \<open>Equivalence relation over positive reals\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1018 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1019 |
lemma realrel_iff [simp]: "(((x1,y1),(x2,y2)) \<in> realrel) = (x1 + y2 = x2 + y1)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1020 |
by (simp add: realrel_def) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1021 |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1022 |
lemma preal_trans_lemma: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1023 |
assumes "x + y1 = x1 + y" and "x + y2 = x2 + y" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1024 |
shows "x1 + y2 = x2 + (y1::preal)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1025 |
by (metis add.left_commute assms preal_add_left_cancel) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1026 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1027 |
lemma equiv_realrel: "equiv UNIV realrel" |
70200 | 1028 |
by (auto simp: equiv_def refl_on_def sym_def trans_def realrel_def intro: dest: preal_trans_lemma) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1029 |
|
69597 | 1030 |
text\<open>Reduces equality of equivalence classes to the \<^term>\<open>realrel\<close> relation: |
1031 |
\<^term>\<open>(realrel `` {x} = realrel `` {y}) = ((x,y) \<in> realrel)\<close>\<close> |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1032 |
lemmas equiv_realrel_iff [simp] = |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1033 |
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
|
1034 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1035 |
lemma realrel_in_real [simp]: "realrel``{(x,y)} \<in> Real" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1036 |
by (simp add: Real_def realrel_def quotient_def, blast) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1037 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1038 |
declare Abs_Real_inject [simp] Abs_Real_inverse [simp] |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1039 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1040 |
|
61343 | 1041 |
text\<open>Case analysis on the representation of a real number as an equivalence |
1042 |
class of pairs of positive reals.\<close> |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1043 |
lemma eq_Abs_Real [case_names Abs_Real, cases type: real]: |
67613 | 1044 |
"(\<And>x y. z = Abs_Real(realrel``{(x,y)}) \<Longrightarrow> P) \<Longrightarrow> P" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1045 |
by (metis Rep_Real_inverse prod.exhaust Rep_Real [of z, unfolded Real_def, THEN quotientE]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1046 |
|
61343 | 1047 |
subsection \<open>Addition and Subtraction\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1048 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1049 |
lemma real_add: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1050 |
"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
|
1051 |
Abs_Real (realrel``{(x+u, y+v)})" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1052 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1053 |
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
|
1054 |
respects2 realrel" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1055 |
by (clarsimp simp: congruent2_def) (metis add.left_commute preal_add_assoc) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1056 |
thus ?thesis |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1057 |
by (simp add: real_add_def UN_UN_split_split_eq UN_equiv_class2 [OF equiv_realrel equiv_realrel]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1058 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1059 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1060 |
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
|
1061 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1062 |
have "(\<lambda>(x,y). {Abs_Real (realrel``{(y,x)})}) respects realrel" |
70200 | 1063 |
by (auto simp: congruent_def add.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1064 |
thus ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1065 |
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
|
1066 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1067 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1068 |
instance real :: ab_group_add |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1069 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1070 |
fix x y z :: real |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1071 |
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
|
1072 |
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
|
1073 |
show "x + y = y + x" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1074 |
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
|
1075 |
show "0 + x = x" |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1076 |
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
|
1077 |
show "- x + x = 0" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
1078 |
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
|
1079 |
show "x - y = x + - y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1080 |
by (simp add: real_diff_def) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1081 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1082 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1083 |
|
61343 | 1084 |
subsection \<open>Multiplication\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1085 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1086 |
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
|
1087 |
"!!(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
|
1088 |
x * x1 + y * y1 + (x * y2 + y * x2) = |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1089 |
x * x2 + y * y2 + (x * y1 + y * x1)" |
73932
fd21b4a93043
added opaque_combs and renamed hide_lams to opaque_lifting
desharna
parents:
73648
diff
changeset
|
1090 |
by (metis (no_types, opaque_lifting) add.left_commute preal_add_commute preal_add_mult_distrib2) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1091 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1092 |
lemma real_mult_congruent2: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1093 |
"(\<lambda>p1 p2. |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1094 |
(\<lambda>(x1,y1). (\<lambda>(x2,y2). |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1095 |
{ 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
|
1096 |
respects2 realrel" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1097 |
apply (rule congruent2_commuteI [OF equiv_realrel]) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1098 |
by (auto simp: mult.commute add.commute combine_common_factor preal_add_assoc preal_add_commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1099 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1100 |
lemma real_mult: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1101 |
"Abs_Real((realrel``{(x1,y1)})) * Abs_Real((realrel``{(x2,y2)})) = |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1102 |
Abs_Real(realrel `` {(x1*x2+y1*y2,x1*y2+y1*x2)})" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1103 |
by (simp add: real_mult_def UN_UN_split_split_eq |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1104 |
UN_equiv_class2 [OF equiv_realrel equiv_realrel real_mult_congruent2]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1105 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1106 |
lemma real_mult_commute: "(z::real) * w = w * z" |
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1107 |
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
|
1108 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1109 |
lemma real_mult_assoc: "((z1::real) * z2) * z3 = z1 * (z2 * z3)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1110 |
by (cases z1, cases z2, cases z3) (simp add: real_mult algebra_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1111 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1112 |
lemma real_mult_1: "(1::real) * z = z" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1113 |
by (cases z) (simp add: real_mult real_one_def algebra_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1114 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1115 |
lemma real_add_mult_distrib: "((z1::real) + z2) * w = (z1 * w) + (z2 * w)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1116 |
by (cases z1, cases z2, cases w) (simp add: real_add real_mult algebra_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1117 |
|
61343 | 1118 |
text\<open>one and zero are distinct\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1119 |
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
|
1120 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1121 |
have "(1::preal) < 1 + 1" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1122 |
by (simp add: preal_self_less_add_left) |
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1123 |
then show ?thesis |
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1124 |
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
|
1125 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1126 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1127 |
instance real :: comm_ring_1 |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1128 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1129 |
fix x y z :: real |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1130 |
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
|
1131 |
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
|
1132 |
show "1 * x = x" by (rule real_mult_1) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1133 |
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
|
1134 |
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
|
1135 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1136 |
|
61343 | 1137 |
subsection \<open>Inverse and Division\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1138 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1139 |
lemma real_zero_iff: "Abs_Real (realrel `` {(x, x)}) = 0" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1140 |
by (simp add: real_zero_def add.commute) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1141 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1142 |
lemma real_mult_inverse_left_ex: |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1143 |
assumes "x \<noteq> 0" obtains y::real where "y*x = 1" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1144 |
proof (cases x) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1145 |
case (Abs_Real u v) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1146 |
show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1147 |
proof (cases u v rule: linorder_cases) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1148 |
case less |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1149 |
then have "v * inverse (v - u) = 1 + u * inverse (v - u)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1150 |
using less_add_left [of u v] |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1151 |
by (metis preal_add_commute preal_add_mult_distrib preal_mult_inverse_right) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1152 |
then have "Abs_Real (realrel``{(1, inverse (v-u) + 1)}) * x - 1 = 0" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1153 |
by (simp add: Abs_Real real_mult preal_mult_inverse_right real_one_def) (simp add: algebra_simps) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1154 |
with that show thesis by auto |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1155 |
next |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1156 |
case equal |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1157 |
then show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1158 |
using Abs_Real assms real_zero_iff by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1159 |
next |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1160 |
case greater |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1161 |
then have "u * inverse (u - v) = 1 + v * inverse (u - v)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1162 |
using less_add_left [of v u] by (metis add.commute distrib_right preal_mult_inverse_right) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1163 |
then have "Abs_Real (realrel``{(inverse (u-v) + 1, 1)}) * x - 1 = 0" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1164 |
by (simp add: Abs_Real real_mult preal_mult_inverse_right real_one_def) (simp add: algebra_simps) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1165 |
with that show thesis by auto |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1166 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1167 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1168 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1169 |
|
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1170 |
lemma real_mult_inverse_left: |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1171 |
fixes x :: real |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1172 |
assumes "x \<noteq> 0" shows "inverse x * x = 1" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1173 |
proof - |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1174 |
obtain y where "y*x = 1" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1175 |
using assms real_mult_inverse_left_ex by blast |
70201 | 1176 |
then have "(THE s. s * x = 1) * x = 1" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1177 |
proof (rule theI) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1178 |
show "y' = y" if "y' * x = 1" for y' |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1179 |
by (metis \<open>y * x = 1\<close> mult.left_commute mult.right_neutral that) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1180 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1181 |
then show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1182 |
using assms real_inverse_def by auto |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1183 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1184 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1185 |
|
61343 | 1186 |
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
|
1187 |
|
59867
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59815
diff
changeset
|
1188 |
instance real :: field |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1189 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1190 |
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
|
1191 |
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
|
1192 |
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
|
1193 |
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
|
1194 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1195 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1196 |
|
61933 | 1197 |
subsection\<open>The \<open>\<le>\<close> Ordering\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1198 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1199 |
lemma real_le_refl: "w \<le> (w::real)" |
70200 | 1200 |
by (cases w, force simp: real_le_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1201 |
|
61343 | 1202 |
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
|
1203 |
This lemma is currently unused, but it could simplify the proofs of the |
61343 | 1204 |
following two lemmas.\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1205 |
lemma preal_eq_le_imp_le: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1206 |
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
|
1207 |
shows "b \<le> (d::preal)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1208 |
proof - |
59815
cce82e360c2f
explicit commutative additive inverse operation;
haftmann
parents:
59814
diff
changeset
|
1209 |
from le have "c+d \<le> a+d" by simp |
41541 | 1210 |
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
|
1211 |
thus "b \<le> d" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1212 |
qed |
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 |
lemma real_le_lemma: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1215 |
assumes l: "u1 + v2 \<le> u2 + v1" |
41541 | 1216 |
and "x1 + v1 = u1 + y1" |
1217 |
and "x2 + v2 = u2 + y2" |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1218 |
shows "x1 + y2 \<le> x2 + (y1::preal)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1219 |
proof - |
41541 | 1220 |
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
|
1221 |
hence "(x1+y2) + (u2+v1) = (x2+y1) + (u1+v2)" by (simp add: ac_simps) |
70200 | 1222 |
also have "\<dots> \<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
|
1223 |
finally show ?thesis by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1224 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1225 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1226 |
lemma real_le: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1227 |
"Abs_Real(realrel``{(x1,y1)}) \<le> Abs_Real(realrel``{(x2,y2)}) \<longleftrightarrow> x1 + y2 \<le> x2 + y1" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1228 |
unfolding real_le_def by (auto intro: real_le_lemma) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1229 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1230 |
lemma real_le_antisym: "\<lbrakk>z \<le> w; w \<le> z\<rbrakk> \<Longrightarrow> z = (w::real)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1231 |
by (cases z, cases w, simp add: real_le) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1232 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1233 |
lemma real_trans_lemma: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1234 |
assumes "x + v \<le> u + y" |
41541 | 1235 |
and "u + v' \<le> u' + v" |
1236 |
and "x2 + v2 = u2 + y2" |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1237 |
shows "x + v' \<le> u' + (y::preal)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1238 |
proof - |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1239 |
have "(x+v') + (u+v) = (x+v) + (u+v')" by (simp add: ac_simps) |
70200 | 1240 |
also have "\<dots> \<le> (u+y) + (u+v')" by (simp add: assms) |
1241 |
also have "\<dots> \<le> (u+y) + (u'+v)" by (simp add: assms) |
|
1242 |
also have "\<dots> = (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
|
1243 |
finally show ?thesis by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1244 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1245 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1246 |
lemma real_le_trans: "\<lbrakk>i \<le> j; j \<le> k\<rbrakk> \<Longrightarrow> i \<le> (k::real)" |
70200 | 1247 |
by (cases i, cases j, cases k) (auto simp: real_le intro: real_trans_lemma) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1248 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1249 |
instance real :: order |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1250 |
proof |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1251 |
show "u < v \<longleftrightarrow> u \<le> v \<and> \<not> v \<le> u" for u v::real |
70200 | 1252 |
by (auto simp: real_less_def intro: real_le_antisym) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1253 |
qed (auto intro: real_le_refl real_le_trans real_le_antisym) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1254 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1255 |
instance real :: linorder |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1256 |
proof |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1257 |
show "x \<le> y \<or> y \<le> x" for x y :: real |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1258 |
by (meson eq_refl le_cases real_le_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1259 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1260 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1261 |
instantiation real :: distrib_lattice |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1262 |
begin |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1263 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1264 |
definition |
61076 | 1265 |
"(inf :: real \<Rightarrow> real \<Rightarrow> real) = min" |
36793
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 |
definition |
61076 | 1268 |
"(sup :: real \<Rightarrow> real \<Rightarrow> real) = max" |
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 |
instance |
70200 | 1271 |
by standard (auto simp: 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
|
1272 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1273 |
end |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1274 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1275 |
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
|
1276 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1277 |
lemma real_le_eq_diff: "(x \<le> y) \<longleftrightarrow> (x-y \<le> (0::real))" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1278 |
by (cases x, cases y) (simp add: real_le real_zero_def real_diff_def real_add real_minus preal_add_commute) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1279 |
|
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1280 |
lemma real_add_left_mono: |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1281 |
assumes le: "x \<le> y" shows "z + x \<le> z + (y::real)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1282 |
proof - |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1283 |
have "z + x - (z + y) = (z + -z) + (x - y)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1284 |
by (simp add: algebra_simps) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1285 |
with le show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1286 |
by (simp add: real_le_eq_diff[of x] real_le_eq_diff[of "z+x"]) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1287 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1288 |
|
70201 | 1289 |
lemma real_sum_gt_zero_less: "(0 < s + (-w::real)) \<Longrightarrow> (w < s)" |
1290 |
by (simp add: linorder_not_le [symmetric] real_le_eq_diff [of s]) |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1291 |
|
70201 | 1292 |
lemma real_less_sum_gt_zero: "(w < s) \<Longrightarrow> (0 < s + (-w::real))" |
1293 |
by (simp add: linorder_not_le [symmetric] real_le_eq_diff [of s]) |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1294 |
|
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1295 |
lemma real_mult_order: |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1296 |
fixes x y::real |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1297 |
assumes "0 < x" "0 < y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1298 |
shows "0 < x * y" |
70200 | 1299 |
proof (cases x, cases y) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1300 |
show "0 < x * y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1301 |
if x: "x = Abs_Real (Dedekind_Real.realrel `` {(x1, x2)})" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1302 |
and y: "y = Abs_Real (Dedekind_Real.realrel `` {(y1, y2)})" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1303 |
for x1 x2 y1 y2 |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1304 |
proof - |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1305 |
have "x2 < x1" "y2 < y1" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1306 |
using assms not_le real_zero_def real_le x y |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1307 |
by (metis preal_add_le_cancel_left real_zero_iff)+ |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1308 |
then obtain xd yd where "x1 = x2 + xd" "y1 = y2 + yd" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1309 |
using less_add_left by metis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1310 |
then have "\<not> (x * y \<le> 0)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1311 |
apply (simp add: x y real_mult real_zero_def real_le) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1312 |
apply (simp add: not_le algebra_simps preal_self_less_add_left) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1313 |
done |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1314 |
then show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1315 |
by auto |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1316 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1317 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1318 |
|
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1319 |
lemma real_mult_less_mono2: "\<lbrakk>(0::real) < z; x < y\<rbrakk> \<Longrightarrow> z * x < z * y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1320 |
by (metis add_uminus_conv_diff real_less_sum_gt_zero real_mult_order real_sum_gt_zero_less right_diff_distrib') |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1321 |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1322 |
|
59867
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59815
diff
changeset
|
1323 |
instance real :: linordered_field |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1324 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1325 |
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
|
1326 |
show "x \<le> y \<Longrightarrow> z + x \<le> z + y" by (rule real_add_left_mono) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1327 |
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
|
1328 |
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
|
1329 |
by (simp only: real_sgn_def) |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1330 |
show "z * x < z * y" if "x < y" "0 < z" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1331 |
by (simp add: real_mult_less_mono2 that) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1332 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1333 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1334 |
|
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1335 |
subsection \<open>Completeness of the reals\<close> |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1336 |
|
69597 | 1337 |
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
|
1338 |
to be essential for proving completeness of the reals from that of the |
61343 | 1339 |
positive reals.\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1340 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1341 |
lemma real_of_preal_add: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1342 |
"real_of_preal ((x::preal) + y) = real_of_preal x + real_of_preal y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1343 |
by (simp add: real_of_preal_def real_add algebra_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_of_preal_mult: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1346 |
"real_of_preal ((x::preal) * y) = real_of_preal x * real_of_preal y" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1347 |
by (simp add: real_of_preal_def real_mult algebra_simps) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1348 |
|
61343 | 1349 |
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
|
1350 |
lemma real_of_preal_trichotomy: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1351 |
"\<exists>m. (x::real) = real_of_preal m \<or> x = 0 \<or> x = -(real_of_preal m)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1352 |
proof (cases x) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1353 |
case (Abs_Real u v) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1354 |
show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1355 |
proof (cases u v rule: linorder_cases) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1356 |
case less |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1357 |
then show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1358 |
using less_add_left |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1359 |
apply (simp add: Abs_Real real_of_preal_def real_minus real_zero_def) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1360 |
by (metis preal_add_assoc preal_add_commute) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1361 |
next |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1362 |
case equal |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1363 |
then show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1364 |
using Abs_Real real_zero_iff by blast |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1365 |
next |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1366 |
case greater |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1367 |
then show ?thesis |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1368 |
using less_add_left |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1369 |
apply (simp add: Abs_Real real_of_preal_def real_minus real_zero_def) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1370 |
by (metis preal_add_assoc preal_add_commute) |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1371 |
qed |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1372 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1373 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1374 |
lemma real_of_preal_less_iff [simp]: |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1375 |
"(real_of_preal m1 < real_of_preal m2) = (m1 < m2)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1376 |
by (metis not_less preal_add_less_cancel_right real_le real_of_preal_def) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1377 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1378 |
lemma real_of_preal_le_iff [simp]: |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1379 |
"(real_of_preal m1 \<le> real_of_preal m2) = (m1 \<le> m2)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1380 |
by (simp add: linorder_not_less [symmetric]) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1381 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1382 |
lemma real_of_preal_zero_less [simp]: "0 < real_of_preal m" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1383 |
by (metis less_add_same_cancel2 preal_self_less_add_left real_of_preal_add real_of_preal_less_iff) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1384 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1385 |
|
61343 | 1386 |
subsection\<open>Theorems About the Ordering\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1387 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1388 |
lemma real_gt_zero_preal_Ex: "(0 < x) \<longleftrightarrow> (\<exists>y. x = real_of_preal y)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1389 |
using order.asym real_of_preal_trichotomy by fastforce |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1390 |
|
61343 | 1391 |
subsection \<open>Completeness of Positive Reals\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1392 |
|
61343 | 1393 |
text \<open> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1394 |
Supremum property for the set of positive reals |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1395 |
|
61933 | 1396 |
Let \<open>P\<close> be a non-empty set of positive reals, with an upper |
1397 |
bound \<open>y\<close>. Then \<open>P\<close> has a least upper bound |
|
1398 |
(written \<open>S\<close>). |
|
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1399 |
|
61933 | 1400 |
FIXME: Can the premise be weakened to \<open>\<forall>x \<in> P. x\<le> y\<close>? |
61343 | 1401 |
\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1402 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1403 |
lemma posreal_complete: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1404 |
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
|
1405 |
and not_empty_P: "\<exists>x. x \<in> P" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1406 |
and upper_bound_Ex: "\<exists>y. \<forall>x \<in> P. x<y" |
70201 | 1407 |
shows "\<exists>s. \<forall>y. (\<exists>x \<in> P. y < x) = (y < s)" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1408 |
proof (rule exI, rule allI) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1409 |
fix y |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1410 |
let ?pP = "{w. real_of_preal w \<in> P}" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1411 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1412 |
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
|
1413 |
proof (cases "0 < y") |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1414 |
assume neg_y: "\<not> 0 < y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1415 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1416 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1417 |
assume "\<exists>x\<in>P. y < x" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1418 |
thus "y < real_of_preal (psup ?pP)" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1419 |
by (metis dual_order.strict_trans neg_y not_less_iff_gr_or_eq real_of_preal_zero_less) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1420 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1421 |
assume "y < real_of_preal (psup ?pP)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1422 |
obtain "x" where x_in_P: "x \<in> P" using not_empty_P .. |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1423 |
thus "\<exists>x \<in> P. y < x" using x_in_P |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1424 |
using neg_y not_less_iff_gr_or_eq positive_P by fastforce |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1425 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1426 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1427 |
assume pos_y: "0 < y" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1428 |
then obtain py where y_is_py: "y = real_of_preal py" |
70200 | 1429 |
by (auto simp: real_gt_zero_preal_Ex) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1430 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1431 |
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
|
1432 |
with positive_P have a_pos: "0 < a" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1433 |
then obtain pa where "a = real_of_preal pa" |
70200 | 1434 |
by (auto simp: real_gt_zero_preal_Ex) |
61343 | 1435 |
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
|
1436 |
hence pP_not_empty: "?pP \<noteq> {}" by auto |
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 |
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
|
1439 |
using upper_bound_Ex .. |
61343 | 1440 |
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
|
1441 |
hence "0 < sup" using a_pos by arith |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1442 |
then obtain possup where "sup = real_of_preal possup" |
70200 | 1443 |
by (auto simp: real_gt_zero_preal_Ex) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1444 |
hence "\<forall>X \<in> ?pP. X \<le> possup" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1445 |
using sup by auto |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1446 |
with pP_not_empty have psup: "\<And>Z. (\<exists>X \<in> ?pP. Z < X) = (Z < psup ?pP)" |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1447 |
by (meson preal_complete) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1448 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1449 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1450 |
assume "\<exists>x \<in> P. y < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1451 |
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
|
1452 |
hence "0 < x" using pos_y by arith |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1453 |
then obtain px where x_is_px: "x = real_of_preal px" |
70200 | 1454 |
by (auto simp: real_gt_zero_preal_Ex) |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1455 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1456 |
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
|
1457 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1458 |
show "py < px" using y_is_py and x_is_px and y_less_x |
70200 | 1459 |
by simp |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1460 |
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
|
1461 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1462 |
|
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1463 |
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
|
1464 |
using psup by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1465 |
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
|
1466 |
thus "y < real_of_preal (psup {w. real_of_preal w \<in> P})" |
70200 | 1467 |
using y_is_py and pos_y by simp |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1468 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1469 |
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
|
1470 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1471 |
hence "py < psup ?pP" using y_is_py |
70200 | 1472 |
by simp |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1473 |
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
|
1474 |
using psup by auto |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1475 |
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
|
1476 |
by (simp add: real_gt_zero_preal_Ex) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1477 |
hence "y < x" using py_less_X and y_is_py |
70200 | 1478 |
by simp |
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1479 |
moreover have "x \<in> P" |
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1480 |
using x_is_X and X_in_pP by simp |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1481 |
ultimately show "\<exists> x \<in> P. y < x" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1482 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1483 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1484 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1485 |
|
70199
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1486 |
|
b3630f5cc403
Massive restructuring; deleting unused theorems
paulson <lp15@cam.ac.uk>
parents:
70197
diff
changeset
|
1487 |
subsection \<open>Completeness\<close> |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1488 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1489 |
lemma reals_complete: |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1490 |
fixes S :: "real set" |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1491 |
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
|
1492 |
and exists_Ub: "bdd_above S" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1493 |
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
|
1494 |
proof - |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1495 |
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
|
1496 |
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
|
1497 |
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
|
1498 |
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
|
1499 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1500 |
{ |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1501 |
fix x |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1502 |
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
|
1503 |
{ |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1504 |
fix s |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1505 |
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
|
1506 |
hence "\<exists> x \<in> S. s = x + -X + 1" .. |
53373 | 1507 |
then obtain x1 where x1: "x1 \<in> S" "s = x1 + (-X) + 1" .. |
1508 |
then have "x1 \<le> x" using S_le_x by simp |
|
1509 |
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
|
1510 |
} |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1511 |
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
|
1512 |
by auto |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1513 |
} note S_Ub_is_SHIFT_Ub = this |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1514 |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1515 |
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
|
1516 |
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
|
1517 |
proof |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1518 |
fix s assume "s\<in>?SHIFT" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1519 |
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
|
1520 |
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
|
1521 |
finally show "s < Y + (-X) + 2" . |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1522 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1523 |
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
|
1524 |
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
|
1525 |
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
|
1526 |
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
|
1527 |
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
|
1528 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1529 |
show ?thesis |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1530 |
proof |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1531 |
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
|
1532 |
proof safe |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1533 |
fix x |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1534 |
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
|
1535 |
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
|
1536 |
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
|
1537 |
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
|
1538 |
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
|
1539 |
thus "t + X + -1 \<le> x" by arith |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1540 |
next |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1541 |
fix y |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1542 |
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
|
1543 |
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
|
1544 |
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
|
1545 |
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
|
1546 |
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
|
1547 |
proof (rule dense_le) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1548 |
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
|
1549 |
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
|
1550 |
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
|
1551 |
qed |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1552 |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1553 |
show "y \<le> t + X + -1" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1554 |
proof cases |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1555 |
assume "y \<le> x" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1556 |
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
|
1557 |
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
|
1558 |
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
|
1559 |
next |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1560 |
assume "~(y \<le> x)" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1561 |
hence x_less_y: "x < y" by arith |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1562 |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1563 |
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
|
1564 |
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
|
1565 |
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
|
1566 |
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
|
1567 |
have "y + (-X) + 1 \<le> t" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1568 |
proof (rule dense_le) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1569 |
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
|
1570 |
using * t_is_Lub by auto |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1571 |
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
|
1572 |
qed |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1573 |
thus ?thesis by simp |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1574 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1575 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1576 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1577 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1578 |
|
61343 | 1579 |
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
|
1580 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1581 |
theorem reals_Archimedean: |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1582 |
fixes x :: real |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1583 |
assumes x_pos: "0 < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1584 |
shows "\<exists>n. inverse (of_nat (Suc n)) < x" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1585 |
proof (rule ccontr) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1586 |
assume contr: "\<not> ?thesis" |
70197
e383580ffc35
partial updating to eliminate ASCII style and some applys
paulson <lp15@cam.ac.uk>
parents:
69597
diff
changeset
|
1587 |
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
|
1588 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1589 |
fix n |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1590 |
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
|
1591 |
by (simp add: linorder_not_less) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1592 |
hence "x \<le> (1 / (of_nat (Suc n)))" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1593 |
by (simp add: inverse_eq_divide) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1594 |
moreover have "(0::real) \<le> of_nat (Suc n)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1595 |
by (rule of_nat_0_le_iff) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1596 |
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
|
1597 |
by (rule mult_right_mono) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1598 |
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
|
1599 |
qed |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1600 |
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
|
1601 |
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
|
1602 |
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
|
1603 |
obtain t where |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1604 |
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
|
1605 |
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
|
1606 |
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
|
1607 |
|
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1608 |
have "t \<le> t + - x" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1609 |
proof (rule least) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1610 |
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
|
1611 |
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
|
1612 |
proof |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1613 |
fix n |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1614 |
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
|
1615 |
by (simp add: upper) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1616 |
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
|
1617 |
by (simp add: distrib_left) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
1618 |
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
|
1619 |
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
|
1620 |
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
|
1621 |
by auto |
36793
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1622 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1623 |
thus False using x_pos by arith |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1624 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1625 |
|
61343 | 1626 |
text \<open> |
61933 | 1627 |
There must be other proofs, e.g. \<open>Suc\<close> of the largest |
1628 |
integer in the cut representing \<open>x\<close>. |
|
61343 | 1629 |
\<close> |
36793
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 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
|
1632 |
proof cases |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1633 |
assume "x \<le> 0" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1634 |
hence "x < of_nat (1::nat)" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1635 |
thus ?thesis .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1636 |
next |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1637 |
assume "\<not> x \<le> 0" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1638 |
hence x_greater_zero: "0 < x" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1639 |
hence "0 < inverse x" by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1640 |
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
|
1641 |
using reals_Archimedean by blast |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1642 |
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
|
1643 |
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
|
1644 |
hence "inverse (of_nat (Suc n)) * x < 1" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1645 |
using x_greater_zero by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1646 |
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
|
1647 |
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
|
1648 |
hence "x < of_nat (Suc n)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1649 |
by (simp add: algebra_simps del: of_nat_Suc) |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1650 |
thus "\<exists>(n::nat). x < of_nat n" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1651 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1652 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1653 |
instance real :: archimedean_field |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1654 |
proof |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1655 |
fix r :: real |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1656 |
obtain n :: nat where "r < of_nat n" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1657 |
using reals_Archimedean2 .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1658 |
then have "r \<le> of_int (int n)" |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1659 |
by simp |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1660 |
then show "\<exists>z. r \<le> of_int z" .. |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1661 |
qed |
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1662 |
|
27da0a27b76f
put construction of reals using Dedekind cuts in HOL/ex
huffman
parents:
diff
changeset
|
1663 |
end |