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