src/HOL/Real/PReal.ML
author paulson
Thu, 25 Jun 1998 13:57:34 +0200
changeset 5078 7b5ea59c0275
child 5143 b94cd208f073
permissions -rw-r--r--
Installation of target HOL-Real
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5078
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
     1
(*  Title       : PReal.ML
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
     2
    Author      : Jacques D. Fleuriot
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
     3
    Copyright   : 1998  University of Cambridge
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
     4
    Description : The positive reals as Dedekind sections of positive
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
     5
                  rationals. Fundamentals of Abstract Analysis 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
     6
                  [Gleason- p. 121] provides some of the definitions.
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
     7
*)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
     8
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
     9
open PReal;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    10
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    11
Goal "inj_on Abs_preal preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    12
by (rtac inj_on_inverseI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    13
by (etac Abs_preal_inverse 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    14
qed "inj_on_Abs_preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    15
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    16
Addsimps [inj_on_Abs_preal RS inj_on_iff];
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    17
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    18
Goal "inj(Rep_preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    19
by (rtac inj_inverseI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    20
by (rtac Rep_preal_inverse 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    21
qed "inj_Rep_preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    22
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    23
Goalw [preal_def] "{} ~: preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    24
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    25
qed "empty_not_mem_preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    26
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    27
(* {} : preal ==> P *)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    28
bind_thm ("empty_not_mem_prealE", empty_not_mem_preal RS notE);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    29
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    30
Addsimps [empty_not_mem_preal];
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    31
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    32
Goalw [preal_def] "{x::prat. x < $#Abs_pnat 1} : preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    33
by (rtac preal_1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    34
qed "one_set_mem_preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    35
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    36
Addsimps [one_set_mem_preal];
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    37
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    38
Goalw [preal_def] "!!x. x : preal ==> {} < x";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    39
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    40
qed "preal_psubset_empty";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    41
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    42
Goal "{} < Rep_preal x";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    43
by (rtac (Rep_preal RS preal_psubset_empty) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    44
qed "Rep_preal_psubset_empty";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    45
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    46
Goal "? x. x: Rep_preal X";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    47
by (cut_inst_tac [("x","X")]  Rep_preal_psubset_empty 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    48
by (auto_tac (claset() addIs [(equals0I RS sym)],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    49
              simpset() addsimps [psubset_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    50
qed "mem_Rep_preal_Ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    51
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    52
Goalw [preal_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    53
      "!!A. [| {} < A; A < {q::prat. True}; \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    54
\              (!y: A. ((!z. z < y --> z: A) & \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    55
\                        (? u: A. y < u))) |] ==> A : preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    56
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    57
qed "prealI1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    58
    
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    59
Goalw [preal_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    60
      "!!A. [| {} < A; A < {q::prat. True}; \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    61
\              !y: A. (!z. z < y --> z: A); \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    62
\              !y: A. (? u: A. y < u) |] ==> A : preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    63
by (Best_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    64
qed "prealI2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    65
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    66
Goalw [preal_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    67
      "!!A. A : preal ==> {} < A & A < {q::prat. True} & \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    68
\                         (!y: A. ((!z. z < y --> z: A) & \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    69
\                                  (? u: A. y < u)))";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    70
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    71
qed "prealE_lemma";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    72
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    73
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    74
AddSIs [prealI1,prealI2];
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    75
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    76
Addsimps [Abs_preal_inverse];
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    77
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    78
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    79
Goalw [preal_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    80
      "!!A. A : preal ==> {} < A";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    81
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    82
qed "prealE_lemma1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    83
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    84
Goalw [preal_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    85
      "!!A. A : preal ==> A < {q::prat. True}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    86
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    87
qed "prealE_lemma2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    88
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    89
Goalw [preal_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    90
      "!!A. A : preal ==> !y: A. (!z. z < y --> z: A)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    91
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    92
qed "prealE_lemma3";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    93
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    94
Goal 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    95
      "!!A. [| A : preal; y: A |] ==> (!z. z < y --> z: A)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    96
by (fast_tac (claset() addSDs [prealE_lemma3]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    97
qed "prealE_lemma3a";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    98
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
    99
Goal 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   100
      "!!A. [| A : preal; y: A; z < y |] ==> z: A";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   101
by (fast_tac (claset() addSDs [prealE_lemma3a]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   102
qed "prealE_lemma3b";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   103
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   104
Goalw [preal_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   105
      "!!A. A : preal ==> !y: A. (? u: A. y < u)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   106
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   107
qed "prealE_lemma4";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   108
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   109
Goal 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   110
      "!!A. [| A : preal; y: A |] ==> ? u: A. y < u";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   111
by (fast_tac (claset() addSDs [prealE_lemma4]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   112
qed "prealE_lemma4a";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   113
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   114
Goal "? x. x~: Rep_preal X";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   115
by (cut_inst_tac [("x","X")] Rep_preal 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   116
by (dtac prealE_lemma2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   117
by (rtac ccontr 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   118
by (auto_tac (claset(),simpset() addsimps [psubset_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   119
by (blast_tac (claset() addIs [set_ext] addEs [swap]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   120
qed "not_mem_Rep_preal_Ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   121
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   122
(** prat_pnat: the injection from prat to preal **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   123
(** A few lemmas **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   124
Goal "{} < {xa::prat. xa < y}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   125
by (cut_facts_tac [qless_Ex] 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   126
by (auto_tac (claset() addEs [equalityCE],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   127
              simpset() addsimps [psubset_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   128
qed "lemma_prat_less_set_Ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   129
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   130
Goal "{xa::prat. xa < y} : preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   131
by (cut_facts_tac [qless_Ex] 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   132
by Safe_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   133
by (rtac lemma_prat_less_set_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   134
by (auto_tac (claset() addIs [prat_less_trans],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   135
    simpset() addsimps [psubset_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   136
by (eres_inst_tac [("c","y")] equalityCE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   137
by (auto_tac (claset() addDs [prat_less_irrefl],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   138
by (dres_inst_tac [("q1.0","ya")] prat_dense 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   139
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   140
qed "lemma_prat_less_set_mem_preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   141
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   142
Goal "!!(x::prat). {xa. xa < x} = {x. x < y} ==> x = y";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   143
by (cut_inst_tac [("q1.0","x"),("q2.0","y")] prat_linear 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   144
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   145
by (dtac prat_dense 1 THEN etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   146
by (eres_inst_tac [("c","xa")] equalityCE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   147
by (auto_tac (claset() addDs [prat_less_asym],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   148
by (dtac prat_dense 1 THEN etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   149
by (eres_inst_tac [("c","xa")] equalityCE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   150
by (auto_tac (claset() addDs [prat_less_asym],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   151
qed "lemma_prat_set_eq";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   152
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   153
Goal "inj(preal_prat)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   154
by (rtac injI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   155
by (rewtac preal_prat_def);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   156
by (dtac (inj_on_Abs_preal RS inj_onD) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   157
by (rtac lemma_prat_less_set_mem_preal 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   158
by (rtac lemma_prat_less_set_mem_preal 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   159
by (etac lemma_prat_set_eq 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   160
qed "inj_preal_prat";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   161
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   162
      (*** theorems for ordering ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   163
(* prove introduction and elimination rules for preal_less *)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   164
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   165
Goalw [preal_less_def]
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   166
      "R1 < (R2::preal) = (Rep_preal(R1) < Rep_preal(R2))";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   167
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   168
qed "preal_less_iff";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   169
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   170
Goalw [preal_less_def]
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   171
      "!! (R1::preal). R1 < R2 ==> (Rep_preal(R1) < Rep_preal(R2))";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   172
by (Fast_tac  1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   173
qed "preal_lessI";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   174
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   175
Goalw [preal_less_def]
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   176
      "R1 < (R2::preal) --> (Rep_preal(R1) < Rep_preal(R2))";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   177
by (Fast_tac  1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   178
qed "preal_lessE_lemma";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   179
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   180
Goal 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   181
     "!! R1. [| R1 < (R2::preal); \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   182
\               (Rep_preal(R1) < Rep_preal(R2)) ==> P |] \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   183
\     ==> P";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   184
by (dtac (preal_lessE_lemma RS mp) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   185
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   186
qed "preal_lessE";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   187
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   188
(* A positive fraction not in a positive real is an upper bound *)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   189
(* Gleason p. 122 - Remark (1)                                  *)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   190
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   191
Goal "!!x. x ~: Rep_preal(R) ==> !y: Rep_preal(R). y < x";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   192
by (cut_inst_tac [("x1","R")] (Rep_preal RS prealE_lemma) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   193
by (auto_tac (claset() addIs [not_less_not_eq_prat_less],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   194
qed "not_in_preal_ub";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   195
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   196
(* preal_less is a strong order i.e nonreflexive and transitive *)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   197
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   198
Goalw [preal_less_def] "~ (x::preal) < x";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   199
by (simp_tac (simpset() addsimps [psubset_def]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   200
qed "preal_less_not_refl";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   201
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   202
(*** y < y ==> P ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   203
bind_thm("preal_less_irrefl",preal_less_not_refl RS notE);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   204
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   205
Goal "!!(x::preal). x < y ==> x ~= y";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   206
by (auto_tac (claset(),simpset() addsimps [preal_less_not_refl]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   207
qed "preal_not_refl2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   208
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   209
Goalw  [preal_less_def] "!!(x::preal). [| x < y; y < z |] ==> x < z";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   210
by (auto_tac (claset() addDs [subsetD,equalityI],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   211
              simpset() addsimps [psubset_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   212
qed "preal_less_trans";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   213
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   214
Goal "!! (q1::preal). [| q1 < q2; q2 < q1 |] ==> P";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   215
by (dtac preal_less_trans 1 THEN assume_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   216
by (asm_full_simp_tac (simpset() addsimps [preal_less_not_refl]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   217
qed "preal_less_asym";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   218
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   219
Goalw [preal_less_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   220
      "(r1::preal) < r2 | r1 = r2 | r2 < r1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   221
by (auto_tac (claset() addSDs [inj_Rep_preal RS injD],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   222
              simpset() addsimps [psubset_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   223
by (rtac prealE_lemma3b 1 THEN rtac Rep_preal 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   224
by (assume_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   225
by (fast_tac (claset() addDs [not_in_preal_ub]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   226
qed "preal_linear";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   227
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   228
Goal
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   229
    "!!(r1::preal). [| r1 < r2 ==> P;  r1 = r2 ==> P; \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   230
\          r2 < r1 ==> P |] ==> P";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   231
by (cut_inst_tac [("r1.0","r1"),("r2.0","r2")] preal_linear 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   232
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   233
qed "preal_linear_less2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   234
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   235
  (*** Properties of addition ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   236
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   237
Goalw [preal_add_def] "(x::preal) + y = y + x";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   238
by (res_inst_tac [("f","Abs_preal")] arg_cong 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   239
by (rtac set_ext 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   240
by (blast_tac (claset() addIs [prat_add_commute RS subst]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   241
qed "preal_add_commute";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   242
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   243
(** addition of two positive reals gives a positive real **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   244
(** lemmas for proving positive reals addition set in preal **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   245
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   246
(** Part 1 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   247
Goal "{} < {w. ? x: Rep_preal R. ? y:Rep_preal S. w = x + y}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   248
by (cut_facts_tac [mem_Rep_preal_Ex,mem_Rep_preal_Ex] 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   249
by (auto_tac (claset() addSIs [psubsetI] addEs [equalityCE],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   250
qed "preal_add_set_not_empty";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   251
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   252
(** Part 2 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   253
Goal "? q. q  ~: {w. ? x: Rep_preal R. ? y:Rep_preal S. w = x + y}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   254
by (cut_inst_tac [("X","R")] not_mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   255
by (cut_inst_tac [("X","S")] not_mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   256
by (REPEAT(etac exE 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   257
by (REPEAT(dtac not_in_preal_ub 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   258
by (res_inst_tac [("x","x+xa")] exI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   259
by (Auto_tac THEN (REPEAT(etac ballE 1)) THEN Auto_tac);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   260
by (dtac prat_add_less_mono 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   261
by (auto_tac (claset(),simpset() addsimps [prat_less_not_refl]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   262
qed "preal_not_mem_add_set_Ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   263
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   264
Goal "{w. ? x: Rep_preal R. ? y:Rep_preal S. w = x + y} < {q. True}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   265
by (auto_tac (claset() addSIs [psubsetI],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   266
by (cut_inst_tac [("R","R"),("S","S")] preal_not_mem_add_set_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   267
by (etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   268
by (eres_inst_tac [("c","q")] equalityCE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   269
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   270
qed "preal_add_set_not_prat_set";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   271
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   272
(** Part 3 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   273
Goal "!y: {w. ? x: Rep_preal R. ? y: Rep_preal S. w = x + y}. \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   274
\         !z. z < y --> z : {w. ? x:Rep_preal R. ? y:Rep_preal S. w = x + y}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   275
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   276
by (forward_tac [prat_mult_qinv_less_1] 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   277
by (forw_inst_tac [("x","x"),("q2.0","$#Abs_pnat 1")] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   278
    prat_mult_less2_mono1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   279
by (forw_inst_tac [("x","ya"),("q2.0","$#Abs_pnat 1")] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   280
    prat_mult_less2_mono1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   281
by (Asm_full_simp_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   282
by (REPEAT(dtac (Rep_preal RS prealE_lemma3a) 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   283
by (REPEAT(etac allE 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   284
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   285
by (REPEAT(rtac bexI 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   286
by (auto_tac (claset(),simpset() addsimps [prat_add_mult_distrib2 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   287
     RS sym,prat_add_assoc RS sym,prat_mult_assoc]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   288
qed "preal_add_set_lemma3";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   289
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   290
Goal "!y: {w. ? x: Rep_preal R. ? y: Rep_preal S. w = x + y}. \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   291
\         ? u: {w. ? x: Rep_preal R. ? y: Rep_preal S. w = x + y}. y < u";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   292
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   293
by (dtac (Rep_preal RS prealE_lemma4a) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   294
by (auto_tac (claset() addIs [prat_add_less2_mono1],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   295
qed "preal_add_set_lemma4";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   296
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   297
Goal "{w. ? x: Rep_preal R. ? y: Rep_preal S. w = x + y} : preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   298
by (rtac prealI2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   299
by (rtac preal_add_set_not_empty 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   300
by (rtac preal_add_set_not_prat_set 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   301
by (rtac preal_add_set_lemma3 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   302
by (rtac preal_add_set_lemma4 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   303
qed "preal_mem_add_set";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   304
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   305
Goalw [preal_add_def] "((x::preal) + y) + z = x + (y + z)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   306
by (res_inst_tac [("f","Abs_preal")] arg_cong 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   307
by (rtac set_ext 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   308
by (rtac (preal_mem_add_set RS Abs_preal_inverse RS ssubst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   309
by (rtac (preal_mem_add_set RS Abs_preal_inverse RS ssubst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   310
by (auto_tac (claset(),simpset() addsimps prat_add_ac));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   311
by (rtac bexI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   312
by (auto_tac (claset() addSIs [exI],simpset() addsimps prat_add_ac));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   313
qed "preal_add_assoc";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   314
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   315
qed_goal "preal_add_left_commute" thy
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   316
    "(z1::preal) + (z2 + z3) = z2 + (z1 + z3)"
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   317
 (fn _ => [rtac (preal_add_commute RS trans) 1, rtac (preal_add_assoc RS trans) 1,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   318
           rtac (preal_add_commute RS arg_cong) 1]);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   319
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   320
(* Positive Reals addition is an AC operator *)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   321
val preal_add_ac = [preal_add_assoc, preal_add_commute, preal_add_left_commute];
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   322
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   323
  (*** Properties of multiplication ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   324
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   325
(** Proofs essentially same as for addition **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   326
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   327
Goalw [preal_mult_def] "(x::preal) * y = y * x";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   328
by (res_inst_tac [("f","Abs_preal")] arg_cong 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   329
by (rtac set_ext 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   330
by (blast_tac (claset() addIs [prat_mult_commute RS subst]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   331
qed "preal_mult_commute";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   332
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   333
(** multiplication of two positive reals gives a positive real **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   334
(** lemmas for proving positive reals multiplication set in preal **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   335
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   336
(** Part 1 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   337
Goal "{} < {w. ? x: Rep_preal R. ? y:Rep_preal S. w = x * y}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   338
by (cut_facts_tac [mem_Rep_preal_Ex,mem_Rep_preal_Ex] 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   339
by (auto_tac (claset() addSIs [psubsetI] addEs [equalityCE],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   340
qed "preal_mult_set_not_empty";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   341
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   342
(** Part 2 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   343
Goal "? q. q  ~: {w. ? x: Rep_preal R. ? y:Rep_preal S. w = x * y}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   344
by (cut_inst_tac [("X","R")] not_mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   345
by (cut_inst_tac [("X","S")] not_mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   346
by (REPEAT(etac exE 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   347
by (REPEAT(dtac not_in_preal_ub 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   348
by (res_inst_tac [("x","x*xa")] exI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   349
by (Auto_tac  THEN (REPEAT(etac ballE 1)) THEN Auto_tac );
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   350
by (dtac prat_mult_less_mono 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   351
by (auto_tac (claset(),simpset() addsimps [prat_less_not_refl]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   352
qed "preal_not_mem_mult_set_Ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   353
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   354
Goal "{w. ? x: Rep_preal R. ? y:Rep_preal S. w = x * y} < {q. True}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   355
by (auto_tac (claset() addSIs [psubsetI],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   356
by (cut_inst_tac [("R","R"),("S","S")] preal_not_mem_mult_set_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   357
by (etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   358
by (eres_inst_tac [("c","q")] equalityCE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   359
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   360
qed "preal_mult_set_not_prat_set";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   361
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   362
(** Part 3 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   363
Goal "!y: {w. ? x: Rep_preal R. ? y: Rep_preal S. w = x * y}. \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   364
\         !z. z < y --> z : {w. ? x:Rep_preal R. ? y:Rep_preal S. w = x * y}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   365
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   366
by (forw_inst_tac [("x","qinv(ya)"),("q1.0","z")] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   367
    prat_mult_left_less2_mono1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   368
by (asm_full_simp_tac (simpset() addsimps prat_mult_ac) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   369
by (dtac (Rep_preal RS prealE_lemma3a) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   370
by (etac allE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   371
by (REPEAT(rtac bexI 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   372
by (auto_tac (claset(),simpset() addsimps [prat_mult_assoc]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   373
qed "preal_mult_set_lemma3";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   374
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   375
Goal "!y: {w. ? x: Rep_preal R. ? y: Rep_preal S. w = x * y}. \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   376
\         ? u: {w. ? x: Rep_preal R. ? y: Rep_preal S. w = x * y}. y < u";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   377
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   378
by (dtac (Rep_preal RS prealE_lemma4a) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   379
by (auto_tac (claset() addIs [prat_mult_less2_mono1],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   380
qed "preal_mult_set_lemma4";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   381
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   382
Goal "{w. ? x: Rep_preal R. ? y: Rep_preal S. w = x * y} : preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   383
by (rtac prealI2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   384
by (rtac preal_mult_set_not_empty 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   385
by (rtac preal_mult_set_not_prat_set 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   386
by (rtac preal_mult_set_lemma3 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   387
by (rtac preal_mult_set_lemma4 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   388
qed "preal_mem_mult_set";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   389
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   390
Goalw [preal_mult_def] "((x::preal) * y) * z = x * (y * z)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   391
by (res_inst_tac [("f","Abs_preal")] arg_cong 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   392
by (rtac set_ext 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   393
by (rtac (preal_mem_mult_set RS Abs_preal_inverse RS ssubst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   394
by (rtac (preal_mem_mult_set RS Abs_preal_inverse RS ssubst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   395
by (auto_tac (claset(),simpset() addsimps prat_mult_ac));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   396
by (rtac bexI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   397
by (auto_tac (claset() addSIs [exI],simpset() addsimps prat_mult_ac));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   398
qed "preal_mult_assoc";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   399
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   400
qed_goal "preal_mult_left_commute" thy
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   401
    "(z1::preal) * (z2 * z3) = z2 * (z1 * z3)"
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   402
 (fn _ => [rtac (preal_mult_commute RS trans) 1, 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   403
           rtac (preal_mult_assoc RS trans) 1,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   404
           rtac (preal_mult_commute RS arg_cong) 1]);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   405
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   406
(* Positive Reals multiplication is an AC operator *)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   407
val preal_mult_ac = [preal_mult_assoc, 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   408
                     preal_mult_commute, 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   409
                     preal_mult_left_commute];
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   410
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   411
(* Positive Real 1 is the multiplicative identity element *) 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   412
(* long *)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   413
Goalw [preal_prat_def,preal_mult_def] "(@#($#Abs_pnat 1)) * z = z";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   414
by (rtac (Rep_preal_inverse RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   415
by (res_inst_tac [("f","Abs_preal")] arg_cong 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   416
by (rtac (one_set_mem_preal RS Abs_preal_inverse RS ssubst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   417
by (rtac set_ext 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   418
by (auto_tac(claset(),simpset() addsimps [Rep_preal_inverse]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   419
by (EVERY1[dtac (Rep_preal RS prealE_lemma4a),etac bexE]);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   420
by (dtac prat_mult_less_mono 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   421
by (auto_tac (claset() addDs [Rep_preal RS prealE_lemma3a],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   422
by (EVERY1[forward_tac [Rep_preal RS prealE_lemma4a],etac bexE]);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   423
by (forw_inst_tac [("x","qinv(u)"),("q1.0","x")] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   424
    prat_mult_less2_mono1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   425
by (rtac exI 1 THEN Auto_tac THEN res_inst_tac [("x","u")] bexI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   426
by (auto_tac (claset(),simpset() addsimps [prat_mult_assoc]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   427
qed "preal_mult_1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   428
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   429
Goal "z * (@#($#Abs_pnat 1)) = z";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   430
by (rtac (preal_mult_commute RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   431
by (rtac preal_mult_1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   432
qed "preal_mult_1_right";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   433
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   434
(** Lemmas **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   435
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   436
qed_goal "preal_add_assoc_cong" thy
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   437
    "!!z. (z::preal) + v = z' + v' ==> z + (v + w) = z' + (v' + w)"
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   438
 (fn _ => [(asm_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1)]);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   439
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   440
qed_goal "preal_add_assoc_swap" thy "(z::preal) + (v + w) = v + (z + w)"
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   441
 (fn _ => [(REPEAT (ares_tac [preal_add_commute RS preal_add_assoc_cong] 1))]);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   442
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   443
(** Distribution of multiplication across addition **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   444
(** lemmas for the proof **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   445
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   446
 (** lemmas **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   447
Goalw [preal_add_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   448
      "!!R. z: Rep_preal(R+S) ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   449
\           ? x: Rep_preal(R). ? y: Rep_preal(S). z = x + y";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   450
by (dtac (preal_mem_add_set RS Abs_preal_inverse RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   451
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   452
qed "mem_Rep_preal_addD";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   453
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   454
Goalw [preal_add_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   455
      "!!R. ? x: Rep_preal(R). ? y: Rep_preal(S). z = x + y \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   456
\      ==> z: Rep_preal(R+S)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   457
by (rtac (preal_mem_add_set RS Abs_preal_inverse RS ssubst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   458
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   459
qed "mem_Rep_preal_addI";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   460
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   461
Goal " z: Rep_preal(R+S) = (? x: Rep_preal(R). \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   462
\                                 ? y: Rep_preal(S). z = x + y)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   463
by (fast_tac (claset() addSIs [mem_Rep_preal_addD,mem_Rep_preal_addI]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   464
qed "mem_Rep_preal_add_iff";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   465
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   466
Goalw [preal_mult_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   467
      "!!R. z: Rep_preal(R*S) ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   468
\           ? x: Rep_preal(R). ? y: Rep_preal(S). z = x * y";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   469
by (dtac (preal_mem_mult_set RS Abs_preal_inverse RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   470
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   471
qed "mem_Rep_preal_multD";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   472
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   473
Goalw [preal_mult_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   474
      "!!R. ? x: Rep_preal(R). ? y: Rep_preal(S). z = x * y \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   475
\      ==> z: Rep_preal(R*S)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   476
by (rtac (preal_mem_mult_set RS Abs_preal_inverse RS ssubst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   477
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   478
qed "mem_Rep_preal_multI";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   479
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   480
Goal " z: Rep_preal(R*S) = (? x: Rep_preal(R). \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   481
\                                 ? y: Rep_preal(S). z = x * y)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   482
by (fast_tac (claset() addSIs [mem_Rep_preal_multD,mem_Rep_preal_multI]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   483
qed "mem_Rep_preal_mult_iff";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   484
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   485
(** More lemmas for preal_add_mult_distrib2 **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   486
goal PRat.thy "!!(a1::prat). a1 < a2 ==> a1 * b + a2 * c < a2 * (b + c)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   487
by (auto_tac (claset() addSIs [prat_add_less2_mono1,prat_mult_less2_mono1],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   488
              simpset() addsimps [prat_add_mult_distrib2]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   489
qed "lemma_prat_add_mult_mono";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   490
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   491
Goal "!!xb. [| xb: Rep_preal z1; xc: Rep_preal z2; ya: \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   492
\                  Rep_preal w; yb: Rep_preal w |] ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   493
\                  xb * ya + xc * yb: Rep_preal (z1 * w + z2 * w)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   494
by (fast_tac (claset() addIs [mem_Rep_preal_addI,mem_Rep_preal_multI]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   495
qed "lemma_add_mult_mem_Rep_preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   496
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   497
Goal "!!xb. [| xb: Rep_preal z1; xc: Rep_preal z2; ya: \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   498
\                  Rep_preal w; yb: Rep_preal w |] ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   499
\                  yb*(xb + xc): Rep_preal (w*(z1 + z2))";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   500
by (fast_tac (claset() addIs [mem_Rep_preal_addI,mem_Rep_preal_multI]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   501
qed "lemma_add_mult_mem_Rep_preal1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   502
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   503
Goal "!!x. x: Rep_preal (w * z1 + w * z2) ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   504
\              x: Rep_preal (w * (z1 + z2))";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   505
by (auto_tac (claset() addSDs [mem_Rep_preal_addD,mem_Rep_preal_multD],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   506
              simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   507
by (forw_inst_tac [("ya","xb"),("yb","xc"),("xb","ya"),("xc","yb")] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   508
                                   lemma_add_mult_mem_Rep_preal1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   509
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   510
by (res_inst_tac [("q1.0","xb"),("q2.0","xc")] prat_linear_less2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   511
by (dres_inst_tac [("b","ya"),("c","yb")] lemma_prat_add_mult_mono 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   512
by (rtac (Rep_preal RS prealE_lemma3b) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   513
by (auto_tac (claset(),simpset() addsimps [prat_add_mult_distrib2]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   514
by (dres_inst_tac [("ya","xc"),("yb","xb"),("xc","ya"),("xb","yb")] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   515
                                   lemma_add_mult_mem_Rep_preal1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   516
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   517
by (dres_inst_tac [("b","yb"),("c","ya")] lemma_prat_add_mult_mono 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   518
by (rtac (Rep_preal RS prealE_lemma3b) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   519
by (thin_tac "xc * ya + xc * yb  : Rep_preal (w * (z1 + z2))" 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   520
by (auto_tac (claset(),simpset() addsimps [prat_add_mult_distrib,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   521
              prat_add_commute] @ preal_add_ac ));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   522
qed "lemma_preal_add_mult_distrib";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   523
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   524
Goal "!!x. x: Rep_preal (w * (z1 + z2)) ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   525
\              x: Rep_preal (w * z1 + w * z2)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   526
by (auto_tac (claset() addSDs [mem_Rep_preal_addD,mem_Rep_preal_multD]
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   527
              addSIs [bexI,mem_Rep_preal_addI,mem_Rep_preal_multI],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   528
              simpset() addsimps [prat_add_mult_distrib2]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   529
qed "lemma_preal_add_mult_distrib2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   530
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   531
Goal "(w * ((z1::preal) + z2)) = (w * z1) + (w * z2)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   532
by (rtac (inj_Rep_preal RS injD) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   533
by (rtac set_ext 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   534
by (fast_tac (claset() addIs [lemma_preal_add_mult_distrib,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   535
                       lemma_preal_add_mult_distrib2]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   536
qed "preal_add_mult_distrib2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   537
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   538
Goal "(((z1::preal) + z2) * w) = (z1 * w) + (z2 * w)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   539
by (simp_tac (simpset() addsimps [preal_mult_commute,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   540
                       preal_add_mult_distrib2]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   541
qed "preal_add_mult_distrib";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   542
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   543
(*** Prove existence of inverse ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   544
(*** Inverse is a positive real ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   545
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   546
Goal "? y. qinv(y) ~:  Rep_preal X";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   547
by (cut_inst_tac [("X","X")] not_mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   548
by (etac exE 1 THEN cut_inst_tac [("x","x")] prat_as_inverse_ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   549
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   550
qed "qinv_not_mem_Rep_preal_Ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   551
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   552
Goal "? q. q: {x. ? y. x < y & qinv y ~:  Rep_preal A}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   553
by (cut_inst_tac [("X","A")] qinv_not_mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   554
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   555
by (cut_inst_tac [("y","y")] qless_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   556
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   557
qed "lemma_preal_mem_inv_set_ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   558
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   559
(** Part 1 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   560
Goal "{} < {x. ? y. x < y & qinv y ~:  Rep_preal A}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   561
by (cut_facts_tac [lemma_preal_mem_inv_set_ex] 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   562
by (auto_tac (claset() addSIs [psubsetI] addEs [equalityCE],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   563
qed "preal_inv_set_not_empty";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   564
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   565
(** Part 2 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   566
Goal "? y. qinv(y) :  Rep_preal X";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   567
by (cut_inst_tac [("X","X")] mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   568
by (etac exE 1 THEN cut_inst_tac [("x","x")] prat_as_inverse_ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   569
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   570
qed "qinv_mem_Rep_preal_Ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   571
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   572
Goal "? x. x ~: {x. ? y. x < y & qinv y ~:  Rep_preal A}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   573
by (rtac ccontr 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   574
by (cut_inst_tac [("X","A")] qinv_mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   575
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   576
by (EVERY1[etac allE, etac exE, etac conjE]);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   577
by (dtac qinv_prat_less 1 THEN dtac not_in_preal_ub 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   578
by (eres_inst_tac [("x","qinv y")] ballE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   579
by (dtac prat_less_trans 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   580
by (auto_tac (claset(),simpset() addsimps [prat_less_not_refl]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   581
qed "preal_not_mem_inv_set_Ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   582
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   583
Goal "{x. ? y. x < y & qinv y ~:  Rep_preal A} < {q. True}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   584
by (auto_tac (claset() addSIs [psubsetI],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   585
by (cut_inst_tac [("A","A")]  preal_not_mem_inv_set_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   586
by (etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   587
by (eres_inst_tac [("c","x")] equalityCE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   588
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   589
qed "preal_inv_set_not_prat_set";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   590
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   591
(** Part 3 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   592
Goal "! y: {x. ? y. x < y & qinv y ~: Rep_preal A}. \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   593
 \      !z. z < y --> z : {x. ? y. x < y & qinv y ~: Rep_preal A}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   594
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   595
by (res_inst_tac [("x","ya")] exI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   596
by (auto_tac (claset() addIs [prat_less_trans],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   597
qed "preal_inv_set_lemma3";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   598
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   599
Goal "! y: {x. ? y. x < y & qinv y ~: Rep_preal A}. \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   600
\       Bex {x. ? y. x < y & qinv y ~: Rep_preal A} (op < y)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   601
by (blast_tac (claset() addDs [prat_dense]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   602
qed "preal_inv_set_lemma4";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   603
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   604
Goal "{x. ? y. x < y & qinv(y) ~: Rep_preal(A)} : preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   605
by (rtac prealI2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   606
by (rtac preal_inv_set_not_empty 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   607
by (rtac preal_inv_set_not_prat_set 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   608
by (rtac preal_inv_set_lemma3 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   609
by (rtac preal_inv_set_lemma4 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   610
qed "preal_mem_inv_set";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   611
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   612
(*more lemmas for inverse *)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   613
Goal "!!x. x: Rep_preal(pinv(A)*A) ==> x: Rep_preal(@#($#Abs_pnat 1))";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   614
by (auto_tac (claset() addSDs [mem_Rep_preal_multD],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   615
              simpset() addsimps [pinv_def,preal_prat_def] ));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   616
by (dtac (preal_mem_inv_set RS Abs_preal_inverse RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   617
by (auto_tac (claset() addSDs [not_in_preal_ub],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   618
by (dtac prat_mult_less_mono 1 THEN Blast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   619
by (auto_tac (claset(),simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   620
qed "preal_mem_mult_invD";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   621
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   622
(*** Gleason's Lemma 9-3.4 p 122 ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   623
Goal "!!p. ! xa : Rep_preal(A). xa + x : Rep_preal(A) ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   624
\            ? xb : Rep_preal(A). xb + ($#p)*x : Rep_preal(A)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   625
by (cut_facts_tac [mem_Rep_preal_Ex] 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   626
by (res_inst_tac [("n","p")] pnat_induct 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   627
by (auto_tac (claset(),simpset() addsimps [pnat_one_def,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   628
    pSuc_is_plus_one,prat_add_mult_distrib,prat_pnat_add,prat_add_assoc RS sym]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   629
qed "lemma1_gleason9_34";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   630
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   631
Goal "Abs_prat (ratrel ^^ {(y, z)}) < xb + \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   632
\         Abs_prat (ratrel ^^ {(x*y, Abs_pnat 1)})*Abs_prat (ratrel ^^ {(w, x)})";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   633
by (res_inst_tac [("j","Abs_prat (ratrel ^^ {(x * y, Abs_pnat 1)}) *\
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   634
\                   Abs_prat (ratrel ^^ {(w, x)})")] prat_le_less_trans 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   635
by (rtac prat_self_less_add_right 2);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   636
by (auto_tac (claset() addIs [lemma_Abs_prat_le3],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   637
    simpset() addsimps [prat_mult,pre_lemma_gleason9_34b,pnat_mult_assoc]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   638
qed "lemma1b_gleason9_34";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   639
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   640
Goal "!!A. ! xa : Rep_preal(A). xa + x : Rep_preal(A) ==> False";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   641
by (cut_inst_tac [("X","A")] not_mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   642
by (etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   643
by (dtac not_in_preal_ub 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   644
by (res_inst_tac [("z","x")] eq_Abs_prat 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   645
by (res_inst_tac [("z","xa")] eq_Abs_prat 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   646
by (dres_inst_tac [("p","y*xb")] lemma1_gleason9_34 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   647
by (etac bexE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   648
by (cut_inst_tac [("x","y"),("y","xb"),("w","xaa"),
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   649
    ("z","ya"),("xb","xba")] lemma1b_gleason9_34 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   650
by (dres_inst_tac [("x","xba + $#(y * xb) * x")]  bspec 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   651
by (auto_tac (claset() addIs [prat_less_asym],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   652
    simpset() addsimps [prat_pnat_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   653
qed "lemma_gleason9_34a";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   654
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   655
Goal "? r: Rep_preal(R). r + x ~: Rep_preal(R)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   656
by (rtac ccontr 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   657
by (blast_tac (claset() addIs [lemma_gleason9_34a]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   658
qed "lemma_gleason9_34";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   659
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   660
(*** Gleason's Lemma 9-3.6  ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   661
(*  lemmas for Gleason 9-3.6  *)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   662
(*                            *) 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   663
(******************************)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   664
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   665
Goal "r + r*qinv(xa)*Q3 = r*qinv(xa)*(xa + Q3)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   666
by (full_simp_tac (simpset() addsimps [prat_add_mult_distrib2,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   667
    prat_mult_assoc]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   668
qed "lemma1_gleason9_36";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   669
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   670
Goal "r*qinv(xa)*(xa*x) = r*x";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   671
by (full_simp_tac (simpset() addsimps prat_mult_ac) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   672
qed "lemma2_gleason9_36";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   673
(******)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   674
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   675
(*** FIXME: long! ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   676
Goal "!!A. $#1p < x ==> ? r: Rep_preal(A). r*x ~: Rep_preal(A)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   677
by (res_inst_tac [("X1","A")] (mem_Rep_preal_Ex RS exE) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   678
by (res_inst_tac [("Q","xa*x : Rep_preal(A)")] (excluded_middle RS disjE) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   679
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   680
by (dres_inst_tac [("x","xa")] prat_self_less_mult_right 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   681
by (etac prat_lessE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   682
by (cut_inst_tac [("R","A"),("x","Q3")] lemma_gleason9_34 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   683
by (dtac sym 1 THEN Auto_tac );
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   684
by (forward_tac [not_in_preal_ub] 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   685
by (dres_inst_tac [("x","xa + Q3")] bspec 1 THEN assume_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   686
by (dtac prat_add_right_less_cancel 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   687
by (dres_inst_tac [("x","qinv(xa)*Q3")] prat_mult_less2_mono1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   688
by (dres_inst_tac [("x","r")] prat_add_less2_mono2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   689
by (asm_full_simp_tac (simpset() addsimps
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   690
    [prat_mult_assoc RS sym,lemma1_gleason9_36]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   691
by (dtac sym 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   692
by (auto_tac (claset(),simpset() addsimps [lemma2_gleason9_36]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   693
by (res_inst_tac [("x","r")] bexI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   694
by (rtac notI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   695
by (dres_inst_tac [("y","r*x")] (Rep_preal RS prealE_lemma3b) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   696
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   697
qed "lemma_gleason9_36";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   698
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   699
Goal "!!A. $#Abs_pnat 1 < x ==> ? r: Rep_preal(A). r*x ~: Rep_preal(A)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   700
by (rtac lemma_gleason9_36 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   701
by (asm_simp_tac (simpset() addsimps [pnat_one_def]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   702
qed "lemma_gleason9_36a";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   703
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   704
(*** Part 2 of existence of inverse ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   705
Goal "!!x. x: Rep_preal(@#($#Abs_pnat 1)) ==> x: Rep_preal(pinv(A)*A)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   706
by (auto_tac (claset() addSIs [mem_Rep_preal_multI],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   707
              simpset() addsimps [pinv_def,preal_prat_def] ));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   708
by (rtac (preal_mem_inv_set RS Abs_preal_inverse RS ssubst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   709
by (dtac prat_qinv_gt_1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   710
by (dres_inst_tac [("A","A")] lemma_gleason9_36a 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   711
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   712
by (dtac (Rep_preal RS prealE_lemma4a) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   713
by (Auto_tac  THEN dtac qinv_prat_less 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   714
by (res_inst_tac [("x","qinv(u)*x")] exI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   715
by (rtac conjI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   716
by (res_inst_tac [("x","qinv(r)*x")] exI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   717
by (auto_tac (claset() addIs [prat_mult_less2_mono1],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   718
    simpset() addsimps [qinv_mult_eq,qinv_qinv]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   719
by (res_inst_tac [("x","u")] bexI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   720
by (auto_tac (claset(),simpset() addsimps [prat_mult_assoc,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   721
    prat_mult_left_commute]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   722
qed "preal_mem_mult_invI";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   723
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   724
Goal "pinv(A)*A = (@#($#Abs_pnat 1))";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   725
by (rtac (inj_Rep_preal RS injD) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   726
by (rtac set_ext 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   727
by (fast_tac (claset() addDs [preal_mem_mult_invD,preal_mem_mult_invI]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   728
qed "preal_mult_inv";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   729
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   730
Goal "A*pinv(A) = (@#($#Abs_pnat 1))";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   731
by (rtac (preal_mult_commute RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   732
by (rtac preal_mult_inv 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   733
qed "preal_mult_inv_right";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   734
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   735
val [prem] = goal thy
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   736
    "(!!u. z = Abs_preal(u) ==> P) ==> P";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   737
by (cut_inst_tac [("x1","z")] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   738
    (rewrite_rule [preal_def] (Rep_preal RS Abs_preal_inverse)) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   739
by (res_inst_tac [("u","Rep_preal z")] prem 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   740
by (dtac (inj_Rep_preal RS injD) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   741
by (Asm_simp_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   742
qed "eq_Abs_preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   743
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   744
(*** Lemmas/Theorem(s) need lemma_gleason9_34 ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   745
Goal "Rep_preal (R1) <= Rep_preal(R1 + R2)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   746
by (cut_inst_tac [("X","R2")] mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   747
by (auto_tac (claset() addSIs [bexI] addIs [(Rep_preal RS prealE_lemma3b),
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   748
   prat_self_less_add_left,mem_Rep_preal_addI],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   749
qed "Rep_preal_self_subset";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   750
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   751
Goal "~ Rep_preal (R1 + R2) <= Rep_preal(R1)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   752
by (cut_inst_tac [("X","R2")] mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   753
by (etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   754
by (cut_inst_tac [("R","R1")] lemma_gleason9_34 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   755
by (auto_tac (claset() addIs [mem_Rep_preal_addI],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   756
qed "Rep_preal_sum_not_subset";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   757
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   758
Goal "Rep_preal (R1 + R2) ~= Rep_preal(R1)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   759
by (rtac notI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   760
by (etac equalityE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   761
by (asm_full_simp_tac (simpset() addsimps [Rep_preal_sum_not_subset]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   762
qed "Rep_preal_sum_not_eq";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   763
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   764
(*** at last --- Gleason prop. 9-3.5(iii) p. 123 ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   765
Goalw [preal_less_def,psubset_def] "(R1::preal) < R1 + R2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   766
by (simp_tac (simpset() addsimps [Rep_preal_self_subset,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   767
    Rep_preal_sum_not_eq RS not_sym]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   768
qed "preal_self_less_add_left";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   769
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   770
Goal "(R1::preal) < R2 + R1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   771
by (simp_tac (simpset() addsimps [preal_add_commute,preal_self_less_add_left]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   772
qed "preal_self_less_add_right";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   773
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   774
(*** Properties of <= ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   775
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   776
Goalw [preal_le_def,psubset_def,preal_less_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   777
                     "!!w. z<=w ==> ~(w<(z::preal))";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   778
by (auto_tac  (claset() addDs [equalityI],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   779
qed "preal_leD";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   780
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   781
val preal_leE = make_elim preal_leD;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   782
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   783
Goalw [preal_le_def,psubset_def,preal_less_def]
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   784
                   "!!z. ~ z <= w ==> w<(z::preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   785
by (cut_inst_tac [("r1.0","w"),("r2.0","z")] preal_linear 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   786
by (auto_tac  (claset(),simpset() addsimps [preal_less_def,psubset_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   787
qed "not_preal_leE";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   788
		       
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   789
Goal "!!w. ~(w < z) ==> z <= (w::preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   790
by (fast_tac (claset() addIs [not_preal_leE]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   791
qed "preal_leI";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   792
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   793
Goal "!!w. (~(w < z)) = (z <= (w::preal))";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   794
by (fast_tac (claset() addSIs [preal_leI,preal_leD]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   795
qed "preal_less_le_iff";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   796
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   797
Goalw [preal_le_def,preal_less_def,psubset_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   798
                  "!!z. z < w ==> z <= (w::preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   799
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   800
qed "preal_less_imp_le";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   801
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   802
Goalw [preal_le_def,preal_less_def,psubset_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   803
                      "!!(x::preal). x <= y ==> x < y | x = y";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   804
by (auto_tac (claset() addIs [inj_Rep_preal RS injD],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   805
qed "preal_le_imp_less_or_eq";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   806
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   807
Goalw [preal_le_def,preal_less_def,psubset_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   808
                       "!!(x::preal). x < y | x = y ==> x <=y";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   809
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   810
qed "preal_less_or_eq_imp_le";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   811
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   812
Goal "(x <= (y::preal)) = (x < y | x=y)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   813
by (REPEAT(ares_tac [iffI, preal_less_or_eq_imp_le, preal_le_imp_less_or_eq] 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   814
qed "preal_le_eq_less_or_eq";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   815
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   816
Goalw [preal_le_def] "w <= (w::preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   817
by (Simp_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   818
qed "preal_le_refl";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   819
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   820
val prems = goal thy "!!i. [| i <= j; j < k |] ==> i < (k::preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   821
by (dtac preal_le_imp_less_or_eq 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   822
by (fast_tac (claset() addIs [preal_less_trans]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   823
qed "preal_le_less_trans";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   824
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   825
val prems = goal thy "!!i. [| i < j; j <= k |] ==> i < (k::preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   826
by (dtac preal_le_imp_less_or_eq 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   827
by (fast_tac (claset() addIs [preal_less_trans]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   828
qed "preal_less_le_trans";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   829
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   830
Goal "!!i. [| i <= j; j <= k |] ==> i <= (k::preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   831
by (EVERY1 [dtac preal_le_imp_less_or_eq, dtac preal_le_imp_less_or_eq,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   832
            rtac preal_less_or_eq_imp_le, fast_tac (claset() addIs [preal_less_trans])]);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   833
qed "preal_le_trans";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   834
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   835
Goal "!!z. [| z <= w; w <= z |] ==> z = (w::preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   836
by (EVERY1 [dtac preal_le_imp_less_or_eq, dtac preal_le_imp_less_or_eq,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   837
            fast_tac (claset() addEs [preal_less_irrefl,preal_less_asym])]);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   838
qed "preal_le_anti_sym";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   839
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   840
Goal "!!x. [| ~ y < x; y ~= x |] ==> x < (y::preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   841
by (rtac not_preal_leE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   842
by (fast_tac (claset() addDs [preal_le_imp_less_or_eq]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   843
qed "not_less_not_eq_preal_less";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   844
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   845
(****)(****)(****)(****)(****)(****)(****)(****)(****)(****)(****)(****)(****)(****)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   846
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   847
(**** Set up all lemmas for proving A < B ==> ?D. A + D = B ****)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   848
(**** Gleason prop. 9-3.5(iv) p. 123 ****)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   849
(**** Define the D required and show that it is a positive real ****)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   850
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   851
(* useful lemmas - proved elsewhere? *)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   852
Goalw [psubset_def] "!!A. A < B ==> ? x. x ~: A & x : B";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   853
by (etac conjE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   854
by (etac swap 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   855
by (etac equalityI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   856
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   857
qed "lemma_psubset_mem";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   858
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   859
Goalw [psubset_def] "~ (A::'a set) < A";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   860
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   861
qed "lemma_psubset_not_refl";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   862
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   863
Goalw [psubset_def] "!!(A::'a set). [| A < B; B < C |] ==> A < C";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   864
by (auto_tac (claset() addDs [subset_antisym],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   865
qed "psubset_trans";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   866
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   867
Goalw [psubset_def] "!!(A::'a set). [| A <= B; B < C |] ==> A < C";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   868
by (auto_tac (claset() addDs [subset_antisym],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   869
qed "subset_psubset_trans";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   870
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   871
Goalw [psubset_def] "!!(A::'a set). [| A < B; B <= C |] ==> A < C";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   872
by (auto_tac (claset() addDs [subset_antisym],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   873
qed "subset_psubset_trans2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   874
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   875
Goalw [psubset_def] "!!(A::'a set). [| A < B; c : A |] ==> c : B";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   876
by (auto_tac (claset() addDs [subsetD],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   877
qed "psubsetD";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   878
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   879
(** Part 1 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   880
Goalw [preal_less_def]
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   881
     "!!A. A < B ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   882
\     ? q. q : {d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   883
by (EVERY1[dtac lemma_psubset_mem, etac exE, etac conjE]);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   884
by (dres_inst_tac [("x1","B")] (Rep_preal RS prealE_lemma4a) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   885
by (auto_tac (claset(),simpset() addsimps [prat_less_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   886
qed "lemma_ex_mem_less_left_add1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   887
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   888
Goal
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   889
     "!!A. A < B ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   890
\       {} < {d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   891
by (dtac lemma_ex_mem_less_left_add1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   892
by (auto_tac (claset() addSIs [psubsetI] addEs [equalityCE],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   893
qed "preal_less_set_not_empty";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   894
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   895
(** Part 2 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   896
Goal "? q. q ~: {d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   897
by (cut_inst_tac [("X","B")] not_mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   898
by (etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   899
by (res_inst_tac [("x","x")] exI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   900
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   901
by (cut_inst_tac [("x","x"),("y","n")] prat_self_less_add_right 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   902
by (auto_tac (claset() addDs [Rep_preal RS prealE_lemma3b],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   903
qed "lemma_ex_not_mem_less_left_add1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   904
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   905
Goal "{d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)} < {q. True}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   906
by (auto_tac (claset() addSIs [psubsetI],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   907
by (cut_inst_tac [("A","A"),("B","B")] lemma_ex_not_mem_less_left_add1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   908
by (etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   909
by (eres_inst_tac [("c","q")] equalityCE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   910
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   911
qed "preal_less_set_not_prat_set";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   912
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   913
(** Part 3 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   914
Goal "!!A. A < B ==> ! y: {d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)}. \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   915
 \      !z. z < y --> z : {d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   916
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   917
by (dres_inst_tac [("x","n")] prat_add_less2_mono2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   918
by (dtac (Rep_preal RS prealE_lemma3b) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   919
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   920
qed "preal_less_set_lemma3";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   921
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   922
Goal "!!A. A < B ==> ! y: {d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)}. \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   923
\       Bex {d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)} (op < y)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   924
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   925
by (dtac (Rep_preal RS prealE_lemma4a) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   926
by (auto_tac (claset(),simpset() addsimps [prat_less_def,prat_add_assoc]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   927
qed "preal_less_set_lemma4";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   928
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   929
Goal 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   930
     "!! (A::preal). A < B ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   931
\     {d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)}: preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   932
by (rtac prealI2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   933
by (rtac preal_less_set_not_empty 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   934
by (rtac preal_less_set_not_prat_set 2);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   935
by (rtac preal_less_set_lemma3 2);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   936
by (rtac preal_less_set_lemma4 3);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   937
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   938
qed "preal_mem_less_set";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   939
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   940
(** proving that A + D <= B **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   941
Goalw [preal_le_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   942
       "!! (A::preal). A < B ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   943
\         A + Abs_preal({d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)}) <= B";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   944
by (rtac subsetI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   945
by (dtac mem_Rep_preal_addD 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   946
by (auto_tac (claset(),simpset() addsimps [
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   947
    preal_mem_less_set RS Abs_preal_inverse]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   948
by (dtac not_in_preal_ub 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   949
by (dtac bspec 1 THEN assume_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   950
by (dres_inst_tac [("x","y")] prat_add_less2_mono1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   951
by (dres_inst_tac [("x1","B")] (Rep_preal RS prealE_lemma3b) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   952
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   953
qed "preal_less_add_left_subsetI";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   954
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   955
(** proving that B <= A + D  --- trickier **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   956
(** lemma **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   957
Goal "!!x. x : Rep_preal(B) ==> ? e. x + e : Rep_preal(B)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   958
by (dtac (Rep_preal RS prealE_lemma4a) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   959
by (auto_tac (claset(),simpset() addsimps [prat_less_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   960
qed "lemma_sum_mem_Rep_preal_ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   961
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   962
Goalw [preal_le_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   963
       "!! (A::preal). A < B ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   964
\         B <= A + Abs_preal({d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)})";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   965
by (rtac subsetI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   966
by (res_inst_tac [("Q","x: Rep_preal(A)")] (excluded_middle RS disjE) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   967
by (rtac mem_Rep_preal_addI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   968
by (dtac lemma_sum_mem_Rep_preal_ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   969
by (etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   970
by (cut_inst_tac [("R","A"),("x","e")] lemma_gleason9_34 1 THEN etac bexE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   971
by (dtac not_in_preal_ub 1 THEN dtac bspec 1 THEN assume_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   972
by (etac prat_lessE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   973
by (res_inst_tac [("x","r")] bexI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   974
by (res_inst_tac [("x","Q3")] bexI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   975
by (cut_facts_tac [Rep_preal_self_subset] 4);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   976
by (auto_tac (claset(),simpset() addsimps [
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   977
    preal_mem_less_set RS Abs_preal_inverse]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   978
by (res_inst_tac [("x","r+e")] exI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   979
by (asm_full_simp_tac (simpset() addsimps prat_add_ac) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   980
qed "preal_less_add_left_subsetI2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   981
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   982
(*** required proof ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   983
Goal "!! (A::preal). A < B ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   984
\         A + Abs_preal({d. ? n. n ~: Rep_preal(A) & n + d : Rep_preal(B)}) = B";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   985
by (blast_tac (claset() addIs [preal_le_anti_sym,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   986
                preal_less_add_left_subsetI,preal_less_add_left_subsetI2]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   987
qed "preal_less_add_left";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   988
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   989
Goal "!! (A::preal). A < B ==> ? D. A + D = B";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   990
by (fast_tac (claset() addDs [preal_less_add_left]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   991
qed "preal_less_add_left_Ex";        
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   992
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   993
Goal "!!(A::preal). A < B ==> A + C < B + C";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   994
by (auto_tac (claset() addSDs [preal_less_add_left_Ex],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   995
    simpset() addsimps [preal_add_assoc]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   996
by (res_inst_tac [("y1","D")] (preal_add_commute RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   997
by (auto_tac (claset() addIs [preal_self_less_add_left],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   998
          simpset() addsimps [preal_add_assoc RS sym]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
   999
qed "preal_add_less2_mono1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1000
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1001
Goal "!!(A::preal). A < B ==> C + A < C + B";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1002
by (auto_tac (claset() addIs [preal_add_less2_mono1],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1003
    simpset() addsimps [preal_add_commute]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1004
qed "preal_add_less2_mono2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1005
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1006
Goal 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1007
      "!!(q1::preal). q1 < q2 ==> q1 * x < q2 * x";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1008
by (dtac preal_less_add_left_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1009
by (auto_tac (claset(),simpset() addsimps [preal_add_mult_distrib,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1010
    preal_self_less_add_left]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1011
qed "preal_mult_less_mono1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1012
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1013
Goal "!!(q1::preal). q1 < q2  ==> x * q1 < x * q2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1014
by (auto_tac (claset() addDs [preal_mult_less_mono1],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1015
    simpset() addsimps [preal_mult_commute]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1016
qed "preal_mult_left_less_mono1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1017
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1018
Goal "!!(q1::preal). q1 <= q2  ==> x * q1 <= x * q2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1019
by (dtac preal_le_imp_less_or_eq 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1020
by (Step_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1021
by (auto_tac (claset() addSIs [preal_le_refl,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1022
    preal_less_imp_le,preal_mult_left_less_mono1],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1023
qed "preal_mult_left_le_mono1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1024
 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1025
Goal "!!(q1::preal). q1 <= q2  ==> q1 * x <= q2 * x";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1026
by (auto_tac (claset() addDs [preal_mult_left_le_mono1],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1027
    simpset() addsimps [preal_mult_commute]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1028
qed "preal_mult_le_mono1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1029
 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1030
Goal "!!(q1::preal). q1 <= q2  ==> x + q1 <= x + q2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1031
by (dtac preal_le_imp_less_or_eq 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1032
by (Step_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1033
by (auto_tac (claset() addSIs [preal_le_refl,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1034
    preal_less_imp_le,preal_add_less2_mono1],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1035
    simpset() addsimps [preal_add_commute]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1036
qed "preal_add_left_le_mono1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1037
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1038
Goal "!!(q1::preal). q1 <= q2  ==> q1 + x <= q2 + x";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1039
by (auto_tac (claset() addDs [preal_add_left_le_mono1],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1040
    simpset() addsimps [preal_add_commute]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1041
qed "preal_add_le_mono1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1042
 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1043
Goal "!!k l::preal. [|i<=j;  k<=l |] ==> i + k <= j + l";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1044
by (etac (preal_add_le_mono1 RS preal_le_trans) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1045
by (simp_tac (simpset() addsimps [preal_add_commute]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1046
(*j moves to the end because it is free while k, l are bound*)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1047
by (etac preal_add_le_mono1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1048
qed "preal_add_le_mono";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1049
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1050
Goal "!!(A::preal). A + C < B + C ==> A < B";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1051
by (cut_facts_tac [preal_linear] 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1052
by (auto_tac (claset() addEs [preal_less_irrefl],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1053
by (dres_inst_tac [("A","B"),("C","C")] preal_add_less2_mono1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1054
by (fast_tac (claset() addDs [preal_less_trans] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1055
                addEs [preal_less_irrefl]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1056
qed "preal_add_right_less_cancel";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1057
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1058
Goal "!!(A::preal). C + A < C + B ==> A < B";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1059
by (auto_tac (claset() addEs [preal_add_right_less_cancel],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1060
              simpset() addsimps [preal_add_commute]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1061
qed "preal_add_left_less_cancel";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1062
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1063
Goal "((A::preal) + C < B + C) = (A < B)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1064
by (REPEAT(ares_tac [iffI,preal_add_less2_mono1,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1065
    preal_add_right_less_cancel] 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1066
qed "preal_add_less_iff1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1067
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1068
Addsimps [preal_add_less_iff1];
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1069
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1070
Goal "(C + (A::preal) < C + B) = (A < B)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1071
by (REPEAT(ares_tac [iffI,preal_add_less2_mono2,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1072
    preal_add_left_less_cancel] 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1073
qed "preal_add_less_iff2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1074
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1075
Addsimps [preal_add_less_iff2];
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1076
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1077
Goal 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1078
      "!!x1. [| x1 < y1; x2 < y2 |] ==> x1 + x2 < y1 + (y2::preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1079
by (auto_tac (claset() addSDs [preal_less_add_left_Ex],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1080
    simpset() addsimps  preal_add_ac));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1081
by (rtac (preal_add_assoc RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1082
by (rtac preal_self_less_add_right 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1083
qed "preal_add_less_mono";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1084
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1085
Goal 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1086
      "!!x1. [| x1 < y1; x2 < y2 |] ==> x1 * x2 < y1 * (y2::preal)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1087
by (auto_tac (claset() addSDs [preal_less_add_left_Ex],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1088
              simpset() addsimps [preal_add_mult_distrib,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1089
              preal_add_mult_distrib2,preal_self_less_add_left,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1090
              preal_add_assoc] @ preal_mult_ac));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1091
qed "preal_mult_less_mono";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1092
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1093
Goal "!!(A::preal). A + C = B + C ==> A = B";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1094
by (cut_facts_tac [preal_linear] 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1095
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1096
by (ALLGOALS(dres_inst_tac [("C","C")] preal_add_less2_mono1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1097
by (auto_tac (claset() addEs [preal_less_irrefl],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1098
qed "preal_add_right_cancel";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1099
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1100
Goal "!!(A::preal). C + A = C + B ==> A = B";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1101
by (auto_tac (claset() addIs [preal_add_right_cancel],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1102
              simpset() addsimps [preal_add_commute]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1103
qed "preal_add_left_cancel";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1104
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1105
Goal "(C + A = C + B) = ((A::preal) = B)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1106
by (fast_tac (claset() addIs [preal_add_left_cancel]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1107
qed "preal_add_left_cancel_iff";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1108
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1109
Goal "(A + C = B + C) = ((A::preal) = B)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1110
by (fast_tac (claset() addIs [preal_add_right_cancel]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1111
qed "preal_add_right_cancel_iff";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1112
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1113
Addsimps [preal_add_left_cancel_iff,preal_add_right_cancel_iff];
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1114
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1115
(*** Completeness of preal ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1116
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1117
(*** prove that supremum is a cut ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1118
Goal "!!P. ? (X::preal). X: P ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1119
\         ? q.  q: {w. ? X. X : P & w : Rep_preal X}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1120
by Safe_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1121
by (cut_inst_tac [("X","X")] mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1122
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1123
qed "preal_sup_mem_Ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1124
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1125
(** Part 1 of Dedekind def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1126
Goal "!!P. ? (X::preal). X: P ==> \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1127
\         {} < {w. ? X : P. w : Rep_preal X}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1128
by (dtac preal_sup_mem_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1129
by (auto_tac (claset() addSIs [psubsetI] addEs [equalityCE],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1130
qed "preal_sup_set_not_empty";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1131
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1132
(** Part 2 of Dedekind sections def **) 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1133
Goalw [preal_less_def] "!!P. ? Y. (! X: P. X < Y)  \             
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1134
\         ==> ? q. q ~: {w. ? X. X: P & w: Rep_preal(X)}"; (**)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1135
by (auto_tac (claset(),simpset() addsimps [psubset_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1136
by (cut_inst_tac [("X","Y")] not_mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1137
by (etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1138
by (res_inst_tac [("x","x")] exI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1139
by (auto_tac (claset() addSDs [bspec],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1140
qed "preal_sup_not_mem_Ex";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1141
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1142
Goalw [preal_le_def] "!!P. ? Y. (! X: P. X <= Y)  \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1143
\         ==> ? q. q ~: {w. ? X. X: P & w: Rep_preal(X)}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1144
by (Step_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1145
by (cut_inst_tac [("X","Y")] not_mem_Rep_preal_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1146
by (etac exE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1147
by (res_inst_tac [("x","x")] exI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1148
by (auto_tac (claset() addSDs [bspec],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1149
qed "preal_sup_not_mem_Ex1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1150
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1151
Goal "!!P. ? Y. (! X: P. X < Y)  \                                    
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1152
\         ==> {w. ? X: P. w: Rep_preal(X)} < {q. True}";       (**)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1153
by (dtac preal_sup_not_mem_Ex 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1154
by (auto_tac (claset() addSIs [psubsetI],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1155
by (eres_inst_tac [("c","q")] equalityCE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1156
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1157
qed "preal_sup_set_not_prat_set";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1158
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1159
Goal "!!P. ? Y. (! X: P. X <= Y)  \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1160
\         ==> {w. ? X: P. w: Rep_preal(X)} < {q. True}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1161
by (dtac preal_sup_not_mem_Ex1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1162
by (auto_tac (claset() addSIs [psubsetI],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1163
by (eres_inst_tac [("c","q")] equalityCE 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1164
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1165
qed "preal_sup_set_not_prat_set1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1166
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1167
(** Part 3 of Dedekind sections def **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1168
Goal "!!P. [|? (X::preal). X: P; ? Y. (! X:P. X < Y) |] \              
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1169
\         ==> ! y: {w. ? X: P. w: Rep_preal X}. \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1170
\             !z. z < y --> z: {w. ? X: P. w: Rep_preal X}";         (**)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1171
by (auto_tac(claset() addEs [Rep_preal RS prealE_lemma3b],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1172
qed "preal_sup_set_lemma3";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1173
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1174
Goal "!!P. [|? (X::preal). X: P; ? Y. (! X:P. X <= Y) |] \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1175
\         ==> ! y: {w. ? X: P. w: Rep_preal X}. \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1176
\             !z. z < y --> z: {w. ? X: P. w: Rep_preal X}";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1177
by (auto_tac(claset() addEs [Rep_preal RS prealE_lemma3b],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1178
qed "preal_sup_set_lemma3_1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1179
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1180
Goal "!!P. [|? (X::preal). X: P; ? Y. (! X:P. X < Y) |] \              
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1181
\         ==>  !y: {w. ? X: P. w: Rep_preal X}. \                        
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1182
\             Bex {w. ? X: P. w: Rep_preal X} (op < y)";                (**)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1183
by (blast_tac (claset() addDs [(Rep_preal RS prealE_lemma4a)]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1184
qed "preal_sup_set_lemma4";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1185
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1186
Goal "!!P. [|? (X::preal). X: P; ? Y. (! X:P. X <= Y) |] \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1187
\         ==>  !y: {w. ? X: P. w: Rep_preal X}. \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1188
\             Bex {w. ? X: P. w: Rep_preal X} (op < y)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1189
by (blast_tac (claset() addDs [(Rep_preal RS prealE_lemma4a)]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1190
qed "preal_sup_set_lemma4_1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1191
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1192
Goal "!!P. [|? (X::preal). X: P; ? Y. (! X:P. X < Y) |] \            
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1193
\         ==> {w. ? X: P. w: Rep_preal(X)}: preal";                      (**)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1194
by (rtac prealI2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1195
by (rtac preal_sup_set_not_empty 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1196
by (rtac preal_sup_set_not_prat_set 2);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1197
by (rtac preal_sup_set_lemma3 3);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1198
by (rtac preal_sup_set_lemma4 5);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1199
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1200
qed "preal_sup";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1201
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1202
Goal "!!P. [|? (X::preal). X: P; ? Y. (! X:P. X <= Y) |] \
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1203
\         ==> {w. ? X: P. w: Rep_preal(X)}: preal";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1204
by (rtac prealI2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1205
by (rtac preal_sup_set_not_empty 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1206
by (rtac preal_sup_set_not_prat_set1 2);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1207
by (rtac preal_sup_set_lemma3_1 3);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1208
by (rtac preal_sup_set_lemma4_1 5);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1209
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1210
qed "preal_sup1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1211
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1212
Goalw [psup_def] "!!P. ? Y. (! X:P. X < Y) ==> ! x: P. x <= psup P";      (**) 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1213
by (auto_tac (claset(),simpset() addsimps [preal_le_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1214
by (rtac (preal_sup RS Abs_preal_inverse RS ssubst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1215
by Auto_tac;
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1216
qed "preal_psup_leI";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1217
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1218
Goalw [psup_def] "!!P. ? Y. (! X:P. X <= Y) ==> ! x: P. x <= psup P";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1219
by (auto_tac (claset(),simpset() addsimps [preal_le_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1220
by (rtac (preal_sup1 RS Abs_preal_inverse RS ssubst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1221
by (auto_tac (claset(),simpset() addsimps [preal_le_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1222
qed "preal_psup_leI2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1223
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1224
Goal "!!P. [| ? Y. (! X:P. X < Y); x : P |] ==> x <= psup P";              (**)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1225
by (blast_tac (claset() addSDs [preal_psup_leI]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1226
qed "preal_psup_leI2b";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1227
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1228
Goal "!!P. [| ? Y. (! X:P. X <= Y); x : P |] ==> x <= psup P";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1229
by (blast_tac (claset() addSDs [preal_psup_leI2]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1230
qed "preal_psup_leI2a";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1231
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1232
Goalw [psup_def] "!!P. [| ? X. X : P; ! X:P. X < Y |] ==> psup P <= Y";   (**)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1233
by (auto_tac (claset(),simpset() addsimps [preal_le_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1234
by (dtac (([exI,exI] MRS preal_sup) RS Abs_preal_inverse RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1235
by (rotate_tac 1 2);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1236
by (assume_tac 2);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1237
by (auto_tac (claset() addSDs [bspec],simpset() addsimps [preal_less_def,psubset_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1238
qed "psup_le_ub";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1239
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1240
Goalw [psup_def] "!!P. [| ? X. X : P; ! X:P. X <= Y |] ==> psup P <= Y";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1241
by (auto_tac (claset(),simpset() addsimps [preal_le_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1242
by (dtac (([exI,exI] MRS preal_sup1) RS Abs_preal_inverse RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1243
by (rotate_tac 1 2);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1244
by (assume_tac 2);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1245
by (auto_tac (claset() addSDs [bspec],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1246
    simpset() addsimps [preal_less_def,psubset_def,preal_le_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1247
qed "psup_le_ub1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1248
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1249
(** supremum property **)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1250
Goal "!!P. [|? (X::preal). X: P; ? Y. (! X:P. X < Y) |] \                  
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1251
\         ==> (!Y. (? X: P. Y < X) = (Y < psup P))";              
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1252
by (forward_tac [preal_sup RS Abs_preal_inverse] 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1253
by (Fast_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1254
by (auto_tac (claset() addSIs [psubsetI],simpset() addsimps [psup_def,preal_less_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1255
by (blast_tac (claset() addDs [psubset_def RS meta_eq_to_obj_eq RS iffD1]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1256
by (rotate_tac 4 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1257
by (asm_full_simp_tac (simpset() addsimps [psubset_def]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1258
by (dtac bspec 1 THEN assume_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1259
by (REPEAT(etac conjE 1));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1260
by (EVERY1[rtac swap, assume_tac, rtac set_ext]);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1261
by (auto_tac (claset() addSDs [lemma_psubset_mem],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1262
by (cut_inst_tac [("r1.0","Xa"),("r2.0","Ya")] preal_linear 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1263
by (auto_tac (claset() addDs [psubsetD],simpset() addsimps [preal_less_def]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1264
qed "preal_complete";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1265
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1266
(****)(****)(****)(****)(****)(****)(****)(****)(****)(****)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1267
    (****** Embedding ******)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1268
(*** mapping from prat into preal ***)
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1269
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1270
Goal "!!z1. x < z1 + z2 ==> x * z1 * qinv (z1 + z2) < z1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1271
by (dres_inst_tac [("x","z1 * qinv (z1 + z2)")] prat_mult_less2_mono1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1272
by (asm_full_simp_tac (simpset() addsimps prat_mult_ac) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1273
qed "lemma_preal_rat_less";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1274
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1275
Goal "!!z1. x < z1 + z2 ==> x * z2 * qinv (z1 + z2) < z2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1276
by (stac prat_add_commute 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1277
by (dtac (prat_add_commute RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1278
by (etac lemma_preal_rat_less 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1279
qed "lemma_preal_rat_less2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1280
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1281
Goalw [preal_prat_def,preal_add_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1282
            "@#((z1::prat) + z2) = @#z1 + @#z2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1283
by (res_inst_tac [("f","Abs_preal")] arg_cong 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1284
by (auto_tac (claset() addIs [prat_add_less_mono] addSIs [set_ext],simpset() addsimps 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1285
    [lemma_prat_less_set_mem_preal RS Abs_preal_inverse]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1286
by (res_inst_tac [("x","x*z1*qinv(z1+z2)")] exI 1 THEN rtac conjI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1287
by (etac lemma_preal_rat_less 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1288
by (res_inst_tac [("x","x*z2*qinv(z1+z2)")] exI 1 THEN rtac conjI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1289
by (etac lemma_preal_rat_less2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1290
by (asm_full_simp_tac (simpset() addsimps [prat_add_mult_distrib RS sym,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1291
     prat_add_mult_distrib2 RS sym] @ prat_mult_ac) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1292
qed "preal_prat_add";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1293
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1294
Goal "!!xa. x < xa ==> x*z1*qinv(xa) < z1";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1295
by (dres_inst_tac [("x","z1 * qinv xa")] prat_mult_less2_mono1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1296
by (dtac (prat_mult_left_commute RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1297
by (asm_full_simp_tac (simpset() addsimps prat_mult_ac) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1298
qed "lemma_preal_rat_less3";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1299
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1300
Goal "!!xa. xa < z1 * z2 ==> xa*z2*qinv(z1*z2) < z2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1301
by (dres_inst_tac [("x","z2 * qinv(z1*z2)")] prat_mult_less2_mono1 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1302
by (dtac (prat_mult_left_commute RS subst) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1303
by (asm_full_simp_tac (simpset() addsimps prat_mult_ac) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1304
qed "lemma_preal_rat_less4";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1305
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1306
Goalw [preal_prat_def,preal_mult_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1307
            "@#((z1::prat) * z2) = @#z1 * @#z2";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1308
by (res_inst_tac [("f","Abs_preal")] arg_cong 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1309
by (auto_tac (claset() addIs [prat_mult_less_mono] addSIs [set_ext],simpset() addsimps 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1310
    [lemma_prat_less_set_mem_preal RS Abs_preal_inverse]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1311
by (dtac prat_dense 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1312
by (Step_tac 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1313
by (res_inst_tac [("x","x*z1*qinv(xa)")] exI 1 THEN rtac conjI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1314
by (etac lemma_preal_rat_less3 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1315
by (res_inst_tac [("x"," xa*z2*qinv(z1*z2)")] exI 1 THEN rtac conjI 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1316
by (etac lemma_preal_rat_less4 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1317
by (asm_full_simp_tac (simpset() 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1318
    addsimps [qinv_mult_eq RS sym] @ prat_mult_ac) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1319
by (asm_full_simp_tac (simpset() 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1320
    addsimps [prat_mult_assoc RS sym]) 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1321
qed "preal_prat_mult";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1322
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1323
Goalw [preal_prat_def,preal_less_def] 
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1324
      "(@#p < @#q) = (p < q)";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1325
by (auto_tac (claset() addSDs [lemma_prat_set_eq] addEs [prat_less_trans],
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1326
    simpset() addsimps [lemma_prat_less_set_mem_preal,
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1327
    psubset_def,prat_less_not_refl]));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1328
by (res_inst_tac [("q1.0","p"),("q2.0","q")] prat_linear_less2 1);
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1329
by (auto_tac (claset() addIs [prat_less_irrefl],simpset()));
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1330
qed "preal_prat_less_iff";
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1331
7b5ea59c0275 Installation of target HOL-Real
paulson
parents:
diff changeset
  1332
Addsimps [preal_prat_less_iff];